yvan-ext.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'modeler', 'bpmn-js-properties-panel', 'lay-excel', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, BpmnModeler, bpmnJsPropertiesPanel, LAY_EXCEL, handlebars, xterm, xtermAddonFit, sqlFormat) { 'use strict';
  2. var axios__default = 'default' in axios ? axios['default'] : axios;
  3. Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
  4. _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2;
  5. $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2;
  6. moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1;
  7. XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX;
  8. localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage;
  9. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  10. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  11. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  12. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. };
  50. var comboGrid = {
  51. selectOnTab: true,
  52. pickerHeight: 500,
  53. pickerWidth: 850,
  54. editEnable: null,
  55. };
  56. var comboGridPicker = {
  57. xtype: 'yvgrid',
  58. layout: 'fit',
  59. selModel: {
  60. selType: 'rowmodel',
  61. mode: 'SINGLE'
  62. },
  63. };
  64. var comboGridMulti = {
  65. selectOnTab: true,
  66. pickerHeight: 500,
  67. pickerWidth: 850,
  68. editEnable: null,
  69. splitChar: ',',
  70. displayField: 'text',
  71. valueField: 'id',
  72. autoLoad: true,
  73. };
  74. var comboGridMultiPicker = {
  75. selType: 'checkboxmodel',
  76. selModel: {
  77. type: 'checkboxmodel',
  78. checkOnly: false
  79. },
  80. };
  81. var numberfield = {
  82. labelAlign: 'right',
  83. decimalPrecision: 6,
  84. labelWidth: labelWidth,
  85. };
  86. var checkbox = {
  87. labelAlign: 'right',
  88. labelWidth: labelWidth,
  89. checkedValue: true,
  90. uncheckedValue: false,
  91. };
  92. var checkboxgroup = {
  93. labelAlign: 'right',
  94. labelWidth: labelWidth,
  95. };
  96. var radio = {
  97. labelAlign: 'right',
  98. labelWidth: labelWidth,
  99. };
  100. var radiogroup = {
  101. labelAlign: 'right',
  102. labelWidth: labelWidth,
  103. simpleValue: true,
  104. layout: 'hbox',
  105. defaults: {
  106. xtype: 'radio',
  107. name: 'type',
  108. margin: '0 15 0 0'
  109. },
  110. };
  111. var form = {
  112. margin: '5 5 0 0',
  113. border: false,
  114. defaults: {
  115. margin: '0 0 5 0',
  116. border: false,
  117. },
  118. };
  119. var column = {
  120. filter: { type: 'string' },
  121. };
  122. var grid = {
  123. border: true,
  124. columnLines: true,
  125. rowLines: true,
  126. plugins: {
  127. cellediting: {
  128. clicksToEdit: 1,
  129. },
  130. gridfilters: true
  131. },
  132. multiColumnSort: true,
  133. viewConfig: {
  134. enableTextSelection: true,
  135. sortOnClick: false,
  136. emptyText: '没有数据'
  137. },
  138. selModel: {
  139. type: 'checkboxmodel',
  140. checkOnly: false
  141. },
  142. pagination: true,
  143. pageSize: 50,
  144. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  145. hideFootbar: false,
  146. hideRefresh: false,
  147. hideExport: false,
  148. hideAutoSize: false,
  149. hideClearFilter: false,
  150. hideSaveGridUIConfig: false,
  151. hideClearGridUIConfig: false,
  152. autoLoad: true,
  153. remoteSort: false,
  154. remoteFilter: false,
  155. enableLocking: true,
  156. syncRowHeight: false,
  157. enableColumnMove: true,
  158. enableColumnHide: true,
  159. enableColumnResize: true,
  160. hidden: false,
  161. disabled: false,
  162. exportExcelPageSize: 100,
  163. exportExcelCurrentPage: 1,
  164. exportExcelTotal: 0,
  165. cellTip: false,
  166. };
  167. var fieldContainer = {
  168. labelAlign: 'right',
  169. labelWidth: labelWidth,
  170. layout: 'hbox',
  171. defaults: {
  172. flex: 1,
  173. }
  174. };
  175. var tree = {
  176. autoLoad: true,
  177. hideFilter: false,
  178. hideToolbar: false,
  179. hideRefresh: false,
  180. hideExpand: false,
  181. hideCollapse: false,
  182. root: [],
  183. rootVisible: false,
  184. };
  185. var search = {
  186. labelAlign: 'right',
  187. labelWidth: labelWidth,
  188. };
  189. var text = {
  190. labelAlign: 'right',
  191. labelWidth: labelWidth,
  192. msgTarget: 'qtip',
  193. };
  194. var toolbar = {
  195. overflowHandler: 'menu',
  196. };
  197. var tbfill = {};
  198. var tbseparator = {};
  199. var button = {};
  200. var fieldSet = {
  201. margin: '5 5 0 0',
  202. border: false,
  203. defaults: {
  204. margin: '0 0 5 0',
  205. border: false,
  206. },
  207. };
  208. var storeAjax = {
  209. timeout: 60000
  210. };
  211. var panel = {};
  212. var splitter = {};
  213. var maintab = {};
  214. var rows = {};
  215. var cols = {
  216. defaults: {
  217. flex: 1
  218. },
  219. };
  220. var bpmn = {
  221. hideRefresh: false,
  222. autoLoad: true,
  223. dataSource: '',
  224. bpmnConfig: {}
  225. };
  226. //# sourceMappingURL=Defaults.js.map
  227. var Defaults = /*#__PURE__*/Object.freeze({
  228. __proto__: null,
  229. windows: windows,
  230. date: date,
  231. tagfield: tagfield,
  232. combo: combo,
  233. comboGrid: comboGrid,
  234. comboGridPicker: comboGridPicker,
  235. comboGridMulti: comboGridMulti,
  236. comboGridMultiPicker: comboGridMultiPicker,
  237. numberfield: numberfield,
  238. checkbox: checkbox,
  239. checkboxgroup: checkboxgroup,
  240. radio: radio,
  241. radiogroup: radiogroup,
  242. form: form,
  243. column: column,
  244. grid: grid,
  245. fieldContainer: fieldContainer,
  246. tree: tree,
  247. search: search,
  248. text: text,
  249. toolbar: toolbar,
  250. tbfill: tbfill,
  251. tbseparator: tbseparator,
  252. button: button,
  253. fieldSet: fieldSet,
  254. storeAjax: storeAjax,
  255. panel: panel,
  256. splitter: splitter,
  257. maintab: maintab,
  258. rows: rows,
  259. cols: cols,
  260. bpmn: bpmn
  261. });
  262. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  263. function createCommonjsModule(fn, module) {
  264. return module = { exports: {} }, fn(module, module.exports), module.exports;
  265. }
  266. var dist = createCommonjsModule(function (module, exports) {
  267. (function (global, factory) {
  268. module.exports = factory() ;
  269. }(commonjsGlobal, (function () {
  270. function createCommonjsModule(fn, module) {
  271. return module = { exports: {} }, fn(module, module.exports), module.exports;
  272. }
  273. var _global = createCommonjsModule(function (module) {
  274. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  275. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  276. ? window : typeof self != 'undefined' && self.Math == Math ? self
  277. // eslint-disable-next-line no-new-func
  278. : Function('return this')();
  279. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  280. });
  281. var _core = createCommonjsModule(function (module) {
  282. var core = module.exports = { version: '2.6.5' };
  283. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  284. });
  285. var _core_1 = _core.version;
  286. var _isObject = function (it) {
  287. return typeof it === 'object' ? it !== null : typeof it === 'function';
  288. };
  289. var _anObject = function (it) {
  290. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  291. return it;
  292. };
  293. var _fails = function (exec) {
  294. try {
  295. return !!exec();
  296. } catch (e) {
  297. return true;
  298. }
  299. };
  300. // Thank's IE8 for his funny defineProperty
  301. var _descriptors = !_fails(function () {
  302. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  303. });
  304. var document = _global.document;
  305. // typeof document.createElement is 'object' in old IE
  306. var is = _isObject(document) && _isObject(document.createElement);
  307. var _domCreate = function (it) {
  308. return is ? document.createElement(it) : {};
  309. };
  310. var _ie8DomDefine = !_descriptors && !_fails(function () {
  311. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  312. });
  313. // 7.1.1 ToPrimitive(input [, PreferredType])
  314. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  315. // and the second argument - flag - preferred type is a string
  316. var _toPrimitive = function (it, S) {
  317. if (!_isObject(it)) { return it; }
  318. var fn, val;
  319. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  320. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  321. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. throw TypeError("Can't convert object to primitive value");
  323. };
  324. var dP = Object.defineProperty;
  325. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  326. _anObject(O);
  327. P = _toPrimitive(P, true);
  328. _anObject(Attributes);
  329. if (_ie8DomDefine) { try {
  330. return dP(O, P, Attributes);
  331. } catch (e) { /* empty */ } }
  332. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  333. if ('value' in Attributes) { O[P] = Attributes.value; }
  334. return O;
  335. };
  336. var _objectDp = {
  337. f: f
  338. };
  339. var _propertyDesc = function (bitmap, value) {
  340. return {
  341. enumerable: !(bitmap & 1),
  342. configurable: !(bitmap & 2),
  343. writable: !(bitmap & 4),
  344. value: value
  345. };
  346. };
  347. var _hide = _descriptors ? function (object, key, value) {
  348. return _objectDp.f(object, key, _propertyDesc(1, value));
  349. } : function (object, key, value) {
  350. object[key] = value;
  351. return object;
  352. };
  353. var hasOwnProperty = {}.hasOwnProperty;
  354. var _has = function (it, key) {
  355. return hasOwnProperty.call(it, key);
  356. };
  357. var id = 0;
  358. var px = Math.random();
  359. var _uid = function (key) {
  360. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  361. };
  362. var _shared = createCommonjsModule(function (module) {
  363. var SHARED = '__core-js_shared__';
  364. var store = _global[SHARED] || (_global[SHARED] = {});
  365. (module.exports = function (key, value) {
  366. return store[key] || (store[key] = value !== undefined ? value : {});
  367. })('versions', []).push({
  368. version: _core.version,
  369. mode: 'global',
  370. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  371. });
  372. });
  373. var _functionToString = _shared('native-function-to-string', Function.toString);
  374. var _redefine = createCommonjsModule(function (module) {
  375. var SRC = _uid('src');
  376. var TO_STRING = 'toString';
  377. var TPL = ('' + _functionToString).split(TO_STRING);
  378. _core.inspectSource = function (it) {
  379. return _functionToString.call(it);
  380. };
  381. (module.exports = function (O, key, val, safe) {
  382. var isFunction = typeof val == 'function';
  383. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  384. if (O[key] === val) { return; }
  385. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  386. if (O === _global) {
  387. O[key] = val;
  388. } else if (!safe) {
  389. delete O[key];
  390. _hide(O, key, val);
  391. } else if (O[key]) {
  392. O[key] = val;
  393. } else {
  394. _hide(O, key, val);
  395. }
  396. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  397. })(Function.prototype, TO_STRING, function toString() {
  398. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  399. });
  400. });
  401. var _aFunction = function (it) {
  402. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  403. return it;
  404. };
  405. // optional / simple context binding
  406. var _ctx = function (fn, that, length) {
  407. _aFunction(fn);
  408. if (that === undefined) { return fn; }
  409. switch (length) {
  410. case 1: return function (a) {
  411. return fn.call(that, a);
  412. };
  413. case 2: return function (a, b) {
  414. return fn.call(that, a, b);
  415. };
  416. case 3: return function (a, b, c) {
  417. return fn.call(that, a, b, c);
  418. };
  419. }
  420. return function (/* ...args */) {
  421. return fn.apply(that, arguments);
  422. };
  423. };
  424. var PROTOTYPE = 'prototype';
  425. var $export = function (type, name, source) {
  426. var IS_FORCED = type & $export.F;
  427. var IS_GLOBAL = type & $export.G;
  428. var IS_STATIC = type & $export.S;
  429. var IS_PROTO = type & $export.P;
  430. var IS_BIND = type & $export.B;
  431. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  432. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  433. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  434. var key, own, out, exp;
  435. if (IS_GLOBAL) { source = name; }
  436. for (key in source) {
  437. // contains in native
  438. own = !IS_FORCED && target && target[key] !== undefined;
  439. // export native or passed
  440. out = (own ? target : source)[key];
  441. // bind timers to global for call from export context
  442. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  443. // extend global
  444. if (target) { _redefine(target, key, out, type & $export.U); }
  445. // export
  446. if (exports[key] != out) { _hide(exports, key, exp); }
  447. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  448. }
  449. };
  450. _global.core = _core;
  451. // type bitmap
  452. $export.F = 1; // forced
  453. $export.G = 2; // global
  454. $export.S = 4; // static
  455. $export.P = 8; // proto
  456. $export.B = 16; // bind
  457. $export.W = 32; // wrap
  458. $export.U = 64; // safe
  459. $export.R = 128; // real proto method for `library`
  460. var _export = $export;
  461. // 7.1.4 ToInteger
  462. var ceil = Math.ceil;
  463. var floor = Math.floor;
  464. var _toInteger = function (it) {
  465. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  466. };
  467. // 7.2.1 RequireObjectCoercible(argument)
  468. var _defined = function (it) {
  469. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  470. return it;
  471. };
  472. // true -> String#at
  473. // false -> String#codePointAt
  474. var _stringAt = function (TO_STRING) {
  475. return function (that, pos) {
  476. var s = String(_defined(that));
  477. var i = _toInteger(pos);
  478. var l = s.length;
  479. var a, b;
  480. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  481. a = s.charCodeAt(i);
  482. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  483. ? TO_STRING ? s.charAt(i) : a
  484. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  485. };
  486. };
  487. var $at = _stringAt(false);
  488. _export(_export.P, 'String', {
  489. // 21.1.3.3 String.prototype.codePointAt(pos)
  490. codePointAt: function codePointAt(pos) {
  491. return $at(this, pos);
  492. }
  493. });
  494. var codePointAt = _core.String.codePointAt;
  495. var max = Math.max;
  496. var min = Math.min;
  497. var _toAbsoluteIndex = function (index, length) {
  498. index = _toInteger(index);
  499. return index < 0 ? max(index + length, 0) : min(index, length);
  500. };
  501. var fromCharCode = String.fromCharCode;
  502. var $fromCodePoint = String.fromCodePoint;
  503. // length should be 1, old FF problem
  504. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  505. // 21.1.2.2 String.fromCodePoint(...codePoints)
  506. fromCodePoint: function fromCodePoint(x) {
  507. var arguments$1 = arguments;
  508. // eslint-disable-line no-unused-vars
  509. var res = [];
  510. var aLen = arguments.length;
  511. var i = 0;
  512. var code;
  513. while (aLen > i) {
  514. code = +arguments$1[i++];
  515. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  516. res.push(code < 0x10000
  517. ? fromCharCode(code)
  518. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  519. );
  520. } return res.join('');
  521. }
  522. });
  523. var fromCodePoint = _core.String.fromCodePoint;
  524. // This is a generated file. Do not edit.
  525. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  526. var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  527. var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  528. var unicode = {
  529. Space_Separator: Space_Separator,
  530. ID_Start: ID_Start,
  531. ID_Continue: ID_Continue
  532. };
  533. var util = {
  534. isSpaceSeparator: function isSpaceSeparator (c) {
  535. return typeof c === 'string' && unicode.Space_Separator.test(c)
  536. },
  537. isIdStartChar: function isIdStartChar (c) {
  538. return typeof c === 'string' && (
  539. (c >= 'a' && c <= 'z') ||
  540. (c >= 'A' && c <= 'Z') ||
  541. (c === '$') || (c === '_') ||
  542. unicode.ID_Start.test(c)
  543. )
  544. },
  545. isIdContinueChar: function isIdContinueChar (c) {
  546. return typeof c === 'string' && (
  547. (c >= 'a' && c <= 'z') ||
  548. (c >= 'A' && c <= 'Z') ||
  549. (c >= '0' && c <= '9') ||
  550. (c === '$') || (c === '_') ||
  551. (c === '\u200C') || (c === '\u200D') ||
  552. unicode.ID_Continue.test(c)
  553. )
  554. },
  555. isDigit: function isDigit (c) {
  556. return typeof c === 'string' && /[0-9]/.test(c)
  557. },
  558. isHexDigit: function isHexDigit (c) {
  559. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  560. },
  561. };
  562. var source;
  563. var parseState;
  564. var stack;
  565. var pos;
  566. var line;
  567. var column;
  568. var token;
  569. var key;
  570. var root;
  571. var parse = function parse (text, reviver) {
  572. source = String(text);
  573. parseState = 'start';
  574. stack = [];
  575. pos = 0;
  576. line = 1;
  577. column = 0;
  578. token = undefined;
  579. key = undefined;
  580. root = undefined;
  581. do {
  582. token = lex();
  583. // This code is unreachable.
  584. // if (!parseStates[parseState]) {
  585. // throw invalidParseState()
  586. // }
  587. parseStates[parseState]();
  588. } while (token.type !== 'eof')
  589. if (typeof reviver === 'function') {
  590. return internalize({'': root}, '', reviver)
  591. }
  592. return root
  593. };
  594. function internalize (holder, name, reviver) {
  595. var value = holder[name];
  596. if (value != null && typeof value === 'object') {
  597. for (var key in value) {
  598. var replacement = internalize(value, key, reviver);
  599. if (replacement === undefined) {
  600. delete value[key];
  601. } else {
  602. value[key] = replacement;
  603. }
  604. }
  605. }
  606. return reviver.call(holder, name, value)
  607. }
  608. var lexState;
  609. var buffer;
  610. var doubleQuote;
  611. var sign;
  612. var c;
  613. function lex () {
  614. lexState = 'default';
  615. buffer = '';
  616. doubleQuote = false;
  617. sign = 1;
  618. for (;;) {
  619. c = peek();
  620. // This code is unreachable.
  621. // if (!lexStates[lexState]) {
  622. // throw invalidLexState(lexState)
  623. // }
  624. var token = lexStates[lexState]();
  625. if (token) {
  626. return token
  627. }
  628. }
  629. }
  630. function peek () {
  631. if (source[pos]) {
  632. return String.fromCodePoint(source.codePointAt(pos))
  633. }
  634. }
  635. function read () {
  636. var c = peek();
  637. if (c === '\n') {
  638. line++;
  639. column = 0;
  640. } else if (c) {
  641. column += c.length;
  642. } else {
  643. column++;
  644. }
  645. if (c) {
  646. pos += c.length;
  647. }
  648. return c
  649. }
  650. var lexStates = {
  651. default: function default$1 () {
  652. switch (c) {
  653. case '\t':
  654. case '\v':
  655. case '\f':
  656. case ' ':
  657. case '\u00A0':
  658. case '\uFEFF':
  659. case '\n':
  660. case '\r':
  661. case '\u2028':
  662. case '\u2029':
  663. read();
  664. return
  665. case '/':
  666. read();
  667. lexState = 'comment';
  668. return
  669. case undefined:
  670. read();
  671. return newToken('eof')
  672. }
  673. if (util.isSpaceSeparator(c)) {
  674. read();
  675. return
  676. }
  677. // This code is unreachable.
  678. // if (!lexStates[parseState]) {
  679. // throw invalidLexState(parseState)
  680. // }
  681. return lexStates[parseState]()
  682. },
  683. comment: function comment () {
  684. switch (c) {
  685. case '*':
  686. read();
  687. lexState = 'multiLineComment';
  688. return
  689. case '/':
  690. read();
  691. lexState = 'singleLineComment';
  692. return
  693. }
  694. throw invalidChar(read())
  695. },
  696. multiLineComment: function multiLineComment () {
  697. switch (c) {
  698. case '*':
  699. read();
  700. lexState = 'multiLineCommentAsterisk';
  701. return
  702. case undefined:
  703. throw invalidChar(read())
  704. }
  705. read();
  706. },
  707. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  708. switch (c) {
  709. case '*':
  710. read();
  711. return
  712. case '/':
  713. read();
  714. lexState = 'default';
  715. return
  716. case undefined:
  717. throw invalidChar(read())
  718. }
  719. read();
  720. lexState = 'multiLineComment';
  721. },
  722. singleLineComment: function singleLineComment () {
  723. switch (c) {
  724. case '\n':
  725. case '\r':
  726. case '\u2028':
  727. case '\u2029':
  728. read();
  729. lexState = 'default';
  730. return
  731. case undefined:
  732. read();
  733. return newToken('eof')
  734. }
  735. read();
  736. },
  737. value: function value () {
  738. switch (c) {
  739. case '{':
  740. case '[':
  741. return newToken('punctuator', read())
  742. case 'n':
  743. read();
  744. literal('ull');
  745. return newToken('null', null)
  746. case 't':
  747. read();
  748. literal('rue');
  749. return newToken('boolean', true)
  750. case 'f':
  751. read();
  752. literal('alse');
  753. return newToken('boolean', false)
  754. case '-':
  755. case '+':
  756. if (read() === '-') {
  757. sign = -1;
  758. }
  759. lexState = 'sign';
  760. return
  761. case '.':
  762. buffer = read();
  763. lexState = 'decimalPointLeading';
  764. return
  765. case '0':
  766. buffer = read();
  767. lexState = 'zero';
  768. return
  769. case '1':
  770. case '2':
  771. case '3':
  772. case '4':
  773. case '5':
  774. case '6':
  775. case '7':
  776. case '8':
  777. case '9':
  778. buffer = read();
  779. lexState = 'decimalInteger';
  780. return
  781. case 'I':
  782. read();
  783. literal('nfinity');
  784. return newToken('numeric', Infinity)
  785. case 'N':
  786. read();
  787. literal('aN');
  788. return newToken('numeric', NaN)
  789. case '"':
  790. case "'":
  791. doubleQuote = (read() === '"');
  792. buffer = '';
  793. lexState = 'string';
  794. return
  795. }
  796. throw invalidChar(read())
  797. },
  798. identifierNameStartEscape: function identifierNameStartEscape () {
  799. if (c !== 'u') {
  800. throw invalidChar(read())
  801. }
  802. read();
  803. var u = unicodeEscape();
  804. switch (u) {
  805. case '$':
  806. case '_':
  807. break
  808. default:
  809. if (!util.isIdStartChar(u)) {
  810. throw invalidIdentifier()
  811. }
  812. break
  813. }
  814. buffer += u;
  815. lexState = 'identifierName';
  816. },
  817. identifierName: function identifierName () {
  818. switch (c) {
  819. case '$':
  820. case '_':
  821. case '\u200C':
  822. case '\u200D':
  823. buffer += read();
  824. return
  825. case '\\':
  826. read();
  827. lexState = 'identifierNameEscape';
  828. return
  829. }
  830. if (util.isIdContinueChar(c)) {
  831. buffer += read();
  832. return
  833. }
  834. return newToken('identifier', buffer)
  835. },
  836. identifierNameEscape: function identifierNameEscape () {
  837. if (c !== 'u') {
  838. throw invalidChar(read())
  839. }
  840. read();
  841. var u = unicodeEscape();
  842. switch (u) {
  843. case '$':
  844. case '_':
  845. case '\u200C':
  846. case '\u200D':
  847. break
  848. default:
  849. if (!util.isIdContinueChar(u)) {
  850. throw invalidIdentifier()
  851. }
  852. break
  853. }
  854. buffer += u;
  855. lexState = 'identifierName';
  856. },
  857. sign: function sign$1 () {
  858. switch (c) {
  859. case '.':
  860. buffer = read();
  861. lexState = 'decimalPointLeading';
  862. return
  863. case '0':
  864. buffer = read();
  865. lexState = 'zero';
  866. return
  867. case '1':
  868. case '2':
  869. case '3':
  870. case '4':
  871. case '5':
  872. case '6':
  873. case '7':
  874. case '8':
  875. case '9':
  876. buffer = read();
  877. lexState = 'decimalInteger';
  878. return
  879. case 'I':
  880. read();
  881. literal('nfinity');
  882. return newToken('numeric', sign * Infinity)
  883. case 'N':
  884. read();
  885. literal('aN');
  886. return newToken('numeric', NaN)
  887. }
  888. throw invalidChar(read())
  889. },
  890. zero: function zero () {
  891. switch (c) {
  892. case '.':
  893. buffer += read();
  894. lexState = 'decimalPoint';
  895. return
  896. case 'e':
  897. case 'E':
  898. buffer += read();
  899. lexState = 'decimalExponent';
  900. return
  901. case 'x':
  902. case 'X':
  903. buffer += read();
  904. lexState = 'hexadecimal';
  905. return
  906. }
  907. return newToken('numeric', sign * 0)
  908. },
  909. decimalInteger: function decimalInteger () {
  910. switch (c) {
  911. case '.':
  912. buffer += read();
  913. lexState = 'decimalPoint';
  914. return
  915. case 'e':
  916. case 'E':
  917. buffer += read();
  918. lexState = 'decimalExponent';
  919. return
  920. }
  921. if (util.isDigit(c)) {
  922. buffer += read();
  923. return
  924. }
  925. return newToken('numeric', sign * Number(buffer))
  926. },
  927. decimalPointLeading: function decimalPointLeading () {
  928. if (util.isDigit(c)) {
  929. buffer += read();
  930. lexState = 'decimalFraction';
  931. return
  932. }
  933. throw invalidChar(read())
  934. },
  935. decimalPoint: function decimalPoint () {
  936. switch (c) {
  937. case 'e':
  938. case 'E':
  939. buffer += read();
  940. lexState = 'decimalExponent';
  941. return
  942. }
  943. if (util.isDigit(c)) {
  944. buffer += read();
  945. lexState = 'decimalFraction';
  946. return
  947. }
  948. return newToken('numeric', sign * Number(buffer))
  949. },
  950. decimalFraction: function decimalFraction () {
  951. switch (c) {
  952. case 'e':
  953. case 'E':
  954. buffer += read();
  955. lexState = 'decimalExponent';
  956. return
  957. }
  958. if (util.isDigit(c)) {
  959. buffer += read();
  960. return
  961. }
  962. return newToken('numeric', sign * Number(buffer))
  963. },
  964. decimalExponent: function decimalExponent () {
  965. switch (c) {
  966. case '+':
  967. case '-':
  968. buffer += read();
  969. lexState = 'decimalExponentSign';
  970. return
  971. }
  972. if (util.isDigit(c)) {
  973. buffer += read();
  974. lexState = 'decimalExponentInteger';
  975. return
  976. }
  977. throw invalidChar(read())
  978. },
  979. decimalExponentSign: function decimalExponentSign () {
  980. if (util.isDigit(c)) {
  981. buffer += read();
  982. lexState = 'decimalExponentInteger';
  983. return
  984. }
  985. throw invalidChar(read())
  986. },
  987. decimalExponentInteger: function decimalExponentInteger () {
  988. if (util.isDigit(c)) {
  989. buffer += read();
  990. return
  991. }
  992. return newToken('numeric', sign * Number(buffer))
  993. },
  994. hexadecimal: function hexadecimal () {
  995. if (util.isHexDigit(c)) {
  996. buffer += read();
  997. lexState = 'hexadecimalInteger';
  998. return
  999. }
  1000. throw invalidChar(read())
  1001. },
  1002. hexadecimalInteger: function hexadecimalInteger () {
  1003. if (util.isHexDigit(c)) {
  1004. buffer += read();
  1005. return
  1006. }
  1007. return newToken('numeric', sign * Number(buffer))
  1008. },
  1009. string: function string () {
  1010. switch (c) {
  1011. case '\\':
  1012. read();
  1013. buffer += escape();
  1014. return
  1015. case '"':
  1016. if (doubleQuote) {
  1017. read();
  1018. return newToken('string', buffer)
  1019. }
  1020. buffer += read();
  1021. return
  1022. case "'":
  1023. if (!doubleQuote) {
  1024. read();
  1025. return newToken('string', buffer)
  1026. }
  1027. buffer += read();
  1028. return
  1029. case '\n':
  1030. case '\r':
  1031. throw invalidChar(read())
  1032. case '\u2028':
  1033. case '\u2029':
  1034. separatorChar(c);
  1035. break
  1036. case undefined:
  1037. throw invalidChar(read())
  1038. }
  1039. buffer += read();
  1040. },
  1041. start: function start () {
  1042. switch (c) {
  1043. case '{':
  1044. case '[':
  1045. return newToken('punctuator', read())
  1046. // This code is unreachable since the default lexState handles eof.
  1047. // case undefined:
  1048. // return newToken('eof')
  1049. }
  1050. lexState = 'value';
  1051. },
  1052. beforePropertyName: function beforePropertyName () {
  1053. switch (c) {
  1054. case '$':
  1055. case '_':
  1056. buffer = read();
  1057. lexState = 'identifierName';
  1058. return
  1059. case '\\':
  1060. read();
  1061. lexState = 'identifierNameStartEscape';
  1062. return
  1063. case '}':
  1064. return newToken('punctuator', read())
  1065. case '"':
  1066. case "'":
  1067. doubleQuote = (read() === '"');
  1068. lexState = 'string';
  1069. return
  1070. }
  1071. if (util.isIdStartChar(c)) {
  1072. buffer += read();
  1073. lexState = 'identifierName';
  1074. return
  1075. }
  1076. throw invalidChar(read())
  1077. },
  1078. afterPropertyName: function afterPropertyName () {
  1079. if (c === ':') {
  1080. return newToken('punctuator', read())
  1081. }
  1082. throw invalidChar(read())
  1083. },
  1084. beforePropertyValue: function beforePropertyValue () {
  1085. lexState = 'value';
  1086. },
  1087. afterPropertyValue: function afterPropertyValue () {
  1088. switch (c) {
  1089. case ',':
  1090. case '}':
  1091. return newToken('punctuator', read())
  1092. }
  1093. throw invalidChar(read())
  1094. },
  1095. beforeArrayValue: function beforeArrayValue () {
  1096. if (c === ']') {
  1097. return newToken('punctuator', read())
  1098. }
  1099. lexState = 'value';
  1100. },
  1101. afterArrayValue: function afterArrayValue () {
  1102. switch (c) {
  1103. case ',':
  1104. case ']':
  1105. return newToken('punctuator', read())
  1106. }
  1107. throw invalidChar(read())
  1108. },
  1109. end: function end () {
  1110. // This code is unreachable since it's handled by the default lexState.
  1111. // if (c === undefined) {
  1112. // read()
  1113. // return newToken('eof')
  1114. // }
  1115. throw invalidChar(read())
  1116. },
  1117. };
  1118. function newToken (type, value) {
  1119. return {
  1120. type: type,
  1121. value: value,
  1122. line: line,
  1123. column: column,
  1124. }
  1125. }
  1126. function literal (s) {
  1127. for (var i = 0, list = s; i < list.length; i += 1) {
  1128. var c = list[i];
  1129. var p = peek();
  1130. if (p !== c) {
  1131. throw invalidChar(read())
  1132. }
  1133. read();
  1134. }
  1135. }
  1136. function escape () {
  1137. var c = peek();
  1138. switch (c) {
  1139. case 'b':
  1140. read();
  1141. return '\b'
  1142. case 'f':
  1143. read();
  1144. return '\f'
  1145. case 'n':
  1146. read();
  1147. return '\n'
  1148. case 'r':
  1149. read();
  1150. return '\r'
  1151. case 't':
  1152. read();
  1153. return '\t'
  1154. case 'v':
  1155. read();
  1156. return '\v'
  1157. case '0':
  1158. read();
  1159. if (util.isDigit(peek())) {
  1160. throw invalidChar(read())
  1161. }
  1162. return '\0'
  1163. case 'x':
  1164. read();
  1165. return hexEscape()
  1166. case 'u':
  1167. read();
  1168. return unicodeEscape()
  1169. case '\n':
  1170. case '\u2028':
  1171. case '\u2029':
  1172. read();
  1173. return ''
  1174. case '\r':
  1175. read();
  1176. if (peek() === '\n') {
  1177. read();
  1178. }
  1179. return ''
  1180. case '1':
  1181. case '2':
  1182. case '3':
  1183. case '4':
  1184. case '5':
  1185. case '6':
  1186. case '7':
  1187. case '8':
  1188. case '9':
  1189. throw invalidChar(read())
  1190. case undefined:
  1191. throw invalidChar(read())
  1192. }
  1193. return read()
  1194. }
  1195. function hexEscape () {
  1196. var buffer = '';
  1197. var c = peek();
  1198. if (!util.isHexDigit(c)) {
  1199. throw invalidChar(read())
  1200. }
  1201. buffer += read();
  1202. c = peek();
  1203. if (!util.isHexDigit(c)) {
  1204. throw invalidChar(read())
  1205. }
  1206. buffer += read();
  1207. return String.fromCodePoint(parseInt(buffer, 16))
  1208. }
  1209. function unicodeEscape () {
  1210. var buffer = '';
  1211. var count = 4;
  1212. while (count-- > 0) {
  1213. var c = peek();
  1214. if (!util.isHexDigit(c)) {
  1215. throw invalidChar(read())
  1216. }
  1217. buffer += read();
  1218. }
  1219. return String.fromCodePoint(parseInt(buffer, 16))
  1220. }
  1221. var parseStates = {
  1222. start: function start () {
  1223. if (token.type === 'eof') {
  1224. throw invalidEOF()
  1225. }
  1226. push();
  1227. },
  1228. beforePropertyName: function beforePropertyName () {
  1229. switch (token.type) {
  1230. case 'identifier':
  1231. case 'string':
  1232. key = token.value;
  1233. parseState = 'afterPropertyName';
  1234. return
  1235. case 'punctuator':
  1236. // This code is unreachable since it's handled by the lexState.
  1237. // if (token.value !== '}') {
  1238. // throw invalidToken()
  1239. // }
  1240. pop();
  1241. return
  1242. case 'eof':
  1243. throw invalidEOF()
  1244. }
  1245. // This code is unreachable since it's handled by the lexState.
  1246. // throw invalidToken()
  1247. },
  1248. afterPropertyName: function afterPropertyName () {
  1249. // This code is unreachable since it's handled by the lexState.
  1250. // if (token.type !== 'punctuator' || token.value !== ':') {
  1251. // throw invalidToken()
  1252. // }
  1253. if (token.type === 'eof') {
  1254. throw invalidEOF()
  1255. }
  1256. parseState = 'beforePropertyValue';
  1257. },
  1258. beforePropertyValue: function beforePropertyValue () {
  1259. if (token.type === 'eof') {
  1260. throw invalidEOF()
  1261. }
  1262. push();
  1263. },
  1264. beforeArrayValue: function beforeArrayValue () {
  1265. if (token.type === 'eof') {
  1266. throw invalidEOF()
  1267. }
  1268. if (token.type === 'punctuator' && token.value === ']') {
  1269. pop();
  1270. return
  1271. }
  1272. push();
  1273. },
  1274. afterPropertyValue: function afterPropertyValue () {
  1275. // This code is unreachable since it's handled by the lexState.
  1276. // if (token.type !== 'punctuator') {
  1277. // throw invalidToken()
  1278. // }
  1279. if (token.type === 'eof') {
  1280. throw invalidEOF()
  1281. }
  1282. switch (token.value) {
  1283. case ',':
  1284. parseState = 'beforePropertyName';
  1285. return
  1286. case '}':
  1287. pop();
  1288. }
  1289. // This code is unreachable since it's handled by the lexState.
  1290. // throw invalidToken()
  1291. },
  1292. afterArrayValue: function afterArrayValue () {
  1293. // This code is unreachable since it's handled by the lexState.
  1294. // if (token.type !== 'punctuator') {
  1295. // throw invalidToken()
  1296. // }
  1297. if (token.type === 'eof') {
  1298. throw invalidEOF()
  1299. }
  1300. switch (token.value) {
  1301. case ',':
  1302. parseState = 'beforeArrayValue';
  1303. return
  1304. case ']':
  1305. pop();
  1306. }
  1307. // This code is unreachable since it's handled by the lexState.
  1308. // throw invalidToken()
  1309. },
  1310. end: function end () {
  1311. // This code is unreachable since it's handled by the lexState.
  1312. // if (token.type !== 'eof') {
  1313. // throw invalidToken()
  1314. // }
  1315. },
  1316. };
  1317. function push () {
  1318. var value;
  1319. switch (token.type) {
  1320. case 'punctuator':
  1321. switch (token.value) {
  1322. case '{':
  1323. value = {};
  1324. break
  1325. case '[':
  1326. value = [];
  1327. break
  1328. }
  1329. break
  1330. case 'null':
  1331. case 'boolean':
  1332. case 'numeric':
  1333. case 'string':
  1334. value = token.value;
  1335. break
  1336. // This code is unreachable.
  1337. // default:
  1338. // throw invalidToken()
  1339. }
  1340. if (root === undefined) {
  1341. root = value;
  1342. } else {
  1343. var parent = stack[stack.length - 1];
  1344. if (Array.isArray(parent)) {
  1345. parent.push(value);
  1346. } else {
  1347. parent[key] = value;
  1348. }
  1349. }
  1350. if (value !== null && typeof value === 'object') {
  1351. stack.push(value);
  1352. if (Array.isArray(value)) {
  1353. parseState = 'beforeArrayValue';
  1354. } else {
  1355. parseState = 'beforePropertyName';
  1356. }
  1357. } else {
  1358. var current = stack[stack.length - 1];
  1359. if (current == null) {
  1360. parseState = 'end';
  1361. } else if (Array.isArray(current)) {
  1362. parseState = 'afterArrayValue';
  1363. } else {
  1364. parseState = 'afterPropertyValue';
  1365. }
  1366. }
  1367. }
  1368. function pop () {
  1369. stack.pop();
  1370. var current = stack[stack.length - 1];
  1371. if (current == null) {
  1372. parseState = 'end';
  1373. } else if (Array.isArray(current)) {
  1374. parseState = 'afterArrayValue';
  1375. } else {
  1376. parseState = 'afterPropertyValue';
  1377. }
  1378. }
  1379. // This code is unreachable.
  1380. // function invalidParseState () {
  1381. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1382. // }
  1383. // This code is unreachable.
  1384. // function invalidLexState (state) {
  1385. // return new Error(`JSON5: invalid lex state '${state}'`)
  1386. // }
  1387. function invalidChar (c) {
  1388. if (c === undefined) {
  1389. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1390. }
  1391. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1392. }
  1393. function invalidEOF () {
  1394. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1395. }
  1396. // This code is unreachable.
  1397. // function invalidToken () {
  1398. // if (token.type === 'eof') {
  1399. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1400. // }
  1401. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1402. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1403. // }
  1404. function invalidIdentifier () {
  1405. column -= 5;
  1406. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1407. }
  1408. function separatorChar (c) {
  1409. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1410. }
  1411. function formatChar (c) {
  1412. var replacements = {
  1413. "'": "\\'",
  1414. '"': '\\"',
  1415. '\\': '\\\\',
  1416. '\b': '\\b',
  1417. '\f': '\\f',
  1418. '\n': '\\n',
  1419. '\r': '\\r',
  1420. '\t': '\\t',
  1421. '\v': '\\v',
  1422. '\0': '\\0',
  1423. '\u2028': '\\u2028',
  1424. '\u2029': '\\u2029',
  1425. };
  1426. if (replacements[c]) {
  1427. return replacements[c]
  1428. }
  1429. if (c < ' ') {
  1430. var hexString = c.charCodeAt(0).toString(16);
  1431. return '\\x' + ('00' + hexString).substring(hexString.length)
  1432. }
  1433. return c
  1434. }
  1435. function syntaxError (message) {
  1436. var err = new SyntaxError(message);
  1437. err.lineNumber = line;
  1438. err.columnNumber = column;
  1439. return err
  1440. }
  1441. var stringify = function stringify (value, replacer, space) {
  1442. var stack = [];
  1443. var indent = '';
  1444. var propertyList;
  1445. var replacerFunc;
  1446. var gap = '';
  1447. var quote;
  1448. if (
  1449. replacer != null &&
  1450. typeof replacer === 'object' &&
  1451. !Array.isArray(replacer)
  1452. ) {
  1453. space = replacer.space;
  1454. quote = replacer.quote;
  1455. replacer = replacer.replacer;
  1456. }
  1457. if (typeof replacer === 'function') {
  1458. replacerFunc = replacer;
  1459. } else if (Array.isArray(replacer)) {
  1460. propertyList = [];
  1461. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1462. var v = list[i];
  1463. var item = (void 0);
  1464. if (typeof v === 'string') {
  1465. item = v;
  1466. } else if (
  1467. typeof v === 'number' ||
  1468. v instanceof String ||
  1469. v instanceof Number
  1470. ) {
  1471. item = String(v);
  1472. }
  1473. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1474. propertyList.push(item);
  1475. }
  1476. }
  1477. }
  1478. if (space instanceof Number) {
  1479. space = Number(space);
  1480. } else if (space instanceof String) {
  1481. space = String(space);
  1482. }
  1483. if (typeof space === 'number') {
  1484. if (space > 0) {
  1485. space = Math.min(10, Math.floor(space));
  1486. gap = ' '.substr(0, space);
  1487. }
  1488. } else if (typeof space === 'string') {
  1489. gap = space.substr(0, 10);
  1490. }
  1491. return serializeProperty('', {'': value})
  1492. function serializeProperty (key, holder) {
  1493. var value = holder[key];
  1494. if (value != null) {
  1495. if (typeof value.toJSON5 === 'function') {
  1496. value = value.toJSON5(key);
  1497. } else if (typeof value.toJSON === 'function') {
  1498. value = value.toJSON(key);
  1499. }
  1500. }
  1501. if (replacerFunc) {
  1502. value = replacerFunc.call(holder, key, value);
  1503. }
  1504. if (value instanceof Number) {
  1505. value = Number(value);
  1506. } else if (value instanceof String) {
  1507. value = String(value);
  1508. } else if (value instanceof Boolean) {
  1509. value = value.valueOf();
  1510. }
  1511. switch (value) {
  1512. case null: return 'null'
  1513. case true: return 'true'
  1514. case false: return 'false'
  1515. }
  1516. if (typeof value === 'string') {
  1517. return quoteString(value)
  1518. }
  1519. if (typeof value === 'number') {
  1520. return String(value)
  1521. }
  1522. if (typeof value === 'object') {
  1523. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1524. }
  1525. return undefined
  1526. }
  1527. function quoteString (value) {
  1528. var quotes = {
  1529. "'": 0.1,
  1530. '"': 0.2,
  1531. };
  1532. var replacements = {
  1533. "'": "\\'",
  1534. '"': '\\"',
  1535. '\\': '\\\\',
  1536. '\b': '\\b',
  1537. '\f': '\\f',
  1538. '\n': '\\n',
  1539. '\r': '\\r',
  1540. '\t': '\\t',
  1541. '\v': '\\v',
  1542. '\0': '\\0',
  1543. '\u2028': '\\u2028',
  1544. '\u2029': '\\u2029',
  1545. };
  1546. var product = '';
  1547. for (var i = 0; i < value.length; i++) {
  1548. var c = value[i];
  1549. switch (c) {
  1550. case "'":
  1551. case '"':
  1552. quotes[c]++;
  1553. product += c;
  1554. continue
  1555. case '\0':
  1556. if (util.isDigit(value[i + 1])) {
  1557. product += '\\x00';
  1558. continue
  1559. }
  1560. }
  1561. if (replacements[c]) {
  1562. product += replacements[c];
  1563. continue
  1564. }
  1565. if (c < ' ') {
  1566. var hexString = c.charCodeAt(0).toString(16);
  1567. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1568. continue
  1569. }
  1570. product += c;
  1571. }
  1572. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1573. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1574. return quoteChar + product + quoteChar
  1575. }
  1576. function serializeObject (value) {
  1577. if (stack.indexOf(value) >= 0) {
  1578. throw TypeError('Converting circular structure to JSON5')
  1579. }
  1580. stack.push(value);
  1581. var stepback = indent;
  1582. indent = indent + gap;
  1583. var keys = propertyList || Object.keys(value);
  1584. var partial = [];
  1585. for (var i = 0, list = keys; i < list.length; i += 1) {
  1586. var key = list[i];
  1587. var propertyString = serializeProperty(key, value);
  1588. if (propertyString !== undefined) {
  1589. var member = serializeKey(key) + ':';
  1590. if (gap !== '') {
  1591. member += ' ';
  1592. }
  1593. member += propertyString;
  1594. partial.push(member);
  1595. }
  1596. }
  1597. var final;
  1598. if (partial.length === 0) {
  1599. final = '{}';
  1600. } else {
  1601. var properties;
  1602. if (gap === '') {
  1603. properties = partial.join(',');
  1604. final = '{' + properties + '}';
  1605. } else {
  1606. var separator = ',\n' + indent;
  1607. properties = partial.join(separator);
  1608. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1609. }
  1610. }
  1611. stack.pop();
  1612. indent = stepback;
  1613. return final
  1614. }
  1615. function serializeKey (key) {
  1616. if (key.length === 0) {
  1617. return quoteString(key)
  1618. }
  1619. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1620. if (!util.isIdStartChar(firstChar)) {
  1621. return quoteString(key)
  1622. }
  1623. for (var i = firstChar.length; i < key.length; i++) {
  1624. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1625. return quoteString(key)
  1626. }
  1627. }
  1628. return key
  1629. }
  1630. function serializeArray (value) {
  1631. if (stack.indexOf(value) >= 0) {
  1632. throw TypeError('Converting circular structure to JSON5')
  1633. }
  1634. stack.push(value);
  1635. var stepback = indent;
  1636. indent = indent + gap;
  1637. var partial = [];
  1638. for (var i = 0; i < value.length; i++) {
  1639. var propertyString = serializeProperty(String(i), value);
  1640. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1641. }
  1642. var final;
  1643. if (partial.length === 0) {
  1644. final = '[]';
  1645. } else {
  1646. if (gap === '') {
  1647. var properties = partial.join(',');
  1648. final = '[' + properties + ']';
  1649. } else {
  1650. var separator = ',\n' + indent;
  1651. var properties$1 = partial.join(separator);
  1652. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1653. }
  1654. }
  1655. stack.pop();
  1656. indent = stepback;
  1657. return final
  1658. }
  1659. };
  1660. var JSON5 = {
  1661. parse: parse,
  1662. stringify: stringify,
  1663. };
  1664. var lib = JSON5;
  1665. var es5 = lib;
  1666. return es5;
  1667. })));
  1668. });
  1669. /*! *****************************************************************************
  1670. Copyright (c) Microsoft Corporation.
  1671. Permission to use, copy, modify, and/or distribute this software for any
  1672. purpose with or without fee is hereby granted.
  1673. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1674. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1675. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1676. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1677. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1678. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1679. PERFORMANCE OF THIS SOFTWARE.
  1680. ***************************************************************************** */
  1681. /* global Reflect, Promise */
  1682. var extendStatics = function(d, b) {
  1683. extendStatics = Object.setPrototypeOf ||
  1684. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1685. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1686. return extendStatics(d, b);
  1687. };
  1688. function __extends(d, b) {
  1689. extendStatics(d, b);
  1690. function __() { this.constructor = d; }
  1691. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1692. }
  1693. var __assign = function() {
  1694. __assign = Object.assign || function __assign(t) {
  1695. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1696. s = arguments[i];
  1697. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1698. }
  1699. return t;
  1700. };
  1701. return __assign.apply(this, arguments);
  1702. };
  1703. function __decorate(decorators, target, key, desc) {
  1704. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1705. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1706. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  1707. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1708. }
  1709. function __param(paramIndex, decorator) {
  1710. return function (target, key) { decorator(target, key, paramIndex); }
  1711. }
  1712. function __metadata(metadataKey, metadataValue) {
  1713. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1714. }
  1715. function __values(o) {
  1716. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1717. if (m) return m.call(o);
  1718. if (o && typeof o.length === "number") return {
  1719. next: function () {
  1720. if (o && i >= o.length) o = void 0;
  1721. return { value: o && o[i++], done: !o };
  1722. }
  1723. };
  1724. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1725. }
  1726. function __read(o, n) {
  1727. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1728. if (!m) return o;
  1729. var i = m.call(o), r, ar = [], e;
  1730. try {
  1731. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1732. }
  1733. catch (error) { e = { error: error }; }
  1734. finally {
  1735. try {
  1736. if (r && !r.done && (m = i["return"])) m.call(i);
  1737. }
  1738. finally { if (e) throw e.error; }
  1739. }
  1740. return ar;
  1741. }
  1742. function __spread() {
  1743. for (var ar = [], i = 0; i < arguments.length; i++)
  1744. ar = ar.concat(__read(arguments[i]));
  1745. return ar;
  1746. }
  1747. var PropertyDescription = /** @class */ (function () {
  1748. function PropertyDescription() {
  1749. var _this = this;
  1750. var args = [];
  1751. for (var _i = 0; _i < arguments.length; _i++) {
  1752. args[_i] = arguments[_i];
  1753. }
  1754. this.propertyes = {
  1755. props: [],
  1756. events: []
  1757. };
  1758. _$2.each(args, function (arg) {
  1759. _this.merge(arg);
  1760. });
  1761. }
  1762. PropertyDescription.prototype.merge = function (pd) {
  1763. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1764. if (pd.events) {
  1765. if (this.propertyes.events) {
  1766. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1767. }
  1768. else {
  1769. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1770. }
  1771. }
  1772. };
  1773. /**
  1774. * 根据分组名 获取属性定义
  1775. */
  1776. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1777. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1778. };
  1779. /**
  1780. * 获取全部事件
  1781. */
  1782. PropertyDescription.prototype.getEvents = function () {
  1783. return this.propertyes.events;
  1784. };
  1785. return PropertyDescription;
  1786. }());
  1787. //# sourceMappingURL=PropertyDescription.js.map
  1788. var PropertyDescriptionTable = new Map();
  1789. var width = {
  1790. name: 'width',
  1791. default: '',
  1792. group: 'common',
  1793. desc: '宽',
  1794. type: 'string'
  1795. };
  1796. var height = {
  1797. name: 'height',
  1798. default: '',
  1799. group: 'common',
  1800. desc: '高',
  1801. type: 'string'
  1802. };
  1803. var fieldLabel = {
  1804. name: 'fieldLabel',
  1805. default: '',
  1806. group: 'common',
  1807. desc: '文本描述',
  1808. type: 'string',
  1809. expr: true,
  1810. };
  1811. var text$1 = {
  1812. name: 'text',
  1813. default: '',
  1814. group: 'common',
  1815. desc: '文本描述',
  1816. type: 'string',
  1817. expr: true,
  1818. };
  1819. var iconCls = {
  1820. name: 'iconCls',
  1821. default: '',
  1822. group: 'common',
  1823. desc: '图标',
  1824. type: 'string',
  1825. expr: true,
  1826. };
  1827. var disabled = {
  1828. name: 'disabled',
  1829. default: false,
  1830. group: 'common',
  1831. desc: '禁用',
  1832. type: 'boolean',
  1833. expr: true,
  1834. };
  1835. var value = {
  1836. name: 'value',
  1837. default: '',
  1838. group: 'common',
  1839. desc: '字段值',
  1840. type: 'string',
  1841. expr: true,
  1842. };
  1843. var template = {
  1844. name: 'template',
  1845. default: '',
  1846. group: 'common',
  1847. desc: 'HTML内容',
  1848. type: 'string',
  1849. expr: true,
  1850. };
  1851. var reference = {
  1852. name: 'reference',
  1853. default: '',
  1854. group: 'common',
  1855. desc: '组件句柄',
  1856. type: 'string',
  1857. expr: true,
  1858. };
  1859. var tooltip = {
  1860. name: 'tooltip',
  1861. default: '',
  1862. group: 'common',
  1863. desc: '悬停提示',
  1864. type: 'string'
  1865. };
  1866. // =============事件 ==============
  1867. var click = {
  1868. name: 'click',
  1869. default: '',
  1870. group: 'listeners',
  1871. desc: '点击事件',
  1872. eventParamter: [
  1873. 'sender',
  1874. 'e: any'
  1875. ],
  1876. type: 'listeners'
  1877. };
  1878. var change = {
  1879. name: 'change',
  1880. default: '',
  1881. group: 'listeners',
  1882. desc: 'value change事件',
  1883. eventParamter: [
  1884. 'sender',
  1885. 'e: any'
  1886. ],
  1887. type: 'listeners'
  1888. };
  1889. var keyup = {
  1890. name: 'keyup',
  1891. default: '',
  1892. group: 'listeners',
  1893. desc: '键盘按键抬起事件',
  1894. eventParamter: [
  1895. 'sender',
  1896. 'e'
  1897. ],
  1898. type: 'listeners'
  1899. };
  1900. var afterrender = {
  1901. name: 'afterrender',
  1902. default: '',
  1903. group: 'listeners',
  1904. desc: '控件渲染后触发',
  1905. eventParamter: [
  1906. 'sender',
  1907. 'e'
  1908. ],
  1909. type: 'listeners'
  1910. };
  1911. // =============特性 ==============
  1912. var fix = {
  1913. name: 'fix',
  1914. default: '',
  1915. group: 'fix',
  1916. desc: '特性',
  1917. type: 'fix',
  1918. expr: true,
  1919. };
  1920. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1921. props: [
  1922. height
  1923. ]
  1924. }));
  1925. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1926. props: [
  1927. {
  1928. name: 'borderless',
  1929. default: true,
  1930. group: 'css',
  1931. desc: '有无边框',
  1932. type: 'boolean'
  1933. },
  1934. {
  1935. name: 'type',
  1936. default: '',
  1937. group: 'css',
  1938. desc: '布局类型',
  1939. type: ['line', 'clean', 'wide', 'space', 'form']
  1940. },
  1941. {
  1942. name: '_designMode',
  1943. default: 'module',
  1944. group: 'common',
  1945. desc: '设计类型',
  1946. type: ['none', 'module', 'scroll-module']
  1947. }
  1948. ]
  1949. }));
  1950. var YvBase = {
  1951. props: [
  1952. width, height, reference, afterrender, fix
  1953. ],
  1954. events: [
  1955. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1956. ]
  1957. };
  1958. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1959. props: [
  1960. template
  1961. ]
  1962. }));
  1963. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1964. props: [
  1965. {
  1966. name: 'label',
  1967. default: '',
  1968. group: 'common',
  1969. desc: '字段组标题',
  1970. type: 'string'
  1971. }
  1972. ]
  1973. }));
  1974. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1975. props: [
  1976. {
  1977. name: 'src',
  1978. default: '',
  1979. group: 'common',
  1980. desc: '地址路径',
  1981. type: 'string'
  1982. }
  1983. ]
  1984. }));
  1985. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1986. props: [
  1987. width, height,
  1988. {
  1989. name: 'value',
  1990. default: '上传',
  1991. group: 'common',
  1992. desc: '文本描述',
  1993. type: 'string'
  1994. },
  1995. {
  1996. name: 'upload',
  1997. default: '/upload',
  1998. group: 'common',
  1999. desc: '上传地址',
  2000. type: 'string'
  2001. },
  2002. ],
  2003. events: [
  2004. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2005. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2006. ]
  2007. }));
  2008. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2009. props: [
  2010. value,
  2011. {
  2012. name: 'imgWidth',
  2013. default: '',
  2014. group: 'common',
  2015. desc: '图片宽',
  2016. type: 'string'
  2017. },
  2018. {
  2019. name: 'imgHeight',
  2020. default: '',
  2021. group: 'common',
  2022. desc: '图片高',
  2023. type: 'string'
  2024. }
  2025. ]
  2026. }));
  2027. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2028. props: [
  2029. value,
  2030. {
  2031. name: 'imgWidth',
  2032. default: '',
  2033. group: 'common',
  2034. desc: '图片宽',
  2035. type: 'string'
  2036. },
  2037. {
  2038. name: 'imgHeight',
  2039. default: '',
  2040. group: 'common',
  2041. desc: '图片高',
  2042. type: 'string'
  2043. }
  2044. ]
  2045. }));
  2046. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2047. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2048. }));
  2049. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2050. props: [
  2051. fieldLabel, value, disabled,
  2052. tooltip, width, height
  2053. ],
  2054. }));
  2055. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2056. props: [
  2057. fieldLabel, value, disabled,
  2058. tooltip, width, height, keyup, afterrender, change
  2059. ],
  2060. }));
  2061. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2062. props: [
  2063. fieldLabel, value, disabled,
  2064. tooltip, width, height, keyup, afterrender, change
  2065. ],
  2066. }));
  2067. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2068. props: [
  2069. fieldLabel, value, disabled,
  2070. tooltip, width, height, keyup, afterrender, change
  2071. ],
  2072. }));
  2073. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2074. props: [
  2075. fieldLabel, value, disabled,
  2076. tooltip, width, height, keyup, afterrender, change
  2077. ],
  2078. }));
  2079. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2080. props: [
  2081. fieldLabel, value, disabled,
  2082. tooltip, width, height, keyup, afterrender, change
  2083. ],
  2084. }));
  2085. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2086. props: [
  2087. fieldLabel, value, disabled,
  2088. tooltip, width, height, keyup, afterrender, change
  2089. ],
  2090. }));
  2091. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2092. props: [
  2093. fieldLabel, value, disabled,
  2094. tooltip, width, height, keyup, afterrender, change
  2095. ],
  2096. }));
  2097. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2098. props: [
  2099. fieldLabel, value, disabled,
  2100. tooltip, width, height, keyup, afterrender, change
  2101. ],
  2102. }));
  2103. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2104. props: [
  2105. fieldLabel, value, disabled,
  2106. tooltip, width, height
  2107. ],
  2108. }));
  2109. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2110. props: [
  2111. fieldLabel, value, disabled,
  2112. tooltip, width, height, keyup, afterrender, change
  2113. ],
  2114. }));
  2115. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2116. props: [
  2117. fieldLabel, value, disabled,
  2118. tooltip, width, height, keyup, afterrender, change
  2119. ],
  2120. }));
  2121. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2122. props: [
  2123. fieldLabel, value, disabled,
  2124. tooltip, width, height, keyup, afterrender, change
  2125. ],
  2126. }));
  2127. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2128. props: [
  2129. fieldLabel, value, disabled,
  2130. tooltip, width, height, afterrender, change
  2131. ],
  2132. }));
  2133. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2134. /**
  2135. * 弹出输入框,输入文字
  2136. * @param message 提示文字
  2137. * @param defaultValue 默认值
  2138. * @param multiLine 是否多行输入
  2139. */
  2140. function prompt$1(message, defaultValue, multiLine) {
  2141. if (defaultValue === void 0) { defaultValue = ""; }
  2142. if (multiLine === void 0) { multiLine = false; }
  2143. return new Promise(function (resolve) {
  2144. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2145. if (button === 'ok') {
  2146. resolve(value);
  2147. }
  2148. }, null, multiLine, defaultValue);
  2149. });
  2150. }
  2151. /**
  2152. * 显示错误异常信息
  2153. * @param msg 错误内容
  2154. * @param sender 发送者按钮(可以为空)
  2155. */
  2156. function showErrorDialog(msg, sender) {
  2157. console.error(msg);
  2158. Ext.MessageBox.show({
  2159. title: '错误',
  2160. msg: msg,
  2161. buttons: Ext.MessageBox.OK,
  2162. animateTarget: sender,
  2163. icon: 'error',
  2164. cls: 'show-icon-messagebox',
  2165. });
  2166. }
  2167. /**
  2168. * 显示错误异常信息
  2169. * @param msg 错误内容
  2170. * @param sender 发送者按钮(可以为空)
  2171. */
  2172. function showInfoDialogSimple(msg, sender) {
  2173. console.info(msg);
  2174. Ext.MessageBox.show({
  2175. title: '提示',
  2176. msg: msg,
  2177. buttons: Ext.MessageBox.OK,
  2178. animateTarget: sender,
  2179. icon: 'info',
  2180. cls: 'show-icon-messagebox',
  2181. });
  2182. }
  2183. function msgError(msg, sender) {
  2184. showErrorDialog(msg, sender);
  2185. }
  2186. /**
  2187. * 中间灰底白字提示
  2188. */
  2189. function msg(message) {
  2190. console.log(message);
  2191. var t = { message: message };
  2192. var WMSTranslate = window["WMSTranslate"];
  2193. if (WMSTranslate) {
  2194. if (typeof window['viewTranslate'] === 'function') {
  2195. window['viewTranslate'](t, message, "message");
  2196. }
  2197. }
  2198. var $body = $$2('body');
  2199. $body.find('[xtype=tooltip]').remove();
  2200. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2201. ' <div class="yvan-msg-content">' +
  2202. _$2.escape(t.message) +
  2203. '</div></div>');
  2204. $body.append($w);
  2205. var iframeWidth = $w.parent().width();
  2206. var iframeHeight = $w.parent().height();
  2207. var windowWidth = $w.width();
  2208. var windowHeight = $w.height();
  2209. var setWidth = (iframeWidth - windowWidth) / 2;
  2210. var setHeight = (iframeHeight - windowHeight) / 2;
  2211. if (iframeHeight < windowHeight || setHeight < 0) {
  2212. setHeight = 0;
  2213. }
  2214. if (iframeWidth < windowWidth || setWidth < 0) {
  2215. setWidth = 0;
  2216. }
  2217. $w.css({ left: setWidth, top: setHeight });
  2218. setTimeout(function () {
  2219. $w.remove();
  2220. }, 3000);
  2221. }
  2222. //# sourceMappingURL=message.js.map
  2223. localforage.config({
  2224. name: "studio",
  2225. storeName: "item",
  2226. });
  2227. function getItem(key, callback) {
  2228. localforage.getItem(key).then(function (value) {
  2229. if (callback) {
  2230. callback(value);
  2231. }
  2232. });
  2233. }
  2234. function setItem(key, value, callback) {
  2235. localforage.setItem(key, value).then(function (val) {
  2236. if (callback) {
  2237. callback();
  2238. }
  2239. });
  2240. }
  2241. var native = {
  2242. /**
  2243. * 读取文件
  2244. */
  2245. loadFile: function (fileName, callback) {
  2246. console.log('loadFile', fileName);
  2247. getItem('NATIVE_' + fileName, callback);
  2248. },
  2249. /**
  2250. * 保存文件
  2251. */
  2252. saveFile: function (fileName, content) {
  2253. console.log('saveFile', fileName, content);
  2254. setItem('NATIVE_' + fileName, content);
  2255. },
  2256. openInIdea: function (path) {
  2257. msg(path);
  2258. },
  2259. /**
  2260. * 初始化 native 工具类
  2261. */
  2262. init: function () {
  2263. var ClipboardJS = window['ClipboardJS'];
  2264. if (!ClipboardJS) {
  2265. msg('没有引入 ClipboardJS');
  2266. return;
  2267. }
  2268. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2269. var clipboard = new ClipboardJS('.__btnClipboard');
  2270. },
  2271. /**
  2272. * 设置剪切板
  2273. */
  2274. clipboardSet: function (c) {
  2275. var $btn = $('.__btnClipboard');
  2276. $btn.attr('data-clipboard-text', c);
  2277. $btn.trigger("click");
  2278. },
  2279. };
  2280. /**
  2281. * 判断变量是否有值 value === null || value === undefined
  2282. * @param value 目标变量
  2283. */
  2284. var noValue = function (value) {
  2285. return value === null || value === undefined;
  2286. };
  2287. //# sourceMappingURL=Utils.js.map
  2288. function initStateTree () {
  2289. Ext.define('com.yvan.studio.StateTree', {
  2290. extend: 'Ext.tree.Panel',
  2291. _saveStateFlag: true,
  2292. _filterText: '',
  2293. fbar: [
  2294. {
  2295. xtype: 'textfield',
  2296. flex: 1,
  2297. emptyText: '搜索过滤',
  2298. enableKeyEvents: true,
  2299. listeners: {
  2300. change: function (sender) {
  2301. var tree = sender.up("treepanel");
  2302. tree.filterByText(this.getRawValue());
  2303. },
  2304. keyup: function (sender, e) {
  2305. var tree = sender.up("treepanel");
  2306. if (e.ESC === e.getKey()) {
  2307. sender.setValue('');
  2308. tree.filterByText('');
  2309. }
  2310. }
  2311. }
  2312. },
  2313. ],
  2314. getStateFilename: function () {
  2315. throw Error('没有实现这个函数');
  2316. },
  2317. initComponent: function () {
  2318. var me = this;
  2319. this.on({
  2320. afterrender: function () {
  2321. var _this = this;
  2322. // 回车后打开节点
  2323. $(me.el.dom).keydown(function (event) {
  2324. if (event.keyCode === 13) {
  2325. event.preventDefault();
  2326. _this.fireEvent('itemverify');
  2327. return;
  2328. }
  2329. });
  2330. },
  2331. afteritemexpand: {
  2332. fn: function (node, index, item, eOpts) {
  2333. this.saveState();
  2334. },
  2335. buffer: 100,
  2336. },
  2337. afteritemcollapse: {
  2338. fn: function (node, index, item, eOpts) {
  2339. this.saveState();
  2340. },
  2341. buffer: 100,
  2342. },
  2343. itemdblclick: function (sender, record) {
  2344. this.fireEvent('itemverify');
  2345. },
  2346. itemclick: {
  2347. fn: function (node, index, item, eOpts) {
  2348. this.saveState();
  2349. },
  2350. buffer: 100,
  2351. }
  2352. });
  2353. this.superclass.superclass.initComponent.apply(this, arguments);
  2354. },
  2355. restoreState: function () {
  2356. var _this = this;
  2357. native.loadFile(this.getStateFilename(), function (content) {
  2358. if (!content)
  2359. return;
  2360. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2361. _this._saveStateFlag = false;
  2362. if (_.isArray(expands)) {
  2363. _.forEach(expands, function (p) {
  2364. _this.expandPath(p);
  2365. });
  2366. }
  2367. if (_.isArray(selections) && selections[0]) {
  2368. try {
  2369. _this.selectPath(selections[0]);
  2370. }
  2371. catch (e) {
  2372. }
  2373. }
  2374. if (scrollPosition && scrollSize) {
  2375. var size = _this.scrollable.getSize();
  2376. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2377. try {
  2378. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2379. }
  2380. catch (e) {
  2381. }
  2382. }
  2383. }
  2384. setTimeout(function () {
  2385. _this._saveStateFlag = true;
  2386. }, 200);
  2387. });
  2388. },
  2389. saveState: function () {
  2390. if (!this._saveStateFlag) {
  2391. return;
  2392. }
  2393. if (this._filterText) {
  2394. // 有筛选,不保存展开状态
  2395. return;
  2396. }
  2397. var expands = [];
  2398. var selections = [];
  2399. var selection = this.getSelection();
  2400. _.forEach(selection, function (item) {
  2401. selections.push(item.getPath());
  2402. });
  2403. var data = this.getStore().data;
  2404. _.forEach(data.items, function (item) {
  2405. if (item.data.expanded === true) {
  2406. expands.push(item.getPath());
  2407. }
  2408. });
  2409. var scrollPosition = this.scrollable.position;
  2410. var scrollSize = this.scrollable.getSize();
  2411. native.saveFile(this.getStateFilename(), {
  2412. selections: selections,
  2413. expands: expands,
  2414. scrollPosition: scrollPosition,
  2415. scrollSize: scrollSize
  2416. });
  2417. },
  2418. filterByText: function (text) {
  2419. this._filterText = text;
  2420. this._filterBy(this, text, 'text');
  2421. },
  2422. _filterBy: _.debounce(function (me, text, by) {
  2423. var view = me.getView();
  2424. me.store.clearFilter();
  2425. if (!me._filterText) {
  2426. // 没有筛选内容,还原状态
  2427. var selections = me.getSelection();
  2428. var selectionPaths_1 = [];
  2429. _.forEach(me.getSelection(), function (item) {
  2430. selectionPaths_1.push(item.getPath());
  2431. });
  2432. me.collapseAll();
  2433. me.restoreState();
  2434. _.forEach(selectionPaths_1, function (path) {
  2435. me.expandPath(path);
  2436. });
  2437. me.setSelection(selections);
  2438. return;
  2439. }
  2440. // 递归查找所有需要可见的节点 id 数组
  2441. var nodesAndParents = [];
  2442. var expandPaths = [];
  2443. me.getRootNode().cascadeBy(function (tree, view) {
  2444. var currNode = this;
  2445. currNode.collapse();
  2446. if (currNode && currNode.data[by] &&
  2447. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2448. // 展开到匹配的路径
  2449. // me.expandPath(currNode.getPath());
  2450. expandPaths.push(currNode.getPath());
  2451. // 沿途父节点全部设定为可见
  2452. while (currNode.parentNode) {
  2453. nodesAndParents.push(currNode.id);
  2454. currNode = currNode.parentNode;
  2455. }
  2456. }
  2457. }, null, [me, view]);
  2458. me.store.filterBy(function (r) {
  2459. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2460. });
  2461. _.forEach(expandPaths, function (path) {
  2462. me.expandPath(path);
  2463. });
  2464. }, 1000),
  2465. });
  2466. }
  2467. //# sourceMappingURL=StateTree.js.map
  2468. function initDashboard () {
  2469. Ext.define('com.yvan.studio.Dashboard', {
  2470. extend: 'Ext.panel.Panel',
  2471. alias: 'widget.dashboard',
  2472. xtype: 'dashboard',
  2473. html: ''
  2474. });
  2475. }
  2476. //# sourceMappingURL=dashboard.js.map
  2477. var handles$1 = {
  2478. mainWindow: undefined,
  2479. fileTree: undefined,
  2480. dbTree: undefined,
  2481. viewoutlinetree: undefined,
  2482. statusbar: undefined,
  2483. dictTree: undefined,
  2484. property: undefined,
  2485. dbcode: undefined,
  2486. report: undefined,
  2487. widget: undefined,
  2488. whLayout: undefined,
  2489. };
  2490. window['handles'] = handles$1;
  2491. function setDictTree(value) {
  2492. handles$1.dictTree = value;
  2493. }
  2494. function setMainWindow(value) {
  2495. handles$1.mainWindow = value;
  2496. }
  2497. function setReport(value) {
  2498. handles$1.report = value;
  2499. }
  2500. function setStatusbar(statusbar) {
  2501. handles$1.statusbar = statusbar;
  2502. }
  2503. function setFileTree(value) {
  2504. handles$1.fileTree = value;
  2505. }
  2506. function setDbTree(value) {
  2507. handles$1.dbTree = value;
  2508. }
  2509. function setWidget(value) {
  2510. handles$1.widget = value;
  2511. }
  2512. function setWhLayout(value) {
  2513. handles$1.whLayout = value;
  2514. }
  2515. function setViewoutlinetree(value) {
  2516. handles$1.viewoutlinetree = value;
  2517. }
  2518. function setPropertyPanel(value) {
  2519. handles$1.property = value;
  2520. }
  2521. function setDbCode(value) {
  2522. handles$1.dbcode = value;
  2523. }
  2524. //# sourceMappingURL=Handles.js.map
  2525. /**
  2526. * 调用方法
  2527. */
  2528. function invokeMethod(fn, sender, args) {
  2529. if (typeof fn === 'function') {
  2530. fn.apply.apply(fn, __spread([sender], args));
  2531. }
  2532. }
  2533. /**
  2534. * 判断事件是否为有效的输入字符
  2535. * @param e
  2536. */
  2537. function isChartEvent(e) {
  2538. if (e.key === 'Shift' ||
  2539. e.key === 'Control' ||
  2540. e.key === 'Alt' ||
  2541. e.key === 'Escape' ||
  2542. e.key === 'ArrowRight' ||
  2543. e.key === 'Tab' ||
  2544. e.key === 'ArrowLeft') {
  2545. return false;
  2546. }
  2547. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2548. // 0-9
  2549. return true;
  2550. }
  2551. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2552. // a-z
  2553. return true;
  2554. }
  2555. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2556. // 小键盘 0-9
  2557. return true;
  2558. }
  2559. return false;
  2560. }
  2561. if (!window["time_offset"]) {
  2562. window["time_offset"] = 0;
  2563. }
  2564. function syncDate(date) {
  2565. if (date && date.setTime && date.getTime) {
  2566. date.setTime(date.getTime() + window["time_offset"]);
  2567. }
  2568. return date;
  2569. }
  2570. //# sourceMappingURL=utils.js.map
  2571. function isDesignMode(control, config) {
  2572. var _a, _b;
  2573. if (window["IS_DESIGN_MODE"]) {
  2574. return true;
  2575. }
  2576. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2577. return true;
  2578. }
  2579. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2580. return true;
  2581. }
  2582. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2583. return true;
  2584. }
  2585. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2586. return true;
  2587. }
  2588. return false;
  2589. }
  2590. function toString(value) {
  2591. if (typeof value === 'undefined' || value === null) {
  2592. return "";
  2593. }
  2594. if (typeof value === 'number' && isNaN(value)) {
  2595. return "";
  2596. }
  2597. if (value == 'N/A') {
  2598. return "";
  2599. }
  2600. return ("" + value);
  2601. }
  2602. function isEmpty(value) {
  2603. if (typeof value === 'undefined' || value === null) {
  2604. return true;
  2605. }
  2606. if (typeof value === 'number' && isNaN(value)) {
  2607. return true;
  2608. }
  2609. if (value == 'N/A') {
  2610. return true;
  2611. }
  2612. return ("" + value).trim().length <= 0;
  2613. }
  2614. function createUUID() {
  2615. //@ts-ignore
  2616. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2617. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2618. });
  2619. }
  2620. function getRegList() {
  2621. var regList = _$2.get(window, 'yvanLib.regList');
  2622. if (!regList) {
  2623. regList = [];
  2624. _$2.set(window, 'yvanLib.regList', regList);
  2625. }
  2626. return regList;
  2627. }
  2628. function getRegParamList(methodName) {
  2629. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2630. if (!regParamList) {
  2631. regParamList = {};
  2632. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2633. }
  2634. if (!_$2.has(regParamList, methodName)) {
  2635. regParamList[methodName] = [];
  2636. }
  2637. return regParamList[methodName];
  2638. }
  2639. /**
  2640. * 模拟点击按钮
  2641. */
  2642. function raiseClick(buttonHandle) {
  2643. if (!buttonHandle) {
  2644. return false;
  2645. }
  2646. if (buttonHandle.disabled) {
  2647. // 按钮是禁止状态
  2648. return false;
  2649. }
  2650. if (buttonHandle.hidden) {
  2651. // 按钮是隐藏状态
  2652. return false;
  2653. }
  2654. // 按钮点击
  2655. buttonHandle.click();
  2656. return true;
  2657. }
  2658. /**
  2659. * 标注系统全局函数的参数
  2660. * @param title 函数名称
  2661. * @param type 函数类型
  2662. * @param allowEmpty 可否为空
  2663. */
  2664. function LibParam(title, type, allowEmpty) {
  2665. if (allowEmpty === void 0) { allowEmpty = false; }
  2666. return function (target, methodName, paramsIndex) {
  2667. var systemFnArgs = getRegParamList(methodName);
  2668. systemFnArgs[paramsIndex] = {
  2669. type: type,
  2670. title: title,
  2671. name: methodName,
  2672. allowEmpty: allowEmpty,
  2673. };
  2674. };
  2675. }
  2676. /**
  2677. * 标注函数变成"系统全局函数"
  2678. */
  2679. function Lib(registe) {
  2680. return function (target, propertyKey, descriptor) {
  2681. var libList = getRegList();
  2682. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2683. if (registe.type === 'system') {
  2684. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2685. }
  2686. else if (registe.type === 'format') {
  2687. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2688. }
  2689. return target;
  2690. };
  2691. }
  2692. /**
  2693. * 解析事件
  2694. * 'scope.私有方法名'
  2695. * 'system.系统函数名'
  2696. * 'format.格式化名'
  2697. */
  2698. function lookupFn(scope, event, errorWho) {
  2699. if (isDesignMode(scope, undefined)) {
  2700. return Ext.emptyFn;
  2701. }
  2702. if (!_$2.startsWith(event, 'scope.') &&
  2703. !_$2.startsWith(event, 'system.') &&
  2704. !_$2.startsWith(event, 'format.')) {
  2705. console.error('无法识别的事件响应类型', event);
  2706. throw new TypeError('无法识别的事件响应类型');
  2707. }
  2708. // 为 eval 准备环境
  2709. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2710. var data = scope.viewModel.data;
  2711. var keys = [];
  2712. var values = [];
  2713. _$2.forOwn(data, function (value, key) {
  2714. var idxKey = key.indexOf('//');
  2715. if (idxKey >= 0) {
  2716. keys.push(key.substr(0, idxKey));
  2717. }
  2718. else {
  2719. keys.push(key);
  2720. }
  2721. values.push(value);
  2722. });
  2723. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2724. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2725. if (typeof funcResult !== 'function') {
  2726. console.error('无法识别的事件响应类型', event, func, errorWho);
  2727. throw new TypeError('无法识别的事件响应类型');
  2728. }
  2729. return funcResult;
  2730. }
  2731. /**
  2732. * 从 ext.element 获取 scope 对象
  2733. */
  2734. function lookupScope(extHandle) {
  2735. if (!extHandle) {
  2736. // @ts-ignore
  2737. return;
  2738. }
  2739. if (extHandle.isScope) {
  2740. return extHandle;
  2741. }
  2742. if (extHandle.column) {
  2743. // 列上的组件
  2744. return extHandle.column.lookupReferenceHolder().yvanScope;
  2745. }
  2746. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2747. if (typeof extHandle.lookupViewModel === 'function') {
  2748. var vm = extHandle.lookupViewModel();
  2749. return vm.yvanScope;
  2750. }
  2751. return;
  2752. }
  2753. //# sourceMappingURL=lib.js.map
  2754. /**
  2755. * 全局 ajax 方法
  2756. */
  2757. var ajax = {};
  2758. /**
  2759. * 计算拼音的函数
  2760. */
  2761. var pinyinFunc = function (str) { return (str); };
  2762. exports.scopeOnLoad = null;
  2763. exports.apiConvert = undefined;
  2764. var baseConfigProcessList = [];
  2765. /**
  2766. * 在基类添加 Config 的处理方法
  2767. */
  2768. function baseConfigProcess(option) {
  2769. return function (target, propertyKey) {
  2770. baseConfigProcessList.push(target[propertyKey]);
  2771. };
  2772. }
  2773. // let designMode: boolean = false
  2774. //
  2775. // export function isDesignMode(): boolean {
  2776. // return designMode
  2777. // }
  2778. //
  2779. // export function setDesignMode(v: boolean) {
  2780. // designMode = v
  2781. // }
  2782. /**
  2783. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2784. */
  2785. function serverInvokeUrlTransform(url, option) {
  2786. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2787. }
  2788. /**
  2789. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2790. */
  2791. function sqlUrlTransform(url) {
  2792. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2793. }
  2794. /**
  2795. * YvanUI 全局扩展配置
  2796. */
  2797. function extend(option) {
  2798. if (option.ajax) {
  2799. ajax.func = option.ajax;
  2800. }
  2801. if (option.serverInvokeUrlTransform) {
  2802. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2803. }
  2804. if (option.sqlUrlTransform) {
  2805. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2806. }
  2807. if (option.pinyinFunction) {
  2808. pinyinFunc = option.pinyinFunction;
  2809. }
  2810. if (option.scopeOnLoad) {
  2811. exports.scopeOnLoad = option.scopeOnLoad;
  2812. }
  2813. if (option.scopeOnCreate) {
  2814. exports.scopeOnCreate = option.scopeOnCreate;
  2815. }
  2816. if (option.apiConvert) {
  2817. exports.apiConvert = option.apiConvert;
  2818. }
  2819. // if (typeof option.designMode !== 'undefined') {
  2820. // setDesignMode(option.designMode)
  2821. // }
  2822. }
  2823. function getApiConvert() {
  2824. return exports.apiConvert;
  2825. }
  2826. function getScopeOnCreate() {
  2827. return exports.scopeOnCreate;
  2828. }
  2829. function getPinyin(v) {
  2830. return pinyinFunc(v);
  2831. }
  2832. /**
  2833. * 适用于 Select / Tree 等,作筛选的通用方法.
  2834. * 1.首字母模糊匹配(不区分大小写)
  2835. * 2.标识的模糊匹配(不区分大小写)
  2836. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2837. */
  2838. function keywordFilter(keyword, label, value) {
  2839. if (!keyword) {
  2840. return true;
  2841. }
  2842. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2843. // const labelPy = _.toLower(getPinyin(label))
  2844. //@ts-ignore
  2845. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2846. value = _$2.toLower(_$2.trim(value));
  2847. var found = 0;
  2848. _$2.some(ws, function (word) {
  2849. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2850. found++;
  2851. return;
  2852. }
  2853. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2854. found++;
  2855. return;
  2856. }
  2857. });
  2858. return found >= ws.length;
  2859. }
  2860. //# sourceMappingURL=config.js.map
  2861. var idPrefix = "_ds_";
  2862. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  2863. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  2864. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  2865. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  2866. var layoutOrXtypeNameMap = {
  2867. fit: 'fit布局',
  2868. border: 'border布局',
  2869. center: '中部',
  2870. north: '上部',
  2871. south: '下部',
  2872. west: '左部',
  2873. east: '右部',
  2874. yvgrid: '表格',
  2875. tree: '树',
  2876. tabpanel: '标签页',
  2877. form: '表单',
  2878. fieldset: '字段组',
  2879. tbar: '顶部工具栏',
  2880. fbar: '底部工具栏',
  2881. toolbar: '工具栏',
  2882. cols: '列容器',
  2883. rows: '行容器',
  2884. textfield: '文本框',
  2885. textareafield: '长文本框',
  2886. numberfield: '数字框',
  2887. label: "文本",
  2888. combo: "下拉框",
  2889. combobox: "下拉框",
  2890. combotree: "下拉树",
  2891. combogrid: "下拉表",
  2892. datefield: "日期框",
  2893. searchfield: "搜索框",
  2894. button: "按钮",
  2895. checkbox: "勾选",
  2896. checkboxgroup: "勾选组",
  2897. radio: "点选",
  2898. radiogroup: "点选组",
  2899. container: "占位"
  2900. };
  2901. /**
  2902. * 从 VJSON 中找到 rows/cols 的数组
  2903. */
  2904. function findArrayContainer(vjson, id) {
  2905. var parentVJson = getSuperVjson(vjson, id);
  2906. if (_$2.isArray(parentVJson)) {
  2907. return parentVJson;
  2908. }
  2909. if (parentVJson.hasOwnProperty('items')) {
  2910. return parentVJson.items;
  2911. }
  2912. }
  2913. /**
  2914. * 根据id查找上级vjson
  2915. * @param vjson 原始 vjson 视图
  2916. * @param targetId 子元素的id
  2917. */
  2918. function getSuperVjson(vjson, targetId) {
  2919. return deepTravFindSuper(vjson, vjson, targetId);
  2920. }
  2921. /**
  2922. * 根据id查找上级vjson id
  2923. * @param vjson 原始 vjson 视图
  2924. * @param targetId 子元素的id
  2925. */
  2926. function getSuperVjsonId(vjson, targetId) {
  2927. var vj = getSuperVjson(vjson, targetId);
  2928. return vj.id;
  2929. }
  2930. function deepTravFindSuper(superVjson, vjson, targetId) {
  2931. var rObj = null;
  2932. _$2.forOwn(vjson, function (value, key) {
  2933. if (rObj) {
  2934. return;
  2935. }
  2936. if (typeof value !== "object") {
  2937. return;
  2938. }
  2939. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  2940. if (key !== 'items') {
  2941. return;
  2942. }
  2943. }
  2944. else {
  2945. // 模型、数据、数据源不扫描
  2946. if (key === 'data' ||
  2947. key === 'dataSource' ||
  2948. key === 'suggest' ||
  2949. key === 'options' ||
  2950. key === 'config' ||
  2951. key === 'columns' ||
  2952. key === 'viewModel' ||
  2953. key === 'store') {
  2954. return;
  2955. }
  2956. }
  2957. //事件不扫描
  2958. if (key === "on" && _$2.isObject(value)) {
  2959. return;
  2960. }
  2961. if (key.startsWith("on") && _$2.size(key) > 2) {
  2962. return;
  2963. }
  2964. if (value.id === targetId) {
  2965. if (_$2.isArray(vjson)) {
  2966. rObj = superVjson;
  2967. }
  2968. else {
  2969. rObj = vjson;
  2970. }
  2971. return;
  2972. }
  2973. rObj = deepTravFindSuper(vjson, value, targetId);
  2974. });
  2975. return rObj;
  2976. }
  2977. /**
  2978. * 深度遍历 vjson
  2979. * @param vjson 视图JSON
  2980. * @param resolver 分析函数
  2981. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  2982. */
  2983. function deepTravVJson(vjson, resolver, propDeep) {
  2984. if (propDeep === void 0) { propDeep = false; }
  2985. var markerList = [];
  2986. deepTrav1(vjson, resolver, markerList, propDeep);
  2987. return markerList;
  2988. }
  2989. function deepTrav1(obj, resolver, marker, propDeep) {
  2990. if (propDeep === void 0) { propDeep = false; }
  2991. var isMarker = resolver(obj);
  2992. if (marker && isMarker === true) {
  2993. marker.unshift({ id: 0, keyName: '', object: obj });
  2994. }
  2995. _$2.forOwn(obj, function (value, key) {
  2996. if (typeof value !== 'object') {
  2997. return;
  2998. }
  2999. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3000. if (key !== 'items' && key !== 'children') {
  3001. return;
  3002. }
  3003. }
  3004. else {
  3005. // 模型、数据、数据源不扫描
  3006. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3007. return;
  3008. }
  3009. if (!propDeep &&
  3010. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3011. key === 'listeners' || key === 'bind')) {
  3012. return;
  3013. }
  3014. }
  3015. //事件不扫描
  3016. if (key === 'on' && _$2.isObject(value)) {
  3017. return;
  3018. }
  3019. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3020. return;
  3021. }
  3022. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3023. if (marker && isMarkerChild === true) {
  3024. isMarker = true;
  3025. marker.unshift({ id: obj.id, keyName: key, object: value });
  3026. }
  3027. });
  3028. // @ts-ignore 删除作废对象
  3029. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3030. return isMarker;
  3031. }
  3032. /**
  3033. * 在代码中找到 reference 对应的对象
  3034. */
  3035. function findInCode(code, id) {
  3036. try {
  3037. deepTravVJson(code, function (child) {
  3038. if (child.id === id) {
  3039. throw child;
  3040. }
  3041. });
  3042. return undefined;
  3043. }
  3044. catch (err) {
  3045. return err;
  3046. }
  3047. }
  3048. function replaceVjsonById(vjson, itemVjson, itemId) {
  3049. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3050. msgError('无法定位组件!');
  3051. debugger;
  3052. return;
  3053. }
  3054. var id = itemId || itemVjson.id;
  3055. deepTravVJson(vjson, function (obj) {
  3056. if (obj.id == id) {
  3057. _$2.assign(obj, itemVjson, { id: id });
  3058. }
  3059. });
  3060. }
  3061. function deepTravDeleteVjson(obj, targetId) {
  3062. var isDelete = false;
  3063. _$2.forOwn(obj, function (value, key) {
  3064. if (isDelete) {
  3065. return;
  3066. }
  3067. if (typeof value !== 'object') {
  3068. return;
  3069. }
  3070. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3071. if (key !== 'items') {
  3072. return;
  3073. }
  3074. }
  3075. else {
  3076. // 模型、数据、数据源不扫描
  3077. if (key === 'data' ||
  3078. key === 'dataSource' ||
  3079. key === 'suggest' ||
  3080. key === 'options' ||
  3081. key === 'config' ||
  3082. key === 'columns' ||
  3083. key === 'viewModel' ||
  3084. key === 'store') {
  3085. return;
  3086. }
  3087. }
  3088. //事件不扫描
  3089. if (key === 'on' && _$2.isObject(value)) {
  3090. return;
  3091. }
  3092. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3093. return;
  3094. }
  3095. if (value.id === targetId) {
  3096. isDelete = true;
  3097. /** 如果是数组的元素*/
  3098. if (_$2.isArray(obj)) {
  3099. obj.splice(key, 1);
  3100. }
  3101. else {
  3102. delete obj[key];
  3103. }
  3104. return;
  3105. }
  3106. isDelete = deepTravDeleteVjson(value, targetId);
  3107. });
  3108. return isDelete;
  3109. }
  3110. /**
  3111. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3112. * @param obj 原始 vjson 视图
  3113. * @param targetId 子元素的id
  3114. */
  3115. function deletVjsonById(vjson, targetId) {
  3116. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3117. // if (_.isArray(obj)) {
  3118. // if (obj.length <= 0) {
  3119. // let T: any = {
  3120. // view: "template",
  3121. // template: "拖动任何组件到此处",
  3122. // role: "placeholder",
  3123. // id: webix.uid()
  3124. // }
  3125. // obj.push(T);
  3126. // }
  3127. // }
  3128. return isDeleted;
  3129. }
  3130. function removeDesignProp(vjson) {
  3131. deepTravVJson(vjson, function (obj) {
  3132. if (obj.hasOwnProperty('id')) {
  3133. delete obj.id;
  3134. }
  3135. if (obj.hasOwnProperty("designMode")) {
  3136. delete obj.designMode;
  3137. }
  3138. });
  3139. if (vjson.hasOwnProperty("cls")) {
  3140. delete vjson.cls;
  3141. }
  3142. if (vjson.hasOwnProperty("viewModel")) {
  3143. delete vjson.viewModel;
  3144. }
  3145. if (vjson.hasOwnProperty("store")) {
  3146. delete vjson.store;
  3147. }
  3148. }
  3149. function getLayoutOutline(vjson) {
  3150. deepTravVJson(vjson, function (obj) {
  3151. if (!Array.isArray(obj)) {
  3152. _$2.forOwn(obj, function (value, key) {
  3153. if (key === 'id' || key === 'region' || key === 'layoutName'
  3154. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3155. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3156. if (key === 'region'
  3157. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3158. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3159. if (!_$2.has(obj, 'layoutName')) {
  3160. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3161. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3162. // console.log(obj.layoutName, obj.layoutNameDesc)
  3163. }
  3164. }
  3165. }
  3166. else {
  3167. if (key === 'items') {
  3168. obj.children = obj[key];
  3169. }
  3170. if (key === 'tbar') {
  3171. var t = obj[key];
  3172. t.layoutName = key;
  3173. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3174. // console.log(t.layoutName, t.layoutNameDesc)
  3175. if (_$2.has(obj, "items")) {
  3176. obj.items.splice(0, 0, t);
  3177. }
  3178. else if (_$2.has(obj, "children")) {
  3179. obj.children.splice(0, 0, t);
  3180. }
  3181. else {
  3182. obj.children = [t];
  3183. }
  3184. }
  3185. if (key === 'fbar') {
  3186. var t = obj[key];
  3187. t.layoutName = key;
  3188. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3189. // console.log(t.layoutName, t.layoutNameDesc)
  3190. if (_$2.has(obj, "items")) {
  3191. obj.items.push(t);
  3192. }
  3193. else if (_$2.has(obj, "children")) {
  3194. obj.children.push(t);
  3195. }
  3196. else {
  3197. obj.children = [t];
  3198. }
  3199. }
  3200. delete obj[key];
  3201. }
  3202. });
  3203. if (!obj.hasOwnProperty("children")) {
  3204. obj.leaf = true;
  3205. }
  3206. if (!obj.hasOwnProperty("expanded")) {
  3207. obj.expanded = true;
  3208. }
  3209. }
  3210. });
  3211. return vjson;
  3212. }
  3213. //# sourceMappingURL=ViewHelper.js.map
  3214. var Scope = /** @class */ (function () {
  3215. function Scope(_a) {
  3216. var model = _a.model, vjson = _a.vjson, i18n = _a.i18n;
  3217. /**
  3218. * 业务模块的唯一编号
  3219. */
  3220. this.id = _$2.uniqueId('scope_');
  3221. this.IS_DESIGN_MODE = false;
  3222. /**
  3223. * onload 运行完成之后才会设置本标记为 true
  3224. */
  3225. this.isLoadFinish = false;
  3226. this._isLoading = false;
  3227. this.model = model;
  3228. if (typeof vjson.layout === 'undefined') {
  3229. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  3230. var ret = buildPlus({ model: model, vjson: vjson });
  3231. model = ret.model;
  3232. vjson = ret.vjson;
  3233. }
  3234. this.originalVjson = _$2.cloneDeep(vjson);
  3235. this.vjson = this.originalVjson; // this.buildVjson()
  3236. var WMSTranslate = window["WMSTranslate"];
  3237. if (WMSTranslate) {
  3238. var i18nPath_1 = this.constructor.name;
  3239. if (i18n) {
  3240. WMSTranslate[i18nPath_1] = i18n;
  3241. }
  3242. this.vjson.i18nPath = i18nPath_1;
  3243. deepTravVJson(this.vjson, function (obj) {
  3244. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  3245. return;
  3246. }
  3247. obj.i18nPath = i18nPath_1;
  3248. });
  3249. }
  3250. var extScope = getScopeOnCreate();
  3251. if (typeof extScope === 'function') {
  3252. extScope({ vjson: vjson, model: model }, this);
  3253. }
  3254. }
  3255. Scope.prototype._addWatch = function (tplExpress, fn) {
  3256. if (!this._watchList) {
  3257. this._watchList = [];
  3258. }
  3259. this._watchList.push({ watch: tplExpress, fn: fn });
  3260. };
  3261. Scope.prototype._applyWatchList = function () {
  3262. var _this = this;
  3263. _$2.forEach(this._watchList, function (item) {
  3264. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  3265. });
  3266. };
  3267. Object.defineProperty(Scope.prototype, "isScope", {
  3268. get: function () {
  3269. return true;
  3270. },
  3271. enumerable: true,
  3272. configurable: true
  3273. });
  3274. /**
  3275. * 产生一个当前模块有效的唯一id
  3276. * @param key 唯一编号
  3277. */
  3278. Scope.prototype.uid = function (key) {
  3279. return this.id + key;
  3280. };
  3281. /**
  3282. * 对话框"保存"成功.
  3283. * 关闭对话框,并响应 success 方法
  3284. * @param data 要傳回的數據(可以為空)
  3285. */
  3286. Scope.prototype.dialogSuccess = function (data) {
  3287. this._handle.fireEvent('success', this, data);
  3288. var sender = this._handle.config.animateTarget;
  3289. var scope = lookupScope(sender);
  3290. if (typeof this['success'] === 'function') {
  3291. this['success'].call(scope, sender, data);
  3292. }
  3293. this.close();
  3294. };
  3295. /**
  3296. * 设置等待状态
  3297. * @param value
  3298. * @param msg
  3299. */
  3300. Scope.prototype.setLoading = function (value) {
  3301. var _a;
  3302. var scope = this;
  3303. this._isLoading = value;
  3304. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  3305. };
  3306. Scope.prototype.getLoading = function () {
  3307. return this._isLoading;
  3308. };
  3309. /**
  3310. * 以对话框模式打开当前模块
  3311. * @param sender 发送者(按钮或Scope对象)
  3312. * @param vjsonOption 界面覆盖选项(可以为空)
  3313. * @param dataOption 数据覆盖选项(可以为空)
  3314. */
  3315. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  3316. var _a;
  3317. var that = this;
  3318. var vmodel = _$2.defaultsDeep({
  3319. //
  3320. }, dataOption, that.model);
  3321. this.viewModel = new Ext.app.ViewModel(vmodel);
  3322. this.viewModel.yvanScope = this;
  3323. this._applyWatchList();
  3324. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3325. var config = _$2.defaultsDeep({
  3326. animateTarget: sender,
  3327. viewModel: this.viewModel,
  3328. yvanScope: this,
  3329. referenceHolder: true,
  3330. }, vjsonOption, that.vjson, windows);
  3331. if (config.height === 'unset') {
  3332. delete config.height;
  3333. }
  3334. if (config.width === 'unset') {
  3335. delete config.width;
  3336. }
  3337. // const holder = sender?.lookupReferenceHolder()
  3338. // delete config.constrain
  3339. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  3340. if (topScope) {
  3341. config.constrain = true;
  3342. this.topScope = topScope;
  3343. }
  3344. var win = new Ext.Window(config);
  3345. // if (holder) {
  3346. // holder.add(win)
  3347. // }
  3348. if (topScope) {
  3349. topScope._handle.add(win);
  3350. }
  3351. win.addListener('beforerender', function (sender) {
  3352. // 记录句柄
  3353. if (sender && !that._handle) {
  3354. that._handle = sender;
  3355. }
  3356. });
  3357. win.addListener('afterrender', function (sender) {
  3358. // 调用onLoad回调
  3359. try {
  3360. that._onLoad();
  3361. }
  3362. catch (e) {
  3363. console.error('errorAt onLoad', e);
  3364. }
  3365. window['cw'] = that;
  3366. });
  3367. win.addListener('destroy', this._destroy.bind(this));
  3368. win.show();
  3369. };
  3370. /**
  3371. * 以标签模式打开当前模块
  3372. * @param vjsonOption 界面覆盖选项(可以为空)
  3373. * @param dataOption 数据覆盖选项(可以为空)
  3374. */
  3375. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3376. var _this = this;
  3377. var that = this;
  3378. this._vjsonOption = vjsonOption;
  3379. this._dataOption = dataOption;
  3380. var vmodel = _$2.defaultsDeep({
  3381. data: {}
  3382. }, dataOption, that.model);
  3383. this.viewModel = new Ext.app.ViewModel(vmodel);
  3384. this.viewModel.yvanScope = this;
  3385. this._applyWatchList();
  3386. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3387. // 根级不能设置id
  3388. delete that.vjson.id;
  3389. var config = _$2.defaultsDeep({
  3390. viewModel: this.viewModel,
  3391. yvanScope: this,
  3392. referenceHolder: true,
  3393. }, vjsonOption, that.vjson);
  3394. var tt = Ext.getCmp('TT');
  3395. var handle = tt.addScope(this, config, function (handle) {
  3396. handle.addListener('added', function (sender) {
  3397. // 记录句柄
  3398. if (sender && !that._handle) {
  3399. that._handle = sender;
  3400. }
  3401. });
  3402. handle.addListener('afterrender', function (sender) {
  3403. // 调用onLoad回调
  3404. try {
  3405. that._onLoad();
  3406. }
  3407. catch (e) {
  3408. console.error('errorAt onLoad', e);
  3409. }
  3410. });
  3411. handle.addListener('destroy', _this._destroy.bind(_this));
  3412. });
  3413. return handle;
  3414. };
  3415. /**
  3416. * 直接渲染到元素
  3417. * @param element 渲染目标
  3418. * @param vjsonOption 界面覆盖选项(可以为空)
  3419. * @param dataOption 数据覆盖选项(可以为空)
  3420. */
  3421. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3422. var that = this;
  3423. this._vjsonOption = vjsonOption;
  3424. this._dataOption = dataOption;
  3425. var vmodel = _$2.defaultsDeep({
  3426. data: {}
  3427. }, that.model, dataOption);
  3428. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3429. this.viewModel = new Ext.app.ViewModel(vmodel);
  3430. this.viewModel.yvanScope = this;
  3431. this._applyWatchList();
  3432. var config = _$2.defaultsDeep({
  3433. viewModel: this.viewModel,
  3434. yvanScope: this,
  3435. referenceHolder: true,
  3436. renderTo: element,
  3437. listeners: {
  3438. afterrender: function (sender) {
  3439. var _a;
  3440. // 记录句柄
  3441. if (sender && !that._handle) {
  3442. that._handle = sender;
  3443. }
  3444. // 调用onLoad回调
  3445. that._onLoad();
  3446. // 如果vjson中配置了 afterrender ,需要恢复状态
  3447. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3448. },
  3449. },
  3450. }, vjsonOption, that.vjson);
  3451. new Ext.container.Viewport(config);
  3452. };
  3453. Scope.prototype.showDesigner = function (designer, option) {
  3454. var that = this;
  3455. var vmodel = _$2.defaultsDeep({
  3456. data: {
  3457. IS_DESIGN_MODE: true,
  3458. }
  3459. }, that.model);
  3460. this.IS_DESIGN_MODE = true;
  3461. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3462. this.viewModel = new Ext.app.ViewModel(vmodel);
  3463. this.viewModel.yvanScope = this;
  3464. this._applyWatchList();
  3465. var config = _$2.defaultsDeep({
  3466. viewModel: this.viewModel,
  3467. yvanScope: this,
  3468. referenceHolder: true,
  3469. listeners: {
  3470. afterrender: function (sender) {
  3471. var _a;
  3472. // 记录句柄
  3473. if (sender && !that._handle) {
  3474. that._handle = sender;
  3475. }
  3476. // 调用onLoad回调
  3477. that._onLoad();
  3478. // 如果vjson中配置了 afterrender ,需要恢复状态
  3479. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3480. },
  3481. },
  3482. }, that.vjson);
  3483. designer.removeAll(true);
  3484. designer.add(config);
  3485. };
  3486. /**
  3487. * 关闭对话框(或标签页)
  3488. */
  3489. Scope.prototype.close = function () {
  3490. this._handle.close();
  3491. };
  3492. Object.defineProperty(Scope.prototype, "data", {
  3493. /**
  3494. * 获取 viewModel 里包含的数据(只读)
  3495. */
  3496. get: function () {
  3497. return this.viewModel.getData();
  3498. },
  3499. enumerable: true,
  3500. configurable: true
  3501. });
  3502. /**
  3503. * 设置 viewModel 中的数据
  3504. * 可以是 key, value 模式
  3505. * 也可以是 {key:value} 模式
  3506. */
  3507. Scope.prototype.set = function (path, value) {
  3508. return this.viewModel.set(path, value);
  3509. };
  3510. /**
  3511. * 寻找模块内所有的 xtype 对应的对象
  3512. * @param xtypeKey
  3513. */
  3514. Scope.prototype.down = function (xtypeKey) {
  3515. return this._handle.down(xtypeKey);
  3516. };
  3517. Object.defineProperty(Scope.prototype, "refs", {
  3518. /**
  3519. * 获取所有设置过 Reference 名称的组件
  3520. */
  3521. get: function () {
  3522. var _a, _b;
  3523. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3524. },
  3525. enumerable: true,
  3526. configurable: true
  3527. });
  3528. Scope.prototype._destroy = function () {
  3529. var that = this;
  3530. that.onDestroy();
  3531. delete that._watchList;
  3532. delete that._handle;
  3533. this.isLoadFinish = false;
  3534. };
  3535. /**
  3536. * 私有渲染完成后的回调
  3537. */
  3538. Scope.prototype._onLoad = function () {
  3539. var _this = this;
  3540. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3541. exports.scopeOnLoad(this);
  3542. }
  3543. this.onLoad();
  3544. _$2.defer(function () {
  3545. _this.isLoadFinish = true;
  3546. });
  3547. };
  3548. /**
  3549. * 默认 渲染完成之后调用的函数
  3550. */
  3551. Scope.prototype.onLoad = function () {
  3552. };
  3553. /**
  3554. * 组件卸载之后的回调
  3555. */
  3556. Scope.prototype.onDestroy = function () {
  3557. };
  3558. return Scope;
  3559. }());
  3560. /**
  3561. * 观察装饰器,viewModel 属性更改时触发成员方法
  3562. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3563. */
  3564. function watch(tplExpress, deep) {
  3565. if (deep === void 0) { deep = false; }
  3566. return function (target, propertyKey, pd) {
  3567. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3568. return target[propertyKey];
  3569. };
  3570. }
  3571. // 获取vjson的hash值
  3572. function getVjsonHash(str) {
  3573. var hash = 3465217896, i, ch;
  3574. for (i = str.length - 1; i >= 0; i--) {
  3575. ch = str.charCodeAt(i);
  3576. hash ^= ((hash << 5) + ch + (hash >> 2));
  3577. }
  3578. return (hash & 0x7FFFFFFF) + "";
  3579. }
  3580. function buildPlus(_a) {
  3581. var model = _a.model, vjson = _a.vjson;
  3582. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3583. {
  3584. layout: 'border',
  3585. // tbar: vjson.action,
  3586. items: vjson.items,
  3587. },
  3588. ] });
  3589. if (_$2.isArray(vjson.action)) {
  3590. vjsonNew.items[0].tbar = vjson.action;
  3591. }
  3592. return { model: model, vjson: vjsonNew };
  3593. }
  3594. //# sourceMappingURL=Scope.js.map
  3595. var model = {
  3596. data: {
  3597. leftTabTitle: ''
  3598. }
  3599. };
  3600. //# sourceMappingURL=Workbench.model.js.map
  3601. var vjson = {
  3602. frame: false,
  3603. layout: 'border',
  3604. width: '100%',
  3605. height: '100%',
  3606. border: false,
  3607. defaults: {
  3608. border: false
  3609. },
  3610. items: [
  3611. {
  3612. region: 'north',
  3613. height: 60,
  3614. cls: 'main-header',
  3615. reference: 'mainTop',
  3616. layout: 'hbox',
  3617. items: [
  3618. {
  3619. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3620. flex: 1,
  3621. border: false
  3622. },
  3623. {
  3624. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3625. menu: [
  3626. {
  3627. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3628. reference: 'commonSetting'
  3629. },
  3630. {
  3631. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3632. listeners: {
  3633. // click: 'scope.ready_api_click'
  3634. }
  3635. },
  3636. ]
  3637. },
  3638. {
  3639. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3640. cls: 'header-menu',
  3641. menu: [
  3642. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3643. ]
  3644. },
  3645. ]
  3646. },
  3647. {
  3648. region: 'west',
  3649. bind: {
  3650. title: '{leftTabTitle}',
  3651. },
  3652. titleAlign: 'center',
  3653. border: true, split: true, width: 340, collapsible: true,
  3654. reference: 'leftTab',
  3655. xtype: 'tabpanel',
  3656. tabPosition: 'left',
  3657. tabRotation: 0,
  3658. tabBar: {
  3659. border: false
  3660. },
  3661. listeners: {
  3662. tabchange: 'scope.leftTabChange',
  3663. },
  3664. items: [
  3665. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3666. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3667. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3668. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  3669. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3670. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3671. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3672. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3673. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3674. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3675. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3676. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3677. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3678. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3679. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3680. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3681. ]
  3682. },
  3683. {
  3684. region: 'east',
  3685. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3686. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3687. },
  3688. {
  3689. region: 'center',
  3690. split: true, border: true,
  3691. xtype: 'maintab', reference: 'tt', id: 'TT',
  3692. plain: true,
  3693. listeners: {
  3694. restorypage: 'scope.openScope',
  3695. tabchange: 'scope.tabchange'
  3696. },
  3697. items: []
  3698. },
  3699. ],
  3700. };
  3701. //# sourceMappingURL=Workbench.view.js.map
  3702. /**
  3703. * 获取当前打开的项目资料
  3704. */
  3705. function getCurrentProject() {
  3706. // const value = sessionStorage.getItem('CurrentProject');
  3707. // if (value) {
  3708. // project = JSON.parse(value)
  3709. // if (!project.url) {
  3710. // project = undefined
  3711. // }
  3712. // }
  3713. // return project
  3714. return {
  3715. uuid: '00000000',
  3716. name: '本服项目',
  3717. url: '',
  3718. };
  3719. }
  3720. /**
  3721. * 设置当前打开的项目资料(全局)
  3722. */
  3723. function setCurrentProject(value) {
  3724. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3725. }
  3726. //# sourceMappingURL=Project.js.map
  3727. // ------------------------------------------------------------------------------------------ types
  3728. /** 订阅消息key类型 */
  3729. var EventType;
  3730. (function (EventType) {
  3731. /** FileTree打开Module */
  3732. EventType["ModuleOpen"] = "ModuleOpen";
  3733. /** ModulePage 创建 */
  3734. EventType["ModulePageCreate"] = "ModulePageCreate";
  3735. /** ModuleItem内容变化 */
  3736. EventType["ModuleItemChange"] = "ModuleItemChange";
  3737. /** ModuleItem的 jsView 内容变化 */
  3738. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3739. /** 设置 vjson */
  3740. EventType["SetVjson"] = "SetVjson";
  3741. /** 更新 vjson */
  3742. EventType["UpdateVjson"] = "UpdateVjson";
  3743. /** 更新 组件vjson */
  3744. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3745. /** Component 选中内容变化 */
  3746. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3747. /** Component 选中内容变化 */
  3748. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3749. /** Component 删除事件 */
  3750. EventType["ComponentDelete"] = "ComponentDelete";
  3751. /** MainTab 选中改变事件 */
  3752. EventType["MainTabChange"] = "MainTabChange";
  3753. /** ModuleTab 选中改变事件 */
  3754. EventType["ModuleTabChange"] = "ModuleTabChange";
  3755. /** 保存事件 */
  3756. EventType["SaveCall"] = "SaveCall";
  3757. /** 撤销 */
  3758. EventType["Undo"] = "Undo";
  3759. /** 还原 */
  3760. EventType["Redo"] = "Redo";
  3761. /** 剪切 */
  3762. EventType["Cut"] = "Cut";
  3763. /** 复制 */
  3764. EventType["Copy"] = "Copy";
  3765. /** 粘贴 */
  3766. EventType["Paste"] = "Paste";
  3767. /** 全选 */
  3768. EventType["SelectAll"] = "SelectAll";
  3769. /** 读取剪切板 */
  3770. EventType["ClipboardRead"] = "ClipboardRead";
  3771. /** 检查模块更新 */
  3772. EventType["RunCheckModule"] = "RunCheckModule";
  3773. /** 停止检查模块更新 */
  3774. EventType["StopCheckModule"] = "StopCheckModule";
  3775. })(EventType || (EventType = {}));
  3776. // ------------------------------------------------------------------------------------------ impls
  3777. var EventBus = /** @class */ (function () {
  3778. function EventBus() {
  3779. /** 事件数据 */
  3780. this.store = {};
  3781. /** 事件订阅者注册表 */
  3782. this.observeStoreTable = {};
  3783. this.init();
  3784. }
  3785. EventBus.prototype.init = function () {
  3786. var _this = this;
  3787. // 更改store值就会自动publish消息 - 实现
  3788. this.store = new Proxy({}, {
  3789. get: function (target, key) {
  3790. return target[key];
  3791. },
  3792. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3793. set: function (target, key, data) {
  3794. if (noValue(key))
  3795. return false;
  3796. target[key] = data;
  3797. // 消息通知订阅者
  3798. var observerArr = _this.observeStoreTable[key];
  3799. if (noValue(observerArr) || observerArr.length <= 0)
  3800. return true;
  3801. observerArr.forEach(function (handler) {
  3802. //try {
  3803. handler(data, key);
  3804. // } catch (err) {
  3805. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3806. // }
  3807. });
  3808. return true;
  3809. },
  3810. });
  3811. };
  3812. /** 取消注册订阅者 */
  3813. EventBus.prototype.unregisterObserver = function (key, handler) {
  3814. var _this = this;
  3815. var observerArr = this.observeStoreTable[key];
  3816. if (noValue(observerArr) || observerArr.length <= 0)
  3817. return;
  3818. if (noValue(handler)) {
  3819. this.observeStoreTable[key] = [];
  3820. }
  3821. else {
  3822. observerArr.forEach(function (obsHandler, index) {
  3823. if (obsHandler !== handler)
  3824. return;
  3825. _this.observeStoreTable[key].splice(index, 1);
  3826. });
  3827. }
  3828. };
  3829. /** 注册订阅者 */
  3830. EventBus.prototype.registerObserver = function (key, handler) {
  3831. var observerArr = this.observeStoreTable[key];
  3832. if (noValue(observerArr) || observerArr.length <= 0) {
  3833. observerArr = [];
  3834. this.observeStoreTable[key] = observerArr;
  3835. }
  3836. observerArr.push(handler);
  3837. // if (noValue(key)) return;
  3838. // const sourceValue = this.store[key];
  3839. // if (noValue(sourceValue)) return;
  3840. // handler(sourceValue, key);
  3841. };
  3842. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3843. EventBus.prototype.getStore = function () {
  3844. return this.store;
  3845. };
  3846. /**
  3847. * 取消订阅
  3848. * @param key 订阅的消息key
  3849. * @param handler 指定取消的监听函数
  3850. */
  3851. EventBus.prototype.unsubscribe = function (key, handler) {
  3852. var _this = this;
  3853. if (key instanceof Array) {
  3854. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3855. }
  3856. else {
  3857. this.unregisterObserver(key, handler);
  3858. }
  3859. };
  3860. /**
  3861. * 消息订阅
  3862. * @param key 订阅的消息key
  3863. * @param handler 监听函数
  3864. */
  3865. EventBus.prototype.subscribe = function (key, handler) {
  3866. var _this = this;
  3867. var cancelSubscribe = {
  3868. key: key,
  3869. cancel: function () {
  3870. },
  3871. };
  3872. if (key instanceof Array) {
  3873. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3874. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3875. }
  3876. else {
  3877. this.registerObserver(key, handler);
  3878. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3879. }
  3880. return cancelSubscribe;
  3881. };
  3882. /**
  3883. * 消息订阅(只订阅一次)
  3884. * @param key 订阅的消息key
  3885. * @param handler 监听函数
  3886. */
  3887. EventBus.prototype.subscribeOnce = function (key, handler) {
  3888. var cancelSubscribe = this.subscribe(key, function (data) {
  3889. // try {
  3890. handler(data, key);
  3891. // } catch (err) {
  3892. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3893. // }
  3894. cancelSubscribe.cancel();
  3895. });
  3896. };
  3897. /**
  3898. * 发送消息(触发订阅监听函数)
  3899. * @param key 消息key
  3900. * @param eventData 消息值
  3901. */
  3902. EventBus.prototype.publish = function (key, eventData) {
  3903. var _this = this;
  3904. if (key instanceof Array) {
  3905. key.forEach(function (k) { return _this.store[k] = eventData; });
  3906. }
  3907. else {
  3908. this.store[key] = eventData;
  3909. }
  3910. };
  3911. return EventBus;
  3912. }());
  3913. // ------------------------------------------------------------------------------------------ use
  3914. var eventBus = new EventBus();
  3915. //# sourceMappingURL=EventBus.js.map
  3916. var model$1 = {
  3917. data: {
  3918. dataSync_isStart: false,
  3919. dataSync: {
  3920. skipError: false,
  3921. clearData: false,
  3922. tables: []
  3923. },
  3924. dataSyncResult: {
  3925. jobId: ''
  3926. },
  3927. dataSource1: '',
  3928. dataSource2: '',
  3929. schema1: '',
  3930. schema2: '',
  3931. hasDiff: false,
  3932. }
  3933. };
  3934. //# sourceMappingURL=DbSync.model.js.map
  3935. var vjson$1 = {
  3936. title: '数据库同步',
  3937. layout: 'fit',
  3938. items: [
  3939. {
  3940. reference: 'wizard1',
  3941. layout: 'card',
  3942. items: [
  3943. {
  3944. reference: 'first',
  3945. layout: 'fit',
  3946. bbar: [
  3947. '->',
  3948. {
  3949. xtype: 'button',
  3950. iconCls: 'x-fa fa-road',
  3951. text: '结构同步 &raquo;',
  3952. bind: {
  3953. disabled: '{!hasDiff}'
  3954. },
  3955. listeners: {
  3956. click: 'scope.structCopyTo',
  3957. }
  3958. },
  3959. {
  3960. xtype: 'button',
  3961. iconCls: 'x-fa fa-files-o',
  3962. text: '数据同步 &raquo;',
  3963. bind: {
  3964. disabled: '{!hasDiff}'
  3965. },
  3966. listeners: {
  3967. click: 'scope.dataCopyTo',
  3968. }
  3969. },
  3970. {
  3971. xtype: 'button',
  3972. iconCls: 'x-fa fa-sort-alpha-desc',
  3973. text: '索引同步 &raquo;',
  3974. bind: {
  3975. disabled: '{!hasDiff}'
  3976. },
  3977. listeners: {
  3978. click: 'scope.indexCopyTo',
  3979. }
  3980. },
  3981. {
  3982. xtype: 'button',
  3983. iconCls: 'x-fa fa-product-hunt',
  3984. text: '存储过程同步 &raquo;',
  3985. bind: {
  3986. disabled: '{!hasDiff}'
  3987. },
  3988. listeners: {
  3989. click: 'scope.procedureCopyTo',
  3990. }
  3991. },
  3992. ],
  3993. items: [
  3994. {
  3995. title: '数据库对比',
  3996. reference: 'grid1',
  3997. xtype: 'yvgrid',
  3998. pagination: false,
  3999. border: false,
  4000. cellTip: true,
  4001. selModel: {
  4002. type: 'checkboxmodel',
  4003. mode: 'MULTI',
  4004. },
  4005. tbar: {
  4006. xtype: 'toolbar',
  4007. items: [
  4008. {
  4009. xtype: 'combo',
  4010. fieldLabel: '源数据库',
  4011. bind: {
  4012. value: '{dataSource1}'
  4013. },
  4014. dataSource: 'scope.getDataBaseName'
  4015. },
  4016. {
  4017. xtype: 'combo',
  4018. fieldLabel: '目标数据库',
  4019. bind: {
  4020. value: '{dataSource2}'
  4021. },
  4022. dataSource: 'scope.getDataBaseName'
  4023. },
  4024. {
  4025. xtype: 'button',
  4026. iconCls: 'x-fa fa-flash',
  4027. text: '对比',
  4028. bind: {
  4029. disabled: '{!dataSource1 || !dataSource2}'
  4030. },
  4031. listeners: {
  4032. click: 'scope.diff',
  4033. }
  4034. },
  4035. {
  4036. xtype: 'button',
  4037. iconCls: 'x-fa fa-cloud-download',
  4038. text: '重新拉取结构(耗时!)',
  4039. bind: {
  4040. disabled: '{!dataSource1 || !dataSource2}'
  4041. },
  4042. listeners: {
  4043. click: 'scope.dbToMeta',
  4044. }
  4045. },
  4046. ]
  4047. },
  4048. columns: [
  4049. {
  4050. dataIndex: 'table_name1',
  4051. header: '源表',
  4052. width: 300,
  4053. },
  4054. {
  4055. dataIndex: 'table_name2',
  4056. header: '目标表',
  4057. width: 300,
  4058. },
  4059. {
  4060. dataIndex: 'diff',
  4061. header: '对比结果',
  4062. width: 100,
  4063. },
  4064. {
  4065. xtype: 'actioncolumn',
  4066. width: 30,
  4067. sortable: false,
  4068. menuDisabled: true,
  4069. items: [
  4070. {
  4071. iconCls: 'x-fa fa-bars',
  4072. text: '打开',
  4073. handler: 'scope.showDetail',
  4074. }
  4075. ]
  4076. },
  4077. {
  4078. dataIndex: 'remark',
  4079. header: '详情',
  4080. width: 200,
  4081. sortable: true,
  4082. },
  4083. ],
  4084. },
  4085. ]
  4086. },
  4087. {
  4088. reference: 'ddl',
  4089. layout: {
  4090. type: 'vbox',
  4091. pack: 'start',
  4092. align: 'stretch'
  4093. },
  4094. items: [
  4095. {
  4096. xtype: 'sqleditor',
  4097. reference: 'ddleditor',
  4098. flex: 1,
  4099. },
  4100. {
  4101. xtype: 'toolbar',
  4102. items: [
  4103. '->',
  4104. {
  4105. xtype: 'button',
  4106. text: '&laquo; 上一步',
  4107. listeners: {
  4108. click: 'scope.back'
  4109. }
  4110. },
  4111. {
  4112. xtype: 'button',
  4113. iconCls: 'x-fa fa-flash',
  4114. text: '执行',
  4115. listeners: {
  4116. click: 'scope.executeDDL'
  4117. }
  4118. },
  4119. ]
  4120. }
  4121. ]
  4122. },
  4123. {
  4124. reference: 'ddl_idx',
  4125. layout: {
  4126. type: 'vbox',
  4127. pack: 'start',
  4128. align: 'stretch'
  4129. },
  4130. items: [
  4131. {
  4132. xtype: 'sqleditor',
  4133. reference: 'ddleditor_idx',
  4134. flex: 1,
  4135. },
  4136. {
  4137. xtype: 'toolbar',
  4138. items: [
  4139. '->',
  4140. {
  4141. xtype: 'button',
  4142. text: '&laquo; 上一步',
  4143. listeners: {
  4144. click: 'scope.back'
  4145. }
  4146. },
  4147. {
  4148. xtype: 'button',
  4149. iconCls: 'x-fa fa-flash',
  4150. text: '执行',
  4151. listeners: {
  4152. click: 'scope.executeDDLIdx'
  4153. }
  4154. },
  4155. ]
  4156. }
  4157. ]
  4158. },
  4159. {
  4160. reference: 'ddl_procedure',
  4161. layout: {
  4162. type: 'vbox',
  4163. pack: 'start',
  4164. align: 'stretch'
  4165. },
  4166. items: [
  4167. {
  4168. xtype: 'sqleditor',
  4169. reference: 'ddleditor_procedure',
  4170. flex: 1,
  4171. },
  4172. {
  4173. xtype: 'toolbar',
  4174. items: [
  4175. '->',
  4176. {
  4177. xtype: 'button',
  4178. text: '&laquo; 上一步',
  4179. listeners: {
  4180. click: 'scope.back'
  4181. }
  4182. },
  4183. {
  4184. xtype: 'button',
  4185. iconCls: 'x-fa fa-flash',
  4186. text: '执行',
  4187. listeners: {
  4188. click: 'scope.executeProcedureSQL'
  4189. }
  4190. },
  4191. ]
  4192. }
  4193. ]
  4194. },
  4195. {
  4196. reference: 'datacopy',
  4197. xtype: 'yvgrid',
  4198. pagination: false,
  4199. tbar: {
  4200. xtype: 'toolbar',
  4201. items: [
  4202. {
  4203. xtype: 'checkbox',
  4204. fieldLabel: '忽略错误',
  4205. bind: {
  4206. value: '{dataSync.skipError}'
  4207. },
  4208. },
  4209. {
  4210. xtype: 'checkbox',
  4211. fieldLabel: '清空数据',
  4212. bind: {
  4213. value: '{dataSync.clearData}'
  4214. },
  4215. },
  4216. {
  4217. xtype: 'button',
  4218. iconCls: 'x-fa fa-play-circle',
  4219. text: '开始',
  4220. bind: {
  4221. disabled: '{dataSync_isStart}'
  4222. },
  4223. listeners: { click: 'scope.dataSync_start' }
  4224. },
  4225. {
  4226. xtype: 'button',
  4227. iconCls: 'x-fa fa-stop-circle',
  4228. text: '停止',
  4229. bind: {
  4230. disabled: '{!dataSync_isStart}'
  4231. },
  4232. listeners: { click: 'scope.dataSync_stop' }
  4233. },
  4234. ]
  4235. },
  4236. columns: [
  4237. {
  4238. dataIndex: 'tableName', header: '表名',
  4239. width: 300,
  4240. },
  4241. {
  4242. dataIndex: 'dataCount', header: '总记录数',
  4243. width: 150,
  4244. },
  4245. {
  4246. dataIndex: 'currentIdx', header: '当前记录数',
  4247. width: 150,
  4248. },
  4249. {
  4250. dataIndex: 'syncCount', header: '同步数',
  4251. width: 150,
  4252. },
  4253. {
  4254. dataIndex: 'deleteCount', header: '删除',
  4255. width: 150,
  4256. },
  4257. {
  4258. dataIndex: 'syncProgress', header: '进度',
  4259. width: 150, dataType: 'int', formatter: 'percentRenderer'
  4260. },
  4261. ]
  4262. }
  4263. ]
  4264. }
  4265. ]
  4266. };
  4267. //# sourceMappingURL=DbSync.view.js.map
  4268. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  4269. function createEmptyModule(path, filename) {
  4270. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  4271. }
  4272. function createFolder(parentPath, filename) {
  4273. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  4274. }
  4275. function getModuleFileContent(module) {
  4276. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  4277. }
  4278. function saveFile(fileFullPath, fileContent) {
  4279. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4280. // @ts-ignore
  4281. system.msg("保存成功");
  4282. return res;
  4283. });
  4284. }
  4285. function getQueryDslInfo(tableName) {
  4286. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  4287. args: [
  4288. { tableName: tableName }
  4289. ]
  4290. }).catch(function (e) {
  4291. var _a, _b;
  4292. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  4293. showErrorDialog(msg);
  4294. console.error(msg, e);
  4295. });
  4296. }
  4297. function invokeServer(url, param) {
  4298. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  4299. return request.post(url, {
  4300. args: [
  4301. param
  4302. ]
  4303. }).catch(function (e) {
  4304. var _a, _b;
  4305. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  4306. showErrorDialog(msg);
  4307. console.error(msg, e);
  4308. });
  4309. }
  4310. function parseSqlApi(sql) {
  4311. return request.post(getBaseUrl() + "@parseSqlApi", {
  4312. args: [sql]
  4313. }).catch(function (e) {
  4314. var _a, _b;
  4315. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  4316. showErrorDialog(msg);
  4317. console.error(msg, e);
  4318. });
  4319. }
  4320. function saveModuleFiles(param) {
  4321. return request.post(getBaseUrl() + "@saveModuleFiles", {
  4322. args: [
  4323. param
  4324. ]
  4325. }).catch(function (e) {
  4326. var _a, _b;
  4327. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  4328. showErrorDialog(msg);
  4329. console.error(msg, e);
  4330. });
  4331. }
  4332. function createQueryDSLFile(_a) {
  4333. var schema_name = _a.schema_name, table_name = _a.table_name;
  4334. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  4335. args: [{ schema_name: schema_name, table_name: table_name }]
  4336. }).catch(function (e) {
  4337. var _a, _b;
  4338. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  4339. showErrorDialog(msg);
  4340. console.error(msg, e);
  4341. });
  4342. }
  4343. function dbToMeta(param) {
  4344. if (typeof param === 'undefined') {
  4345. param = { datasource: 'master' };
  4346. }
  4347. else if (typeof param.datasource === 'undefined') {
  4348. param.datasource = 'master';
  4349. }
  4350. return request.post(getBaseUrl() + "@dbToMeta", {
  4351. args: [
  4352. param
  4353. ]
  4354. }).catch(function (e) {
  4355. var _a, _b;
  4356. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  4357. showErrorDialog(msg);
  4358. console.error(msg, e);
  4359. });
  4360. }
  4361. function getColumnDomainApi(param) {
  4362. if (typeof param === 'undefined') {
  4363. param = { datasource: 'master' };
  4364. }
  4365. else if (typeof param.datasource === 'undefined') {
  4366. param.datasource = 'master';
  4367. }
  4368. return request.post(getBaseUrl() + "@getColumnDomain", {
  4369. args: [
  4370. param
  4371. ]
  4372. }).catch(function (e) {
  4373. var _a, _b;
  4374. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  4375. showErrorDialog(msg);
  4376. console.error(msg, e);
  4377. });
  4378. }
  4379. function getMateData(param) {
  4380. if (typeof param === 'undefined') {
  4381. param = { datasource: 'master' };
  4382. }
  4383. else if (typeof param.datasource === 'undefined') {
  4384. param.datasource = 'master';
  4385. }
  4386. return request.post(getBaseUrl() + "@getMateData", {
  4387. args: [
  4388. param
  4389. ]
  4390. }).catch(function (e) {
  4391. var _a, _b;
  4392. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4393. showErrorDialog(msg);
  4394. console.error(msg, e);
  4395. });
  4396. }
  4397. function getMateDataByTableName(param) {
  4398. if (typeof param === 'undefined') {
  4399. param = { datasource: 'master' };
  4400. }
  4401. else if (typeof param.datasource === 'undefined') {
  4402. param.datasource = 'master';
  4403. }
  4404. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4405. args: [
  4406. param
  4407. ]
  4408. }).catch(function (e) {
  4409. var _a, _b;
  4410. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4411. showErrorDialog(msg);
  4412. console.error(msg, e);
  4413. });
  4414. }
  4415. function saveMetaTableChanges(param) {
  4416. if (typeof param === 'undefined') {
  4417. param = { datasource: 'master' };
  4418. }
  4419. else if (typeof param.datasource === 'undefined') {
  4420. param.datasource = 'master';
  4421. }
  4422. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4423. args: [
  4424. param
  4425. ]
  4426. }).catch(function (e) {
  4427. var _a, _b;
  4428. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4429. showErrorDialog(msg);
  4430. console.error(msg, e);
  4431. });
  4432. }
  4433. function getModifyTableDDL(param) {
  4434. if (typeof param === 'undefined') {
  4435. param = { datasource: 'master' };
  4436. }
  4437. else if (typeof param.datasource === 'undefined') {
  4438. param.datasource = 'master';
  4439. }
  4440. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4441. args: [
  4442. param
  4443. ]
  4444. }).catch(function (e) {
  4445. var _a, _b;
  4446. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4447. showErrorDialog(msg);
  4448. console.error(msg, e);
  4449. });
  4450. }
  4451. function pushToDbCommitApi(param) {
  4452. if (typeof param === 'undefined') {
  4453. param = { datasource: 'master' };
  4454. }
  4455. else if (typeof param.datasource === 'undefined') {
  4456. param.datasource = 'master';
  4457. }
  4458. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4459. args: [
  4460. param
  4461. ]
  4462. }).catch(function (e) {
  4463. var _a, _b;
  4464. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4465. showErrorDialog(msg);
  4466. console.error(msg, e);
  4467. });
  4468. }
  4469. /**
  4470. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4471. */
  4472. function saveMetaExBuildDDL(param) {
  4473. if (typeof param === 'undefined') {
  4474. param = { datasource: 'master' };
  4475. }
  4476. else if (typeof param.datasource === 'undefined') {
  4477. param.datasource = 'master';
  4478. }
  4479. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4480. args: [
  4481. param
  4482. ]
  4483. }).catch(function (e) {
  4484. var _a, _b;
  4485. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4486. showErrorDialog(msg);
  4487. console.error(msg, e);
  4488. });
  4489. }
  4490. function registerResource(params) {
  4491. return request.post(getBaseUrl() + "@registerResource", {
  4492. args: [params]
  4493. }).catch(function (e) {
  4494. var _a, _b;
  4495. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4496. showErrorDialog(msg);
  4497. console.error(msg, e);
  4498. });
  4499. }
  4500. function getMenuTree(params) {
  4501. return request.post(getBaseUrl() + "@getMenuTree", {
  4502. args: [params]
  4503. }).catch(function (e) {
  4504. var _a, _b;
  4505. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4506. showErrorDialog(msg);
  4507. console.error(msg, e);
  4508. });
  4509. }
  4510. function moduleTree() {
  4511. return request.post(getBaseUrl() + "@moduleTree")
  4512. .catch(function (e) {
  4513. var _a, _b;
  4514. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4515. showErrorDialog(msg);
  4516. console.error(msg, e);
  4517. });
  4518. }
  4519. function dropTableDDL(schemaName, tableName) {
  4520. return request.post(getBaseUrl() + "@dropTableDDL", {
  4521. args: [
  4522. { schemaName: schemaName, tableName: tableName },
  4523. ]
  4524. }).catch(function (e) {
  4525. var _a, _b;
  4526. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4527. showErrorDialog(msg);
  4528. console.error(msg, e);
  4529. });
  4530. }
  4531. function renameTableDDL(schemaName, tableName, reTableName) {
  4532. return request.post(getBaseUrl() + "@renameTableDDL", {
  4533. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4534. }).catch(function (e) {
  4535. var _a, _b;
  4536. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4537. showErrorDialog(msg);
  4538. console.error(msg, e);
  4539. });
  4540. }
  4541. function executeModifyProcedureSQL(param) {
  4542. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4543. args: [
  4544. param,
  4545. ]
  4546. }).catch(function (e) {
  4547. var _a, _b;
  4548. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4549. showErrorDialog(msg);
  4550. console.error(msg, e);
  4551. });
  4552. }
  4553. function parseDynamicSqlApi(sql, dataSource) {
  4554. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4555. args: [
  4556. { sql: sql, dataSource: dataSource },
  4557. ]
  4558. }).catch(function (e) {
  4559. var _a, _b;
  4560. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4561. showErrorDialog(msg);
  4562. console.error(msg, e);
  4563. });
  4564. }
  4565. function exporerList() {
  4566. return request.post(getBaseUrl() + "@exporerList", {
  4567. args: [{}]
  4568. }).catch(function (e) {
  4569. var _a, _b;
  4570. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4571. showErrorDialog(msg);
  4572. console.error(msg, e);
  4573. });
  4574. }
  4575. function reportListApi() {
  4576. return request.post(getBaseUrl() + "@reportList", {
  4577. args: []
  4578. }).catch(function (e) {
  4579. var _a, _b;
  4580. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4581. showErrorDialog(msg);
  4582. console.error(msg, e);
  4583. });
  4584. }
  4585. function reportByIdApi(reportId) {
  4586. return request.post(getBaseUrl() + "@reportById", {
  4587. args: [
  4588. { reportId: reportId },
  4589. ]
  4590. }).catch(function (e) {
  4591. var _a, _b;
  4592. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4593. showErrorDialog(msg);
  4594. console.error(msg, e);
  4595. });
  4596. }
  4597. function createReportApi(reportName) {
  4598. return request.post(getBaseUrl() + "@createReport", {
  4599. args: [
  4600. { reportName: reportName },
  4601. ]
  4602. }).catch(function (e) {
  4603. var _a, _b;
  4604. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4605. showErrorDialog(msg);
  4606. console.error(msg, e);
  4607. });
  4608. }
  4609. function saveReportApi(param) {
  4610. return request.post(getBaseUrl() + "@saveReport", {
  4611. args: [
  4612. param,
  4613. ]
  4614. }).catch(function (e) {
  4615. var _a, _b;
  4616. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  4617. showErrorDialog(msg);
  4618. console.error(msg, e);
  4619. });
  4620. }
  4621. function delReportApi(report_id) {
  4622. return request.post(getBaseUrl() + "@delReport", {
  4623. args: [{ report_id: report_id },]
  4624. }).catch(function (e) {
  4625. var _a, _b;
  4626. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4627. showErrorDialog(msg);
  4628. console.error(msg, e);
  4629. });
  4630. }
  4631. function getDict(param) {
  4632. if (typeof param === 'undefined') {
  4633. param = { datasource: 'master' };
  4634. }
  4635. else if (typeof param.datasource === 'undefined') {
  4636. param.datasource = 'master';
  4637. }
  4638. return request.post(getBaseUrl() + "@getDict", {
  4639. args: [
  4640. param
  4641. ]
  4642. });
  4643. }
  4644. function saveDictApi(param) {
  4645. if (typeof param === 'undefined') {
  4646. param = { datasource: 'master' };
  4647. }
  4648. else if (typeof param.datasource === 'undefined') {
  4649. param.datasource = 'master';
  4650. }
  4651. return request.post(getBaseUrl() + "@saveDict", {
  4652. args: [
  4653. param
  4654. ]
  4655. }).catch(function (e) {
  4656. var _a, _b;
  4657. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4658. showErrorDialog(msg);
  4659. console.error(msg, e);
  4660. });
  4661. }
  4662. function saveDictItemsApi(param) {
  4663. if (typeof param === 'undefined') {
  4664. param = { datasource: 'master' };
  4665. }
  4666. else if (typeof param.datasource === 'undefined') {
  4667. param.datasource = 'master';
  4668. }
  4669. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4670. args: [
  4671. param
  4672. ]
  4673. }).catch(function (e) {
  4674. var _a, _b;
  4675. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4676. showErrorDialog(msg);
  4677. console.error(msg, e);
  4678. });
  4679. }
  4680. function createDictEnum(param) {
  4681. return request.post(getBaseUrl() + "@createDictEnum", {
  4682. args: [
  4683. param
  4684. ]
  4685. }).catch(function (e) {
  4686. var _a, _b;
  4687. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4688. showErrorDialog(msg);
  4689. console.error(msg, e);
  4690. });
  4691. }
  4692. function loadSqlContentApi(url) {
  4693. return request.post(getBaseUrl() + "@loadSqlContent", {
  4694. args: [
  4695. {
  4696. url: GLOBAL_NAMESPACE_PREFIX + url,
  4697. }
  4698. ]
  4699. }).catch(function (e) {
  4700. var _a, _b;
  4701. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  4702. showErrorDialog(msg);
  4703. console.error(msg, e);
  4704. });
  4705. }
  4706. function saveSqlContentApi(url, content) {
  4707. return request.post(getBaseUrl() + "@saveSqlContent", {
  4708. args: [
  4709. {
  4710. url: GLOBAL_NAMESPACE_PREFIX + url,
  4711. content: content,
  4712. }
  4713. ]
  4714. }).catch(function (e) {
  4715. var _a, _b;
  4716. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4717. showErrorDialog(msg);
  4718. console.error(msg, e);
  4719. });
  4720. }
  4721. function readBpmn(param) {
  4722. return request.post(getBaseUrl() + "@readBpmn", {
  4723. args: [param]
  4724. }).catch(function (e) {
  4725. var _a, _b;
  4726. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4727. showErrorDialog(msg);
  4728. console.error(msg, e);
  4729. });
  4730. }
  4731. function createBpmn(path, filename) {
  4732. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4733. var _a, _b;
  4734. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4735. showErrorDialog(msg);
  4736. console.error(msg, e);
  4737. });
  4738. }
  4739. function saveBpmn(fileFullPath, fileContent) {
  4740. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4741. // @ts-ignore
  4742. system.msg("保存成功");
  4743. return res;
  4744. });
  4745. }
  4746. function deleteBpmn(path, filename) {
  4747. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4748. var _a, _b;
  4749. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4750. showErrorDialog(msg);
  4751. console.error(msg, e);
  4752. });
  4753. }
  4754. function createDevForm(param) {
  4755. return request.post(getBaseUrl() + "@createDevForm", {
  4756. args: [param]
  4757. }).catch(function (e) {
  4758. var _a, _b;
  4759. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4760. showErrorDialog(msg);
  4761. console.error(msg, e);
  4762. });
  4763. }
  4764. function readDevForm(param) {
  4765. return request.post(getBaseUrl() + "@readDevForm", {
  4766. args: [param]
  4767. }).catch(function (e) {
  4768. var _a, _b;
  4769. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4770. showErrorDialog(msg);
  4771. console.error(msg, e);
  4772. });
  4773. }
  4774. function calcColumnForm(param) {
  4775. return request.post(getBaseUrl() + "@calcColumnForm", {
  4776. args: [param]
  4777. }).catch(function (e) {
  4778. var _a, _b;
  4779. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4780. showErrorDialog(msg);
  4781. console.error(msg, e);
  4782. });
  4783. }
  4784. function widgetListApi(param) {
  4785. return request.post(getBaseUrl() + "@widgetListApi", {
  4786. args: [param]
  4787. }).catch(function (e) {
  4788. var _a, _b;
  4789. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4790. showErrorDialog(msg);
  4791. console.error(msg, e);
  4792. });
  4793. }
  4794. function readWidget(param) {
  4795. return request.post(getBaseUrl() + "@readWidget", {
  4796. args: [param]
  4797. }).catch(function (e) {
  4798. var _a, _b;
  4799. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4800. showErrorDialog(msg);
  4801. console.error(msg, e);
  4802. });
  4803. }
  4804. function saveWidget(param) {
  4805. return request.post(getBaseUrl() + "@saveWidget", {
  4806. args: [param]
  4807. }).catch(function (e) {
  4808. var _a, _b;
  4809. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4810. showErrorDialog(msg);
  4811. console.error(msg, e);
  4812. });
  4813. }
  4814. function deleteWidget(param) {
  4815. return request.post(getBaseUrl() + "@deleteWidget", {
  4816. args: [param]
  4817. }).catch(function (e) {
  4818. var _a, _b;
  4819. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4820. showErrorDialog(msg);
  4821. console.error(msg, e);
  4822. });
  4823. }
  4824. function getDataBaseNameApi() {
  4825. return request.post(getBaseUrl() + "@getDataBaseName", {
  4826. args: []
  4827. }).catch(function (e) {
  4828. var _a, _b;
  4829. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4830. showErrorDialog(msg);
  4831. console.error(msg, e);
  4832. });
  4833. }
  4834. function getDiffDDLApi(param) {
  4835. return request.post(getBaseUrl() + "@getDiffDDL", {
  4836. args: [
  4837. param
  4838. ]
  4839. }).catch(function (e) {
  4840. var _a, _b;
  4841. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4842. showErrorDialog(msg);
  4843. console.error(msg, e);
  4844. });
  4845. }
  4846. function dataSyncApi(param) {
  4847. return request.post(getBaseUrl() + "@dataSync", {
  4848. args: [
  4849. param
  4850. ]
  4851. }).catch(function (e) {
  4852. var _a, _b;
  4853. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4854. showErrorDialog(msg);
  4855. console.error(msg, e);
  4856. });
  4857. }
  4858. function dataSyncInfoApi(param) {
  4859. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4860. args: [
  4861. param
  4862. ]
  4863. }).catch(function (e) {
  4864. var _a, _b;
  4865. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4866. showErrorDialog(msg);
  4867. console.error(msg, e);
  4868. });
  4869. }
  4870. function saveColumnDomain(param) {
  4871. if (typeof param === 'undefined') {
  4872. param = { datasource: 'master' };
  4873. }
  4874. else if (typeof param.datasource === 'undefined') {
  4875. param.datasource = 'master';
  4876. }
  4877. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4878. args: [
  4879. param
  4880. ]
  4881. }).catch(function (e) {
  4882. var _a, _b;
  4883. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4884. showErrorDialog('发生错误:' + msg);
  4885. console.error(msg, e);
  4886. });
  4887. }
  4888. function devOpsList() {
  4889. return request.post(getBaseUrl() + "@devOpsList", {
  4890. args: [{}]
  4891. }).catch(function (e) {
  4892. var _a, _b;
  4893. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4894. showErrorDialog('发生错误:' + msg);
  4895. console.error(msg, e);
  4896. });
  4897. }
  4898. function devOpsById(opsId) {
  4899. return request.post(getBaseUrl() + "@devOpsById", {
  4900. args: [{ opsId: opsId }]
  4901. }).catch(function (e) {
  4902. var _a, _b;
  4903. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4904. showErrorDialog('发生错误:' + msg);
  4905. console.error(msg, e);
  4906. });
  4907. }
  4908. function metricsRequestApi() {
  4909. return request.get("/api/metrics/request")
  4910. .catch(function (e) {
  4911. var _a, _b;
  4912. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4913. showErrorDialog('发生错误:' + msg);
  4914. console.error(msg, e);
  4915. });
  4916. }
  4917. function metricsJdbcApi() {
  4918. return request.get("/api/metrics/jdbc")
  4919. .catch(function (e) {
  4920. var _a, _b;
  4921. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4922. showErrorDialog('发生错误:' + msg);
  4923. console.error(msg, e);
  4924. });
  4925. }
  4926. function executeDDL(param) {
  4927. return request.post(getBaseUrl() + "@executeDDL", {
  4928. args: [
  4929. param,
  4930. ]
  4931. }).catch(function (e) {
  4932. var _a, _b;
  4933. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4934. showErrorDialog('发生错误:' + msg);
  4935. console.error(msg, e);
  4936. });
  4937. }
  4938. function getModifyIdxDDL(param) {
  4939. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4940. args: [
  4941. param,
  4942. ]
  4943. }).catch(function (e) {
  4944. var _a, _b;
  4945. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4946. showErrorDialog('发生错误:' + msg);
  4947. console.error(msg, e);
  4948. });
  4949. }
  4950. function getModifyProcedureSQL(param) {
  4951. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4952. args: [
  4953. param,
  4954. ]
  4955. }).catch(function (e) {
  4956. var _a, _b;
  4957. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4958. showErrorDialog('发生错误:' + msg);
  4959. console.error(msg, e);
  4960. });
  4961. }
  4962. function saveWhLayout(param) {
  4963. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4964. args: [
  4965. param,
  4966. ]
  4967. }).catch(function (e) {
  4968. var _a, _b;
  4969. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4970. showErrorDialog('发生错误:' + msg);
  4971. console.error(msg, e);
  4972. });
  4973. }
  4974. function deleteWhLayout(param) {
  4975. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4976. args: [
  4977. param,
  4978. ]
  4979. }).catch(function (e) {
  4980. var _a, _b;
  4981. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  4982. showErrorDialog('发生错误:' + msg);
  4983. console.error(msg, e);
  4984. });
  4985. }
  4986. function loadWhLayoutAll() {
  4987. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  4988. args: []
  4989. }).catch(function (e) {
  4990. var _a, _b;
  4991. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  4992. showErrorDialog('发生错误:' + msg);
  4993. console.error(msg, e);
  4994. });
  4995. }
  4996. function loadWhLayout(param) {
  4997. return request.post(getLayoutUrl() + "@loadWhLayout", {
  4998. args: [
  4999. param,
  5000. ]
  5001. }).catch(function (e) {
  5002. var _a, _b;
  5003. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  5004. showErrorDialog('发生错误:' + msg);
  5005. console.error(msg, e);
  5006. });
  5007. }
  5008. var baseUrl = "/api/com/yvan/studio/FileManager";
  5009. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  5010. function getBaseUrl() {
  5011. // return getCurrentProject().url + baseUrl
  5012. return baseUrl;
  5013. }
  5014. function getLayoutUrl() {
  5015. // return getCurrentProject().url + baseUrl
  5016. return layoutUrl;
  5017. }
  5018. var Request = /** @class */ (function () {
  5019. function Request(axiosInstance) {
  5020. this.axiosInstance = axiosInstance;
  5021. }
  5022. // 全局响应数据转换处理
  5023. Request.transformResponse = function (response) {
  5024. var _a;
  5025. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  5026. };
  5027. Request.prototype.get = function (url, config) {
  5028. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  5029. };
  5030. Request.prototype.delete = function (url, config) {
  5031. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  5032. };
  5033. Request.prototype.head = function (url, config) {
  5034. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  5035. };
  5036. Request.prototype.options = function (url, config) {
  5037. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  5038. };
  5039. Request.prototype.post = function (url, data, config) {
  5040. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5041. };
  5042. Request.prototype.put = function (url, data, config) {
  5043. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5044. };
  5045. Request.prototype.patch = function (url, data, config) {
  5046. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5047. };
  5048. Request.prototype.request = function (config) {
  5049. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  5050. };
  5051. return Request;
  5052. }());
  5053. /** 创建一个axios实例对象 */
  5054. function axiosCreate(config) {
  5055. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  5056. }
  5057. var axiosInstance;
  5058. function init() {
  5059. axiosInstance = axiosCreate({
  5060. validateStatus: function (status) { return (status >= 200 && status < 400); },
  5061. });
  5062. request = new Request(axiosInstance);
  5063. }
  5064. var request;
  5065. //# sourceMappingURL=Api.js.map
  5066. /**
  5067. * 对比两个列 是否存在不一致
  5068. */
  5069. function compareColumn(t1, c1, t2, c2) {
  5070. if (typeof c2 === 'undefined') {
  5071. return 'column_name';
  5072. }
  5073. if (c1.column_name !== c2.column_name) {
  5074. return 'column_name';
  5075. }
  5076. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  5077. return 'default_value';
  5078. }
  5079. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  5080. return 'column_comment';
  5081. }
  5082. if (c1.is_primary_key !== c2.is_primary_key) {
  5083. return 'is_primary_key';
  5084. }
  5085. if (c1.not_null !== c2.not_null) {
  5086. return 'not_null';
  5087. }
  5088. var symbol1 = getDataTypeSymbol(t1, c1);
  5089. var symbol2 = getDataTypeSymbol(t2, c2);
  5090. if (symbol1 !== symbol2) {
  5091. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5092. return 'data_type';
  5093. }
  5094. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5095. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  5096. // 只关注长度
  5097. if (c1.column_size != c2.column_size) {
  5098. return 'column_size';
  5099. }
  5100. }
  5101. else {
  5102. // 其他情况,长度和精度都要关注
  5103. if (c1.column_size != c2.column_size) {
  5104. return 'column_size';
  5105. }
  5106. if (c1.decimal_digits !== c2.decimal_digits) {
  5107. return 'decimal_digits';
  5108. }
  5109. }
  5110. }
  5111. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  5112. var symbol1 = getDataTypeSymbol(tableInfo, column);
  5113. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  5114. if (symbol1 !== symbol2) {
  5115. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5116. return 'data_type';
  5117. }
  5118. if (is_fix_size) {
  5119. // 字段域吧大小限制住了
  5120. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5121. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  5122. // 只关注长度
  5123. if (column.column_size != domain.column_size) {
  5124. return 'column_size';
  5125. }
  5126. }
  5127. else {
  5128. // 其他情况,长度和精度都要关注
  5129. if (column.column_size != domain.column_size) {
  5130. return 'column_size';
  5131. }
  5132. if (column.decimal_digits !== domain.decimal_digits) {
  5133. return 'decimal_digits';
  5134. }
  5135. }
  5136. }
  5137. }
  5138. function checkColumn(table, col) {
  5139. if (isEmpty(col.column_name)) {
  5140. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  5141. }
  5142. if (isKeyword(col.column_name)) {
  5143. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  5144. }
  5145. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  5146. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  5147. }
  5148. return undefined;
  5149. }
  5150. function applyDomain(dbType, domain) {
  5151. var editRow = {
  5152. data_type: domain[dbType + '_datatype'],
  5153. };
  5154. domain = _$2.cloneDeep(domain);
  5155. if (!editRow.data_type) {
  5156. throw Error('字段域没有定义数据类型!');
  5157. }
  5158. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  5159. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  5160. if (match) {
  5161. // 类型里面包含括号
  5162. var sz = parseInt(match[2]);
  5163. if (isNaN(sz)) {
  5164. throw Error('字段域的定义错误:' + editRow.data_type);
  5165. }
  5166. domain.is_fix_size = true;
  5167. editRow.data_type = match[1];
  5168. domain.column_size = sz;
  5169. domain.decimal_digits = 0;
  5170. }
  5171. else {
  5172. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  5173. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  5174. if (match2) {
  5175. // 类型里面包含括号
  5176. var sz = parseInt(match2[2]);
  5177. if (isNaN(sz)) {
  5178. throw Error('字段域的定义错误:' + editRow.data_type);
  5179. }
  5180. var dg = parseInt(match2[3]);
  5181. if (isNaN(dg)) {
  5182. throw Error('字段域的定义错误:' + editRow.data_type);
  5183. }
  5184. domain.is_fix_size = true;
  5185. editRow.data_type = match[1];
  5186. domain.column_size = sz;
  5187. domain.decimal_digits = dg;
  5188. }
  5189. }
  5190. if (domain.domain_column_ui) {
  5191. _$2.extend(editRow, {
  5192. column_ui: domain.domain_column_ui,
  5193. });
  5194. }
  5195. if (domain.domain_column_dict) {
  5196. _$2.extend(editRow, {
  5197. column_dict: domain.domain_column_dict,
  5198. });
  5199. }
  5200. if (domain.is_fix_size) {
  5201. _$2.extend(editRow, {
  5202. column_size: domain.column_size,
  5203. decimal_digits: domain.decimal_digits
  5204. });
  5205. }
  5206. if (domain.is_fix_default_value) {
  5207. _$2.extend(editRow, {
  5208. default_value: domain.default_value,
  5209. });
  5210. }
  5211. return editRow;
  5212. }
  5213. /**
  5214. * 获取字段类型代号(用于做跨数据库数据类型对比)
  5215. */
  5216. function getDataTypeSymbol(table, col) {
  5217. if (table.db_type === 'oracle') {
  5218. switch (col.data_type) {
  5219. case 'number':
  5220. if (col.column_size <= 10 && !col.decimal_digits) {
  5221. return 'integer';
  5222. }
  5223. else if (col.column_size <= 19 && !col.decimal_digits) {
  5224. return 'long';
  5225. }
  5226. return 'bigdecimal';
  5227. case 'char':
  5228. if (col.column_size > 3000) {
  5229. return 'clob';
  5230. }
  5231. return 'char';
  5232. case 'integer':
  5233. return 'integer';
  5234. case 'varchar':
  5235. case 'varchar2':
  5236. if (col.column_size > 3000) {
  5237. return 'clob';
  5238. }
  5239. return 'varchar';
  5240. case 'clob':
  5241. return 'clob';
  5242. case 'blob':
  5243. return 'blob';
  5244. case 'date':
  5245. case 'timestamp':
  5246. case 'timestamp(6)':
  5247. case 'timestamp with local time zone':
  5248. case 'timestamp(6) with local time zone':
  5249. case 'timestamp(6) with time zone':
  5250. return 'timestamp';
  5251. }
  5252. return "undefined";
  5253. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  5254. }
  5255. if (table.db_type === 'pgsql') {
  5256. switch (col.data_type) {
  5257. case 'int4':
  5258. return 'integer';
  5259. case 'int8':
  5260. return 'long';
  5261. case 'char':
  5262. return 'char';
  5263. case 'varchar':
  5264. case 'varchar2':
  5265. if (col.column_size > 3000) {
  5266. return 'clob';
  5267. }
  5268. return 'varchar';
  5269. case 'numeric':
  5270. if (col.column_size <= 10 && !col.decimal_digits) {
  5271. return 'integer';
  5272. }
  5273. else if (col.column_size <= 19 && !col.decimal_digits) {
  5274. return 'long';
  5275. }
  5276. return 'bigdecimal';
  5277. case 'timestamp':
  5278. case 'timestamptz':
  5279. return 'timestamp';
  5280. case 'bytea':
  5281. return 'blob';
  5282. }
  5283. return "undefined";
  5284. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  5285. }
  5286. throw Error('未知数据库类型:' + table.db_type);
  5287. }
  5288. /**
  5289. * 判断对象名称是不是数据库关键字(保留字)
  5290. */
  5291. function isKeyword(word) {
  5292. if (!word || typeof word !== 'string') {
  5293. return false;
  5294. }
  5295. var kk = ['access',
  5296. 'add',
  5297. 'all',
  5298. 'alter',
  5299. 'and',
  5300. 'any',
  5301. 'as',
  5302. 'asc',
  5303. 'audit',
  5304. 'between',
  5305. 'by',
  5306. 'char',
  5307. 'check',
  5308. 'cluster',
  5309. 'column',
  5310. 'comment',
  5311. 'compress',
  5312. 'connect',
  5313. 'create',
  5314. 'current',
  5315. 'date',
  5316. 'decimal',
  5317. 'default',
  5318. 'delete',
  5319. 'desc',
  5320. 'distinct',
  5321. 'drop',
  5322. 'else',
  5323. 'exclusive',
  5324. 'exists',
  5325. 'file',
  5326. 'float',
  5327. 'for',
  5328. 'from',
  5329. 'grant',
  5330. 'group',
  5331. 'having',
  5332. 'identified',
  5333. 'immediate',
  5334. 'in',
  5335. 'increment',
  5336. 'index',
  5337. 'initial',
  5338. 'insert',
  5339. 'integer',
  5340. 'intersect',
  5341. 'into',
  5342. 'is',
  5343. 'level',
  5344. 'like',
  5345. 'lock',
  5346. 'long',
  5347. 'maxextents',
  5348. 'minus',
  5349. 'mlslabel',
  5350. 'mode',
  5351. 'modify',
  5352. 'noaudit',
  5353. 'nocompress',
  5354. 'not',
  5355. 'nowait',
  5356. 'null',
  5357. 'number',
  5358. 'of',
  5359. 'offline',
  5360. 'on',
  5361. 'online',
  5362. 'option',
  5363. 'or',
  5364. 'order',
  5365. 'p',
  5366. 'ctfree',
  5367. 'prior',
  5368. 'privileges',
  5369. 'public',
  5370. 'raw',
  5371. 'rename',
  5372. 'resource',
  5373. 'revoke',
  5374. 'row',
  5375. 'rowid',
  5376. 'rownum',
  5377. 'rows',
  5378. 'select',
  5379. 'session',
  5380. 'set',
  5381. 'share',
  5382. 'size',
  5383. 'smallint',
  5384. 'start',
  5385. 'successful',
  5386. 'synonym',
  5387. 'sysdate',
  5388. 'table',
  5389. 'then',
  5390. 'to',
  5391. 'trigger',
  5392. 'uid',
  5393. 'union',
  5394. 'unique',
  5395. 'update',
  5396. 'user',
  5397. 'validate',
  5398. 'values',
  5399. 'varchar',
  5400. 'varchar2',
  5401. 'view',
  5402. 'whenever',
  5403. 'where',
  5404. 'with'];
  5405. return _$2.includes(kk, word.toLowerCase());
  5406. }
  5407. //# sourceMappingURL=DbUtils.js.map
  5408. var DbSync = /** @class */ (function (_super) {
  5409. __extends(DbSync, _super);
  5410. function DbSync() {
  5411. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5412. }
  5413. DbSync.prototype.onLoad = function () {
  5414. };
  5415. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5416. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5417. getDataBaseNameApi().then(function (res) {
  5418. successCallback(res.data.map(function (name) {
  5419. return {
  5420. id: name, text: name
  5421. };
  5422. }));
  5423. });
  5424. };
  5425. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5426. showInfoDialog(record.get('remark'));
  5427. };
  5428. DbSync.prototype.diff = function () {
  5429. var _this = this;
  5430. var promise1 = getMateData({
  5431. datasource: this.viewModel.get('dataSource1')
  5432. });
  5433. var promise2 = getMateData({
  5434. datasource: this.viewModel.get('dataSource2')
  5435. });
  5436. this.viewModel.set('schema1', '');
  5437. this.viewModel.set('schema2', '');
  5438. this.refs.grid1.setLoading(true);
  5439. Promise.all([promise1, promise2]).then(function (_a) {
  5440. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5441. var rows = [];
  5442. if (_$2.size(res1) > 0) {
  5443. // res1 起码有一个 schema
  5444. _this.viewModel.set('schema1', res1[0].schema_name);
  5445. _this.viewModel.set('schema2', res2[0].schema_name);
  5446. if (!_this.viewModel.get('schema1')) {
  5447. msg$1('datasource1 最起码需要一张表');
  5448. return;
  5449. }
  5450. if (!_this.viewModel.get('schema2')) {
  5451. msg$1('datasource2 最起码需要一张表');
  5452. return;
  5453. }
  5454. _$2.forEach(res1[0].table_list, function (table1) {
  5455. var _a;
  5456. 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; });
  5457. if (table1.schema_name) {
  5458. _this.viewModel.set('schema1', table1.schema_name);
  5459. }
  5460. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5461. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5462. }
  5463. var row = {
  5464. table_name1: table1.table_name,
  5465. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5466. table_info: table1
  5467. };
  5468. if (!table2) {
  5469. row.diff = '不一致';
  5470. row.remark = '目标表缺失';
  5471. }
  5472. else if (table1.column_list.length !== table2.column_list.length) {
  5473. row.diff = '不一致';
  5474. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5475. }
  5476. else {
  5477. row.diff = '一致';
  5478. var remark_1 = [];
  5479. _$2.forEach(table1.column_list, function (col1) {
  5480. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5481. if (!col2) {
  5482. row.diff = '不一致';
  5483. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5484. }
  5485. else {
  5486. var colDiff = compareColumn(table1, col1, table2, col2);
  5487. if (colDiff) {
  5488. row.diff = '不一致';
  5489. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5490. }
  5491. }
  5492. });
  5493. row.remark = remark_1.join('\n');
  5494. }
  5495. rows.push(row);
  5496. });
  5497. }
  5498. _this.refs.grid1.setData(rows);
  5499. _this.viewModel.set('hasDiff', true);
  5500. }).finally(function () {
  5501. _this.refs.grid1.setLoading(false);
  5502. });
  5503. };
  5504. DbSync.prototype.structCopyTo = function () {
  5505. var _this = this;
  5506. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5507. msg$1('选择数据源!');
  5508. return;
  5509. }
  5510. var recordList = this.refs.grid1.getSelection();
  5511. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5512. if (_$2.size(tableNameList) <= 0) {
  5513. msg$1('请选择要同步的表');
  5514. return;
  5515. }
  5516. var error = undefined;
  5517. _$2.forEach(tableNameList, function (tableInfo) {
  5518. _$2.forEach(tableInfo.column_list, function (col) {
  5519. error = checkColumn(tableInfo, col);
  5520. return false;
  5521. });
  5522. if (error) {
  5523. return false;
  5524. }
  5525. });
  5526. if (error) {
  5527. msg$1(error);
  5528. return;
  5529. }
  5530. var schema1 = this.viewModel.get('schema1');
  5531. var schema2 = this.viewModel.get('schema2');
  5532. if (!schema1 || !schema2) {
  5533. msg$1('无法识别 schema 名称');
  5534. return;
  5535. }
  5536. this.refs.grid1.setLoading(true);
  5537. getDiffDDLApi({
  5538. datasource1: this.viewModel.get('dataSource1'),
  5539. datasource2: this.viewModel.get('dataSource2'),
  5540. schema1: this.viewModel.get('schema1'),
  5541. schema2: this.viewModel.get('schema2'),
  5542. tables: tableNameList,
  5543. }).then(function (res) {
  5544. if (res.success) {
  5545. _this.refs.ddleditor.setCode(res.data);
  5546. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5547. }
  5548. }).finally(function () {
  5549. _this.refs.grid1.setLoading(false);
  5550. });
  5551. };
  5552. DbSync.prototype.indexCopyTo = function () {
  5553. var _this = this;
  5554. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5555. msg$1('选择数据源!');
  5556. return;
  5557. }
  5558. var recordList = this.refs.grid1.getSelection();
  5559. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5560. if (_$2.size(tableNameList) <= 0) {
  5561. msg$1('请选择要同步的表');
  5562. return;
  5563. }
  5564. var schema1 = this.viewModel.get('schema1');
  5565. var schema2 = this.viewModel.get('schema2');
  5566. if (!schema1 || !schema2) {
  5567. msg$1('无法识别 schema 名称');
  5568. return;
  5569. }
  5570. this.refs.grid1.setLoading(true);
  5571. getModifyIdxDDL({
  5572. datasource1: this.viewModel.get('dataSource1'),
  5573. datasource2: this.viewModel.get('dataSource2'),
  5574. schema1: this.viewModel.get('schema1'),
  5575. schema2: this.viewModel.get('schema2'),
  5576. tables: tableNameList,
  5577. }).then(function (res) {
  5578. if (res.success) {
  5579. _this.refs.ddleditor_idx.setCode(res.data);
  5580. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5581. }
  5582. }).finally(function () {
  5583. _this.refs.grid1.setLoading(false);
  5584. });
  5585. };
  5586. DbSync.prototype.procedureCopyTo = function () {
  5587. var _this = this;
  5588. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5589. msg$1('选择数据源!');
  5590. return;
  5591. }
  5592. var schema1 = this.viewModel.get('schema1');
  5593. var schema2 = this.viewModel.get('schema2');
  5594. if (!schema1 || !schema2) {
  5595. msg$1('无法识别 schema 名称');
  5596. return;
  5597. }
  5598. this.refs.grid1.setLoading(true);
  5599. getModifyProcedureSQL({
  5600. datasource1: this.viewModel.get('dataSource1'),
  5601. datasource2: this.viewModel.get('dataSource2'),
  5602. schema1: this.viewModel.get('schema1'),
  5603. schema2: this.viewModel.get('schema2'),
  5604. }).then(function (res) {
  5605. if (res.success) {
  5606. _this.refs.ddleditor_procedure.setCode(res.data);
  5607. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5608. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5609. }
  5610. }).finally(function () {
  5611. _this.refs.grid1.setLoading(false);
  5612. });
  5613. };
  5614. DbSync.prototype.dataSync_start = function () {
  5615. var _this = this;
  5616. this.viewModel.set('dataSync_isStart', true);
  5617. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5618. this.refs.datacopy.setLoading(true);
  5619. dataSyncApi(dataSync)
  5620. .then(function (res) {
  5621. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5622. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5623. })
  5624. .finally(function () {
  5625. _this.refs.datacopy.setLoading(false);
  5626. });
  5627. };
  5628. DbSync.prototype.dataSync_process = function () {
  5629. var _this = this;
  5630. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5631. dataSyncInfoApi({ jobId: jobId })
  5632. .then(function (res) {
  5633. if (_$2.isArray(res.tableSyncInfos)) {
  5634. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5635. _this.refs.datacopy.setData(res.tableSyncInfos);
  5636. try {
  5637. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5638. }
  5639. catch (e) {
  5640. }
  5641. }
  5642. if (res.endTime) {
  5643. // 已经结束
  5644. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5645. if (res.success) {
  5646. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5647. }
  5648. else {
  5649. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5650. }
  5651. _this.dataSync_stop();
  5652. }
  5653. })
  5654. .catch(function (e) {
  5655. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5656. console.error(e);
  5657. // this.dataSync_stop()
  5658. })
  5659. .finally(function () {
  5660. _this.refs.datacopy.setLoading(false);
  5661. });
  5662. };
  5663. DbSync.prototype.dataSync_stop = function () {
  5664. this.viewModel.set('dataSync_isStart', false);
  5665. clearInterval(this.dataSyncInterval);
  5666. delete this.dataSyncInterval;
  5667. };
  5668. DbSync.prototype.dataCopyTo = function () {
  5669. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5670. msg$1('选择数据源!');
  5671. return;
  5672. }
  5673. var recordList = this.refs.grid1.getSelection();
  5674. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5675. if (_$2.size(tableNameList) <= 0) {
  5676. msg$1('请选择要同步的表');
  5677. return;
  5678. }
  5679. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5680. this.viewModel.set('dataSync.tables', tableNameList);
  5681. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5682. };
  5683. DbSync.prototype.next = function () {
  5684. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5685. };
  5686. DbSync.prototype.back = function () {
  5687. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5688. };
  5689. DbSync.prototype.dbToMeta = function () {
  5690. var _this = this;
  5691. var dataSource1 = this.viewModel.get('dataSource1');
  5692. var dataSource2 = this.viewModel.get('dataSource2');
  5693. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5694. var promise1 = dbToMeta({ datasource: dataSource1 });
  5695. var promise2 = dbToMeta({ datasource: dataSource2 });
  5696. _this.refs.grid1.setLoading(true);
  5697. Promise.all([promise1, promise2]).then(function (_a) {
  5698. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5699. _this.diff();
  5700. }).catch(function (res) {
  5701. _this.refs.grid1.setLoading(false);
  5702. showErrorDialog$1(res);
  5703. });
  5704. });
  5705. };
  5706. DbSync.prototype.executeDDL = function () {
  5707. var _this = this;
  5708. var code = this.refs.ddleditor.getValue();
  5709. var dataSource2 = this.viewModel.get('dataSource2');
  5710. var target_schema_name = this.viewModel.get('schema2');
  5711. var recordList = this.refs.grid1.getSelection();
  5712. var table_infos = _$2.map(recordList, function (r) {
  5713. return r.get('table_info');
  5714. });
  5715. this.setLoading(true);
  5716. pushToDbCommitApi({
  5717. datasource: dataSource2,
  5718. ddl: code,
  5719. table_infos: table_infos,
  5720. target_schema_name: target_schema_name,
  5721. }).then(function (res) {
  5722. if (res === null || res === void 0 ? void 0 : res.success) {
  5723. msg$1('执行成功');
  5724. _this.back();
  5725. _this.diff();
  5726. return;
  5727. }
  5728. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5729. }).finally(function () {
  5730. _this.setLoading(false);
  5731. });
  5732. };
  5733. DbSync.prototype.executeDDLIdx = function () {
  5734. var _this = this;
  5735. var code = this.refs.ddleditor_idx.getValue();
  5736. var dataSource2 = this.viewModel.get('dataSource2');
  5737. this.setLoading(true);
  5738. executeDDL({
  5739. datasource: dataSource2,
  5740. ddl: code,
  5741. }).then(function (res) {
  5742. if (res === null || res === void 0 ? void 0 : res.success) {
  5743. msg$1('执行成功');
  5744. _this.back();
  5745. return;
  5746. }
  5747. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5748. }).finally(function () {
  5749. _this.setLoading(false);
  5750. });
  5751. };
  5752. DbSync.prototype.executeProcedureSQL = function () {
  5753. var _this = this;
  5754. this.setLoading(true);
  5755. executeModifyProcedureSQL({
  5756. datasource1: this.viewModel.get('dataSource1'),
  5757. datasource2: this.viewModel.get('dataSource2'),
  5758. schema1: this.viewModel.get('schema1'),
  5759. schema2: this.viewModel.get('schema2'),
  5760. }).then(function (res) {
  5761. if (res === null || res === void 0 ? void 0 : res.success) {
  5762. msg$1('执行成功');
  5763. _this.back();
  5764. return;
  5765. }
  5766. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5767. }).finally(function () {
  5768. _this.setLoading(false);
  5769. });
  5770. };
  5771. return DbSync;
  5772. }(Scope));
  5773. //# sourceMappingURL=DbSync.js.map
  5774. var model$2 = {
  5775. data: {}
  5776. };
  5777. //# sourceMappingURL=DbCodeTemplate.model.js.map
  5778. var vjson$2 = {
  5779. title: '示例代码',
  5780. layout: 'fit',
  5781. items: [
  5782. {
  5783. layout: 'border',
  5784. items: [
  5785. {
  5786. region: 'north',
  5787. split: true,
  5788. height: 200,
  5789. title: '表格数据',
  5790. reference: 'dataeditor',
  5791. xtype: 'jsoneditor',
  5792. listeners: {
  5793. change: 'scope.dataChanged'
  5794. },
  5795. },
  5796. {
  5797. region: 'west',
  5798. split: true,
  5799. width: 230,
  5800. title: '模板',
  5801. reference: 'tree1',
  5802. xtype: 'treepanel',
  5803. rootVisible: false,
  5804. useArrows: true,
  5805. colspan: 2,
  5806. lines: true,
  5807. multiSelect: false,
  5808. listeners: {
  5809. itemclick: 'scope.templateChange',
  5810. },
  5811. },
  5812. {
  5813. region: 'center',
  5814. title: '参考代码',
  5815. reference: 'preview',
  5816. xtype: 'jsoneditor',
  5817. },
  5818. ]
  5819. }
  5820. ]
  5821. };
  5822. //# sourceMappingURL=DbCodeTemplate.view.js.map
  5823. var rootNode = {
  5824. id: 'ROOT',
  5825. type: "ROOT",
  5826. path: "",
  5827. expanded: true,
  5828. leaf: false,
  5829. children: [
  5830. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5831. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5832. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5833. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5834. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5835. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5836. ],
  5837. };
  5838. var TemplateDev = /** @class */ (function (_super) {
  5839. __extends(TemplateDev, _super);
  5840. function TemplateDev() {
  5841. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5842. _this.dataChanged = _$2.debounce(function () {
  5843. var me = _this;
  5844. if (me.refs.tree1.selection) {
  5845. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5846. }
  5847. }, 50);
  5848. return _this;
  5849. }
  5850. TemplateDev.prototype.onDestroy = function () {
  5851. setDbCode(undefined);
  5852. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5853. };
  5854. TemplateDev.prototype.onLoad = function () {
  5855. setDbCode(this);
  5856. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5857. this.refs.tree1.setRootNode(rootNode);
  5858. getColumnDomainApi({}).then(function (_a) {
  5859. var data = _a.data;
  5860. return window['dev_column_domain'] = data;
  5861. });
  5862. };
  5863. TemplateDev.prototype.dbTreeNodeChange = function () {
  5864. var me = handles$1.dbcode;
  5865. var tables = [];
  5866. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5867. var raw = _$2.cloneDeep(r.get('raw'));
  5868. raw.id = r.get('id');
  5869. if (r.get('type') === 'table') {
  5870. tables.push(raw);
  5871. return;
  5872. }
  5873. if (r.get('type') === 'column') {
  5874. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5875. if (!tableInfo) {
  5876. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5877. tables.push(tableInfo);
  5878. }
  5879. if (!tableInfo.column_list) {
  5880. tableInfo.column_list = [raw];
  5881. }
  5882. else {
  5883. tableInfo.column_list.push(raw);
  5884. }
  5885. }
  5886. });
  5887. // 对于没有选择列的表格,默认加上所有列
  5888. _$2.forEach(tables, function (tableInfo) {
  5889. if (typeof tableInfo.column_list === 'undefined') {
  5890. tableInfo.column_list = [];
  5891. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5892. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5893. });
  5894. }
  5895. });
  5896. var code = JSON.stringify(tables, null, ' ');
  5897. me.refs.dataeditor.setCode(code);
  5898. };
  5899. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5900. var url = record.data.url;
  5901. var rd = _$2.uniqueId('db_code_request');
  5902. if (url) {
  5903. var data = void 0;
  5904. try {
  5905. data = JSON.parse(this.refs.dataeditor.getCode());
  5906. }
  5907. catch (e) {
  5908. return;
  5909. }
  5910. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5911. // if (typeof node.default === "function") {
  5912. // const v = toString(node.default(data))
  5913. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5914. // this.refs.preview.setLanguage("plaintext")
  5915. // this.refs.preview.setCode(v)
  5916. // }
  5917. // })
  5918. showErrorDialog$1('没做这里');
  5919. }
  5920. };
  5921. return TemplateDev;
  5922. }(Scope));
  5923. //# sourceMappingURL=DbCodeTemplate.js.map
  5924. var model$3 = {
  5925. data: {
  5926. hasChanged: false,
  5927. }
  5928. };
  5929. //# sourceMappingURL=DbDomain.model.js.map
  5930. var vjson$3 = {
  5931. bind: {
  5932. title: '字段域{grid1.ischanged?" *":""}',
  5933. },
  5934. layout: 'fit',
  5935. items: [
  5936. {
  5937. layout: 'border',
  5938. items: [
  5939. {
  5940. region: 'center',
  5941. xtype: 'yvgrid',
  5942. selModel: {
  5943. type: 'spreadsheet',
  5944. columnSelect: true,
  5945. pruneRemoved: false,
  5946. extensible: 'y'
  5947. },
  5948. plugins: {
  5949. clipboard: true,
  5950. selectionreplicator: true
  5951. },
  5952. reference: 'grid1',
  5953. pagination: false,
  5954. tbar: {
  5955. xtype: 'toolbar',
  5956. items: [
  5957. {
  5958. xtype: 'button',
  5959. text: '添加',
  5960. iconCls: 'x-fa fa-plus-circle',
  5961. listeners: {
  5962. click: 'scope.addField'
  5963. }
  5964. },
  5965. {
  5966. xtype: 'button',
  5967. text: '删除',
  5968. iconCls: 'x-fa fa-minus-circle',
  5969. listeners: {
  5970. click: 'scope.removeField'
  5971. }
  5972. },
  5973. {
  5974. xtype: 'button',
  5975. text: '保存',
  5976. iconCls: 'x-fa fa-save',
  5977. bind: {
  5978. disabled: '{!grid1.ischanged}'
  5979. },
  5980. listeners: {
  5981. click: 'scope.save'
  5982. }
  5983. },
  5984. ]
  5985. },
  5986. listeners: {
  5987. editfinish: 'scope.gridEditFinish',
  5988. },
  5989. columns: [
  5990. {
  5991. text: '字段域名称', dataIndex: 'domain_name',
  5992. sortable: false,
  5993. menuDisabled: true,
  5994. locked: true,
  5995. editor: {
  5996. selectOnFocus: true
  5997. }
  5998. },
  5999. {
  6000. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  6001. sortable: false, menuDisabled: true,
  6002. editor: {
  6003. selectOnFocus: true
  6004. }
  6005. },
  6006. {
  6007. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  6008. sortable: false, menuDisabled: true,
  6009. editor: {
  6010. selectOnFocus: true
  6011. }
  6012. },
  6013. {
  6014. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  6015. sortable: false, menuDisabled: true,
  6016. editor: {
  6017. selectOnFocus: true
  6018. }
  6019. },
  6020. {
  6021. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  6022. sortable: false, menuDisabled: true,
  6023. editor: {
  6024. selectOnFocus: true
  6025. }
  6026. },
  6027. {
  6028. text: 'Java类型', dataIndex: 'java_datatype',
  6029. sortable: false, menuDisabled: true,
  6030. editor: {
  6031. selectOnFocus: true
  6032. }
  6033. },
  6034. {
  6035. text: '固定长度', dataIndex: 'is_fix_size',
  6036. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6037. width: 88, resizable: false,
  6038. },
  6039. {
  6040. text: '长度', dataIndex: 'column_size',
  6041. sortable: false, menuDisabled: true, dataType: 'int',
  6042. xtype: 'numbercolumn', format: '0',
  6043. editor: { selectOnFocus: true }
  6044. },
  6045. {
  6046. text: '小数位', dataIndex: 'decimal_digits',
  6047. sortable: false, menuDisabled: true, dataType: 'int',
  6048. xtype: 'numbercolumn', format: '0',
  6049. editor: { selectOnFocus: true }
  6050. },
  6051. {
  6052. text: '字典', dataIndex: 'domain_column_dict',
  6053. sortable: false, menuDisabled: true,
  6054. // fix: ['system.getDict("DICT")'],
  6055. width: 200,
  6056. editor: {
  6057. xtype: 'combo',
  6058. listConfig: {
  6059. minWidth: 350
  6060. },
  6061. }
  6062. },
  6063. {
  6064. text: '固定默认值', dataIndex: 'is_fix_default_value',
  6065. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6066. width: 88, resizable: false,
  6067. },
  6068. {
  6069. text: '默认值', dataIndex: 'default_value',
  6070. sortable: false, menuDisabled: true,
  6071. editor: {
  6072. selectOnFocus: true
  6073. }
  6074. },
  6075. {
  6076. text: 'UI建议', dataIndex: 'domain_column_ui',
  6077. sortable: false, menuDisabled: true,
  6078. // fix: ['system.getDict("column_ui")'],
  6079. editor: {
  6080. xtype: 'combo',
  6081. allowBlank: true,
  6082. listConfig: {
  6083. minWidth: 200
  6084. },
  6085. }
  6086. },
  6087. {
  6088. text: '详细描述', dataIndex: 'domain_note',
  6089. sortable: false, menuDisabled: true,
  6090. editor: {}
  6091. },
  6092. {
  6093. text: '责任人', dataIndex: 'domain_person',
  6094. sortable: false, menuDisabled: true,
  6095. editor: {
  6096. selectOnFocus: true
  6097. }
  6098. },
  6099. {
  6100. text: '版本', dataIndex: 'domain_version',
  6101. sortable: false, menuDisabled: true,
  6102. editor: {
  6103. selectOnFocus: true
  6104. }
  6105. },
  6106. ]
  6107. }
  6108. ]
  6109. },
  6110. ]
  6111. };
  6112. //# sourceMappingURL=DbDomain.view.js.map
  6113. var CacheStore = /** @class */ (function () {
  6114. function CacheStore() {
  6115. // 订阅
  6116. this.subscribeList = [];
  6117. this.apiResponse = undefined;
  6118. }
  6119. /**
  6120. * 订阅结果集
  6121. */
  6122. CacheStore.prototype.registe = function (fn) {
  6123. this.subscribeList.push(fn);
  6124. };
  6125. /**
  6126. * 取消订阅
  6127. */
  6128. CacheStore.prototype.unregiste = function (fn) {
  6129. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  6130. };
  6131. /**
  6132. * 尝试取数据(先读缓存)
  6133. */
  6134. CacheStore.prototype.reloadIfNeed = function (param) {
  6135. var _this = this;
  6136. if (typeof this.apiResponse === 'undefined') {
  6137. // 从未有获取过值
  6138. var cacheKey = this.getCacheKey(param);
  6139. if (cacheKey) {
  6140. // 可以从缓存读
  6141. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6142. native.loadFile(fileName, function (res) {
  6143. if (res) {
  6144. // 缓存有值
  6145. _this.apiResponse = res;
  6146. _this.notifyRefresh();
  6147. }
  6148. else {
  6149. // 缓存没值
  6150. _this.reloadForce(param).then(function (res) {
  6151. });
  6152. }
  6153. });
  6154. }
  6155. else {
  6156. // 不能从缓存读
  6157. this.reloadForce(param).then(function (res) {
  6158. });
  6159. }
  6160. return true;
  6161. }
  6162. return false;
  6163. };
  6164. /**
  6165. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  6166. */
  6167. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  6168. var _this = this;
  6169. return new Promise(function (resolve, reject) {
  6170. if (typeof _this.apiResponse === 'undefined') {
  6171. // 从未有获取过值
  6172. var cacheKey = _this.getCacheKey(param);
  6173. if (cacheKey) {
  6174. // 可以从缓存读
  6175. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6176. native.loadFile(fileName, function (res) {
  6177. if (res) {
  6178. // 缓存有值
  6179. _this.apiResponse = res;
  6180. _this.notifyRefresh();
  6181. resolve(_this.apiResponse);
  6182. }
  6183. else {
  6184. // 缓存没值
  6185. _this.reloadForce(param).then(function (res) {
  6186. resolve(_this.apiResponse);
  6187. });
  6188. }
  6189. });
  6190. }
  6191. else {
  6192. // 不能从缓存读
  6193. _this.reloadForce(param).then(function (res) {
  6194. resolve(_this.apiResponse);
  6195. });
  6196. }
  6197. }
  6198. else {
  6199. // 有值,获取过
  6200. resolve(_this.apiResponse);
  6201. }
  6202. });
  6203. };
  6204. /**
  6205. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6206. */
  6207. CacheStore.prototype.reloadForce = function (param) {
  6208. var _this = this;
  6209. _$2.forEach(this.subscribeList, function (fn) {
  6210. fn(true);
  6211. });
  6212. return this.invokeApi(param)
  6213. .then(function (res) {
  6214. _this.apiResponse = res;
  6215. var cacheKey = _this.getCacheKey(param);
  6216. if (cacheKey) {
  6217. // 可以保存到缓存
  6218. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  6219. native.saveFile(fileName, res);
  6220. }
  6221. // 通知订阅者刷新
  6222. _this.notifyRefresh();
  6223. })
  6224. .finally(function () {
  6225. _$2.forEach(_this.subscribeList, function (fn) {
  6226. fn(false);
  6227. });
  6228. });
  6229. };
  6230. /**
  6231. * 通知组件,isLoading状态被更改
  6232. */
  6233. CacheStore.prototype.notifyLoading = function (isLoading) {
  6234. var _this = this;
  6235. _$2.forEach(this.subscribeList, function (fn) {
  6236. fn(_this.apiResponse);
  6237. });
  6238. };
  6239. /**
  6240. * 通知数据更改,需要刷新
  6241. */
  6242. CacheStore.prototype.notifyRefresh = function () {
  6243. var _this = this;
  6244. _$2.forEach(this.subscribeList, function (fn) {
  6245. fn(_this.apiResponse);
  6246. });
  6247. };
  6248. return CacheStore;
  6249. }());
  6250. //# sourceMappingURL=CacheStore.js.map
  6251. // 字段域数据
  6252. var columnDomain = undefined;
  6253. var DomainStore = /** @class */ (function (_super) {
  6254. __extends(DomainStore, _super);
  6255. function DomainStore() {
  6256. return _super !== null && _super.apply(this, arguments) || this;
  6257. }
  6258. DomainStore.prototype.getCacheKey = function (param) {
  6259. return "domain_data.json";
  6260. };
  6261. DomainStore.prototype.invokeApi = function (param) {
  6262. return getColumnDomainApi();
  6263. };
  6264. /**
  6265. * 设置全局可访问的 字段域数据
  6266. */
  6267. DomainStore.prototype.getColumnDomainComboData = function () {
  6268. var _this = this;
  6269. return new Promise(function (resolve) {
  6270. _this.reloadIfNeedPromise(undefined).then(function (res) {
  6271. resolve(_this.apiResponse.data.map(function (v) {
  6272. return { id: v.domain_id, text: v.domain_name };
  6273. }));
  6274. });
  6275. });
  6276. };
  6277. /**
  6278. * 设置全局可访问的 字段域数据
  6279. */
  6280. DomainStore.prototype.getColumnDomainById = function (value) {
  6281. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  6282. };
  6283. DomainStore.prototype.getAllDomain = function () {
  6284. return new Promise(function (resolve, reject) {
  6285. getColumnDomainApi()
  6286. .then(function (res) {
  6287. if (res.success) {
  6288. columnDomain = res.data;
  6289. resolve(res.data);
  6290. }
  6291. else {
  6292. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  6293. console.error('getColumnDomain', res.msg);
  6294. }
  6295. })
  6296. .catch(function (e) {
  6297. window['showErrorDialog']('getColumnDomain error!');
  6298. console.error('getColumnDomain', e);
  6299. reject(e);
  6300. });
  6301. });
  6302. };
  6303. return DomainStore;
  6304. }(CacheStore));
  6305. var instance = new DomainStore();
  6306. //# sourceMappingURL=DomainStore.js.map
  6307. var DbDomain = /** @class */ (function (_super) {
  6308. __extends(DbDomain, _super);
  6309. function DbDomain() {
  6310. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  6311. }
  6312. DbDomain.prototype.onLoad = function () {
  6313. var _this = this;
  6314. instance.getAllDomain().then(function (data) {
  6315. _this.refs.grid1.setData(data);
  6316. });
  6317. };
  6318. DbDomain.prototype.gridEditFinish = function () {
  6319. this.viewModel.set('hasChanged', true);
  6320. };
  6321. DbDomain.prototype.addField = function () {
  6322. this.refs.grid1.appendEditRow({
  6323. domainName: '',
  6324. pgSqlDataType: '',
  6325. mysqlDataType: '',
  6326. oracleDataType: '',
  6327. sqlserverDataType: '',
  6328. javaDataType: '',
  6329. isFixSize: true,
  6330. size: '',
  6331. decimalDigits: '',
  6332. isFixDefaultValue: false,
  6333. defaultValue: null,
  6334. domainColumnDict: '',
  6335. domainColumnUI: '',
  6336. note: '',
  6337. domainPerson: '',
  6338. domainVersion: '',
  6339. }, 0);
  6340. };
  6341. DbDomain.prototype.removeField = function () {
  6342. var _this = this;
  6343. var rows = [];
  6344. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6345. rows.push(r);
  6346. });
  6347. _.forEach(rows, function (r) {
  6348. _this.refs.grid1.getStore().remove(r);
  6349. });
  6350. };
  6351. DbDomain.prototype.save = function () {
  6352. var _this = this;
  6353. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  6354. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  6355. if (err) {
  6356. // 如果有异常就不保存
  6357. return;
  6358. }
  6359. // 进行业务上的逻辑校验,比如说必填校验等等
  6360. var hasError = false;
  6361. _.forEach(rows, function (row, i) {
  6362. if (isEmpty(row.domain_name)) {
  6363. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  6364. hasError = true;
  6365. return false;
  6366. }
  6367. if (isEmpty(row.pgsql_datatype) ||
  6368. isEmpty(row.mysql_datatype) ||
  6369. isEmpty(row.oracle_datatype) ||
  6370. isEmpty(row.sqlserver_datatype)) {
  6371. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  6372. hasError = true;
  6373. return false;
  6374. }
  6375. });
  6376. if (hasError) {
  6377. return;
  6378. }
  6379. // 设置当前界面为 "保存中..." 状态
  6380. this.setLoading(true);
  6381. saveColumnDomain({
  6382. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6383. newRows: newRows,
  6384. modifyRows: modifyRows,
  6385. removeRecords: removeRecords,
  6386. }).then(function (res) {
  6387. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6388. system.msg(res.msg);
  6389. instance.reloadForce({}).then(function () {
  6390. instance.getAllDomain().then(function (data) {
  6391. _this.refs.grid1.setData(data);
  6392. });
  6393. }).finally(function () {
  6394. // 无论正常异常,关闭 "保存中..." 状态
  6395. _this.setLoading(false);
  6396. });
  6397. }).catch(function (e) {
  6398. // 无论正常异常,关闭 "保存中..." 状态
  6399. _this.setLoading(false);
  6400. });
  6401. };
  6402. return DbDomain;
  6403. }(Scope));
  6404. //# sourceMappingURL=DbDomain.js.map
  6405. var model$4 = {
  6406. data: {
  6407. report_id: '',
  6408. report_name: '',
  6409. report_enable: false,
  6410. report: {
  6411. dataSource: '',
  6412. grid: {
  6413. pagination: true,
  6414. },
  6415. query: [],
  6416. columns: [],
  6417. summary: [],
  6418. },
  6419. querySql: '',
  6420. summarySql: '',
  6421. createAt: '',
  6422. createBy: '',
  6423. updateAt: '',
  6424. updateBy: '',
  6425. }
  6426. };
  6427. //# sourceMappingURL=ReportDesign.model.js.map
  6428. var vjson$4 = {
  6429. bind: {
  6430. title: '报表-{report_name}',
  6431. },
  6432. layout: 'fit',
  6433. items: [
  6434. {
  6435. layout: 'border',
  6436. items: [
  6437. {
  6438. region: 'north',
  6439. items: [
  6440. {
  6441. xtype: 'toolbar',
  6442. border: false,
  6443. items: [
  6444. {
  6445. xtype: 'button',
  6446. text: '刷新',
  6447. iconCls: 'x-fa fa-refresh',
  6448. listeners: {
  6449. click: 'scope.load'
  6450. }
  6451. },
  6452. {
  6453. xtype: 'button',
  6454. text: '保存',
  6455. iconCls: 'x-fa fa-save',
  6456. listeners: {
  6457. click: 'scope.save'
  6458. }
  6459. },
  6460. {
  6461. xtype: 'button',
  6462. text: '预览',
  6463. iconCls: 'x-fa fa-play-circle-o',
  6464. listeners: {
  6465. click: 'scope.preview'
  6466. }
  6467. },
  6468. {
  6469. xtype: 'textfield',
  6470. fieldLabel: '报表名称',
  6471. flex: 1,
  6472. bind: {
  6473. value: '{report_name}'
  6474. }
  6475. },
  6476. {
  6477. xtype: 'checkbox',
  6478. fieldLabel: '启用报表',
  6479. checkedValue: 1,
  6480. uncheckedValue: 0,
  6481. bind: {
  6482. value: '{report_enable}'
  6483. }
  6484. },
  6485. {
  6486. xtype: 'checkbox',
  6487. fieldLabel: '启用分页',
  6488. bind: {
  6489. value: '{report.grid.pagination}'
  6490. }
  6491. },
  6492. {
  6493. xtype: 'textfield',
  6494. fieldLabel: '数据源',
  6495. flex: 1,
  6496. bind: {
  6497. value: '{report.dataSource}'
  6498. }
  6499. },
  6500. ]
  6501. }
  6502. ]
  6503. },
  6504. {
  6505. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6506. items: [
  6507. {
  6508. title: 'SQL和查询条件',
  6509. layout: 'border',
  6510. border: false,
  6511. items: [
  6512. {
  6513. region: 'north',
  6514. height: 200,
  6515. border: false,
  6516. split: true,
  6517. xtype: 'yvgrid',
  6518. reference: 'gridCondition',
  6519. pagination: false,
  6520. hideFootbar: true,
  6521. plugins: {
  6522. clipboard: true,
  6523. selectionreplicator: true
  6524. },
  6525. selModel: {
  6526. type: 'spreadsheet',
  6527. columnSelect: false,
  6528. pruneRemoved: false,
  6529. extensible: 'y'
  6530. },
  6531. tbar: {
  6532. xtype: 'toolbar',
  6533. border: false,
  6534. items: [
  6535. {
  6536. xtype: 'button',
  6537. text: '添加条件',
  6538. iconCls: 'x-fa fa-plus-circle',
  6539. listeners: {
  6540. click: 'scope.addCondition'
  6541. }
  6542. },
  6543. {
  6544. xtype: 'button',
  6545. text: '删除条件',
  6546. iconCls: 'x-fa fa-minus-circle',
  6547. listeners: {
  6548. click: 'scope.removeCondition'
  6549. }
  6550. },
  6551. '-',
  6552. {
  6553. xtype: 'button',
  6554. text: '自动分析条件变量',
  6555. iconCls: 'x-fa fa-code-fork',
  6556. listeners: {
  6557. click: 'scope.calcCondition'
  6558. }
  6559. },
  6560. {
  6561. xtype: 'button',
  6562. text: '上移',
  6563. iconCls: 'x-fa fa-arrow-up',
  6564. listeners: {
  6565. click: 'scope.moveUp'
  6566. }
  6567. },
  6568. {
  6569. xtype: 'button',
  6570. text: '下移',
  6571. iconCls: 'x-fa fa-arrow-down',
  6572. listeners: {
  6573. click: 'scope.moveDown'
  6574. }
  6575. },
  6576. ]
  6577. },
  6578. columns: [
  6579. {
  6580. text: '条件变量',
  6581. dataIndex: 'conditionFieldBind',
  6582. width: 140,
  6583. sortable: false,
  6584. menuDisabled: true,
  6585. editor: {
  6586. selectOnFocus: true
  6587. },
  6588. },
  6589. {
  6590. text: '中文标题',
  6591. dataIndex: 'conditionFieldLabel',
  6592. width: 120,
  6593. sortable: false,
  6594. menuDisabled: true,
  6595. editor: {
  6596. selectOnFocus: true
  6597. },
  6598. },
  6599. {
  6600. text: '编辑类型',
  6601. dataIndex: 'conditionFieldXtype',
  6602. width: 80,
  6603. sortable: false,
  6604. menuDisabled: true,
  6605. editor: {
  6606. xtype: 'combo',
  6607. typeAhead: true,
  6608. triggerAction: 'all',
  6609. selectOnFocus: true,
  6610. store: [
  6611. ['textfield', 'textfield'],
  6612. ['combo', 'combo'],
  6613. ['datefield', 'datefield'],
  6614. ['datetimefield', 'datetimefield'],
  6615. ['numberfield', 'numberfield'],
  6616. ['multiplesearch', 'multiplesearch'],
  6617. ]
  6618. }
  6619. },
  6620. {
  6621. text: '权重',
  6622. dataIndex: 'conditionFieldFlex',
  6623. align: 'right',
  6624. width: 60,
  6625. sortable: false,
  6626. menuDisabled: true,
  6627. editor: {
  6628. xtype: 'numberfield',
  6629. selectOnFocus: false,
  6630. minValue: 0,
  6631. maxValue: 10
  6632. },
  6633. },
  6634. {
  6635. text: '字典',
  6636. dataIndex: 'conditionFieldDict',
  6637. width: 160,
  6638. sortable: false,
  6639. menuDisabled: true,
  6640. editor: {
  6641. selectOnFocus: false
  6642. },
  6643. },
  6644. {
  6645. xtype: 'checkcolumn',
  6646. dataIndex: "conditionFieldWrap", header: "换行",
  6647. width: 65,
  6648. sortable: false,
  6649. menuDisabled: true,
  6650. },
  6651. {
  6652. text: '扩展参数',
  6653. dataIndex: 'conditionFieldExtend',
  6654. sortable: false,
  6655. menuDisabled: true,
  6656. editor: {
  6657. selectOnFocus: false
  6658. },
  6659. },
  6660. ]
  6661. },
  6662. {
  6663. region: 'center',
  6664. xtype: 'sqleditor',
  6665. layout: 'fit',
  6666. reference: 'sqlEditor',
  6667. split: true,
  6668. },
  6669. ]
  6670. },
  6671. {
  6672. title: '查询结果字段',
  6673. xtype: 'yvgrid',
  6674. reference: 'gridColumn',
  6675. pagination: false,
  6676. hideFootbar: true,
  6677. border: false,
  6678. plugins: {
  6679. clipboard: true,
  6680. selectionreplicator: true
  6681. },
  6682. selModel: {
  6683. type: 'spreadsheet',
  6684. columnSelect: false,
  6685. pruneRemoved: false,
  6686. extensible: 'y'
  6687. },
  6688. tbar: {
  6689. xtype: 'toolbar',
  6690. items: [
  6691. {
  6692. xtype: 'button',
  6693. text: '添加',
  6694. iconCls: 'x-fa fa-plus-circle',
  6695. listeners: {
  6696. click: 'scope.addColumn'
  6697. }
  6698. },
  6699. {
  6700. xtype: 'button',
  6701. text: '删除',
  6702. iconCls: 'x-fa fa-minus-circle',
  6703. listeners: {
  6704. click: 'scope.removeColumn'
  6705. }
  6706. },
  6707. '-',
  6708. {
  6709. xtype: 'button',
  6710. text: '自动分析',
  6711. iconCls: 'x-fa fa-code-fork',
  6712. listeners: {
  6713. click: 'scope.calcColumn'
  6714. }
  6715. },
  6716. {
  6717. xtype: 'button',
  6718. text: '上移',
  6719. iconCls: 'x-fa fa-arrow-up',
  6720. listeners: {
  6721. click: 'scope.moveUp'
  6722. }
  6723. },
  6724. {
  6725. xtype: 'button',
  6726. text: '下移',
  6727. iconCls: 'x-fa fa-arrow-down',
  6728. listeners: {
  6729. click: 'scope.moveDown'
  6730. }
  6731. },
  6732. ]
  6733. },
  6734. columns: [
  6735. { xtype: 'rownumberer' },
  6736. {
  6737. text: '字段',
  6738. dataIndex: 'dataIndex',
  6739. width: 140,
  6740. sortable: false,
  6741. menuDisabled: true,
  6742. editor: {
  6743. selectOnFocus: true
  6744. },
  6745. },
  6746. {
  6747. text: '标题',
  6748. dataIndex: 'header',
  6749. width: 120,
  6750. sortable: false,
  6751. menuDisabled: true,
  6752. editor: {
  6753. selectOnFocus: true
  6754. },
  6755. },
  6756. {
  6757. text: '显示类型',
  6758. dataIndex: 'xtype',
  6759. width: 90,
  6760. sortable: false,
  6761. menuDisabled: true,
  6762. editor: {
  6763. xtype: 'combo',
  6764. typeAhead: true,
  6765. triggerAction: 'all',
  6766. selectOnFocus: true,
  6767. store: [
  6768. ['', ''],
  6769. ['rownum', 'rownum'],
  6770. ['button', 'button'],
  6771. ['checkbox', 'checkbox'],
  6772. ['progres', 'progres'],
  6773. ]
  6774. }
  6775. },
  6776. {
  6777. text: '数据类型',
  6778. dataIndex: 'dataType',
  6779. width: 90,
  6780. sortable: false,
  6781. menuDisabled: true,
  6782. editor: {
  6783. xtype: 'combo',
  6784. typeAhead: true,
  6785. triggerAction: 'all',
  6786. selectOnFocus: true,
  6787. store: [
  6788. ['', ''],
  6789. ['string', 'string'],
  6790. ['number', 'number'],
  6791. ['date', 'date'],
  6792. ]
  6793. }
  6794. },
  6795. {
  6796. text: '宽度',
  6797. dataIndex: 'width',
  6798. align: 'right',
  6799. width: 60,
  6800. sortable: false,
  6801. menuDisabled: true,
  6802. editor: {
  6803. xtype: 'numberfield',
  6804. selectOnFocus: true,
  6805. minValue: 0,
  6806. maxValue: 1000
  6807. },
  6808. },
  6809. {
  6810. text: '权重',
  6811. dataIndex: 'flex',
  6812. align: 'right',
  6813. width: 60,
  6814. sortable: false,
  6815. menuDisabled: true,
  6816. editor: {
  6817. xtype: 'numberfield',
  6818. selectOnFocus: true,
  6819. minValue: 0,
  6820. maxValue: 10
  6821. },
  6822. },
  6823. {
  6824. text: '字典',
  6825. dataIndex: 'dict',
  6826. sortable: false,
  6827. menuDisabled: true,
  6828. width: 120,
  6829. editor: {
  6830. selectOnFocus: true,
  6831. },
  6832. },
  6833. {
  6834. text: '对齐',
  6835. dataIndex: 'align',
  6836. width: 60,
  6837. sortable: false,
  6838. menuDisabled: true,
  6839. editor: {
  6840. xtype: 'combo',
  6841. typeAhead: true,
  6842. triggerAction: 'all',
  6843. selectOnFocus: false,
  6844. store: [
  6845. ['', ''],
  6846. ['start', 'start'],
  6847. ['center', 'center'],
  6848. ['end', 'end'],
  6849. ]
  6850. },
  6851. },
  6852. {
  6853. text: '过滤',
  6854. dataIndex: 'filterable',
  6855. xtype: 'checkcolumn',
  6856. width: 50,
  6857. resizable: false,
  6858. sortable: false,
  6859. menuDisabled: true,
  6860. },
  6861. {
  6862. text: '隐藏',
  6863. dataIndex: 'hidden',
  6864. xtype: 'checkcolumn',
  6865. width: 50,
  6866. resizable: false,
  6867. sortable: false,
  6868. menuDisabled: true,
  6869. },
  6870. {
  6871. text: '排序',
  6872. dataIndex: 'sortable',
  6873. xtype: 'checkcolumn',
  6874. width: 50,
  6875. resizable: false,
  6876. sortable: false,
  6877. menuDisabled: true,
  6878. },
  6879. {
  6880. text: '扩展参数',
  6881. dataIndex: 'fieldExtend',
  6882. sortable: false,
  6883. menuDisabled: true,
  6884. editor: {
  6885. selectOnFocus: false
  6886. },
  6887. },
  6888. ],
  6889. },
  6890. {
  6891. title: '汇总和汇总逻辑',
  6892. layout: 'border',
  6893. border: false,
  6894. items: [
  6895. {
  6896. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6897. reference: 'gridSum',
  6898. pagination: false,
  6899. hideFootbar: true,
  6900. height: 200,
  6901. split: true,
  6902. border: false,
  6903. plugins: {
  6904. clipboard: true,
  6905. selectionreplicator: true
  6906. },
  6907. selModel: {
  6908. type: 'spreadsheet',
  6909. columnSelect: false,
  6910. pruneRemoved: false,
  6911. extensible: 'y'
  6912. },
  6913. tbar: {
  6914. xtype: 'toolbar',
  6915. border: false,
  6916. items: [
  6917. {
  6918. xtype: 'button',
  6919. text: '添加',
  6920. iconCls: 'x-fa fa-plus-circle',
  6921. listeners: {
  6922. click: 'scope.addSum'
  6923. }
  6924. },
  6925. {
  6926. xtype: 'button',
  6927. text: '删除',
  6928. iconCls: 'x-fa fa-minus-circle',
  6929. listeners: {
  6930. click: 'scope.removeSum'
  6931. }
  6932. },
  6933. '-',
  6934. {
  6935. xtype: 'button',
  6936. text: '自动分析',
  6937. iconCls: 'x-fa fa-code-fork',
  6938. listeners: {
  6939. click: 'scope.calcSum'
  6940. }
  6941. },
  6942. {
  6943. xtype: 'button',
  6944. text: '上移',
  6945. iconCls: 'x-fa fa-arrow-up',
  6946. listeners: {
  6947. click: 'scope.moveUp'
  6948. }
  6949. },
  6950. {
  6951. xtype: 'button',
  6952. text: '下移',
  6953. iconCls: 'x-fa fa-arrow-down',
  6954. listeners: {
  6955. click: 'scope.moveDown'
  6956. }
  6957. },
  6958. ]
  6959. },
  6960. columns: [
  6961. {
  6962. text: '字段名',
  6963. dataIndex: 'sumFieldBind',
  6964. width: 140,
  6965. sortable: false,
  6966. menuDisabled: true,
  6967. editor: {
  6968. selectOnFocus: true
  6969. },
  6970. },
  6971. {
  6972. text: '标题',
  6973. dataIndex: 'sumFieldLabel',
  6974. width: 120,
  6975. sortable: false,
  6976. menuDisabled: true,
  6977. editor: {
  6978. selectOnFocus: true
  6979. },
  6980. },
  6981. {
  6982. text: '权重',
  6983. dataIndex: 'sumFieldFlex',
  6984. align: 'right',
  6985. width: 60,
  6986. sortable: false,
  6987. menuDisabled: true,
  6988. editor: {
  6989. xtype: 'numberfield',
  6990. selectOnFocus: false,
  6991. allowBlank: true,
  6992. minValue: 0,
  6993. maxValue: 10
  6994. },
  6995. },
  6996. {
  6997. xtype: 'checkcolumn',
  6998. dataIndex: "sumFieldWrap", header: "换行",
  6999. sortable: false,
  7000. menuDisabled: true,
  7001. width: 65,
  7002. },
  7003. {
  7004. text: '扩展参数',
  7005. dataIndex: 'sumFieldExtend',
  7006. sortable: false,
  7007. menuDisabled: true,
  7008. editor: {
  7009. selectOnFocus: false
  7010. },
  7011. },
  7012. ]
  7013. },
  7014. {
  7015. region: 'center',
  7016. xtype: 'sqleditor',
  7017. layout: 'fit',
  7018. reference: 'sqlSumEditor',
  7019. },
  7020. ]
  7021. },
  7022. ]
  7023. }
  7024. ]
  7025. }
  7026. ]
  7027. }; //
  7028. //
  7029. //# sourceMappingURL=ReportDesign.view.js.map
  7030. var DbStore = /** @class */ (function (_super) {
  7031. __extends(DbStore, _super);
  7032. function DbStore() {
  7033. return _super !== null && _super.apply(this, arguments) || this;
  7034. }
  7035. DbStore.prototype.getCacheKey = function (param) {
  7036. return "db_data.json";
  7037. };
  7038. DbStore.prototype.invokeApi = function (param) {
  7039. return getMateData(param);
  7040. };
  7041. /**
  7042. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  7043. */
  7044. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  7045. return new Promise(function (resolve, reject) {
  7046. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  7047. resolve(res1);
  7048. // TODO 好像不需要,先跳过
  7049. // reloadByTableName(schema_name, table_name).then(res2 => {
  7050. // resolve(res1)
  7051. // }).catch(e => {
  7052. // reject(e)
  7053. // })
  7054. }).catch(function (e) {
  7055. reject(e);
  7056. });
  7057. });
  7058. };
  7059. /**
  7060. * 保存元数据至表格
  7061. */
  7062. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  7063. var _this = this;
  7064. return new Promise(function (resolve, reject) {
  7065. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  7066. // 保存后重新刷新
  7067. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  7068. resolve({
  7069. data: res2,
  7070. msg: res1.msg
  7071. });
  7072. }).catch(function (e) {
  7073. reject(e);
  7074. });
  7075. }).catch(function (e) {
  7076. reject(e);
  7077. });
  7078. });
  7079. };
  7080. /**
  7081. * 预览生成的 DDL 语句
  7082. */
  7083. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  7084. return new Promise(function (resolve, reject) {
  7085. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  7086. .then(function (res) {
  7087. resolve(res);
  7088. });
  7089. });
  7090. };
  7091. /**
  7092. * 执行 DDL
  7093. */
  7094. DbStore.prototype.pushToDbCommit = function (arg) {
  7095. return new Promise(function (resolve, reject) {
  7096. pushToDbCommitApi(arg).then(function (res) {
  7097. resolve(res);
  7098. }).catch(function (e) {
  7099. reject(e);
  7100. });
  7101. });
  7102. };
  7103. /**
  7104. * 重读某一个表格的 meta 元数据
  7105. */
  7106. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  7107. var _this = this;
  7108. return new Promise(function (resolve, reject) {
  7109. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  7110. if (!res[0] || !res[0].table_list[0]) {
  7111. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  7112. return;
  7113. }
  7114. var tableRow = _this.getTableByName(schema_name, table_name);
  7115. if (!tableRow) {
  7116. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  7117. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  7118. if (!schemaRow) {
  7119. showErrorDialog$1('没有找到 schema:' + schema_name);
  7120. return;
  7121. }
  7122. schemaRow.table_list.push(res[0].table_list[0]);
  7123. }
  7124. else {
  7125. // 找到了目标表格,就吧 table 所有属性都赋值过去
  7126. Object.assign(tableRow, res[0].table_list[0]);
  7127. }
  7128. // 所有界面通知一遍刷新
  7129. _this.notifyRefresh();
  7130. resolve(res);
  7131. }).catch(function (e) {
  7132. reject(e);
  7133. });
  7134. });
  7135. };
  7136. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  7137. var result = undefined;
  7138. _$2.forEach(this.apiResponse, function (schemaRow) {
  7139. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  7140. if (tableRow) {
  7141. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  7142. if (columnRow) {
  7143. result = columnRow;
  7144. return false;
  7145. }
  7146. }
  7147. });
  7148. return result;
  7149. };
  7150. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  7151. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  7152. if (!schemaRow) {
  7153. showErrorDialog$1('没有找到 schema:' + schemaName);
  7154. return;
  7155. }
  7156. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  7157. if (!schemaRow) {
  7158. showErrorDialog$1('没有找到 table:' + tableName);
  7159. return;
  7160. }
  7161. return tableRow;
  7162. };
  7163. /**
  7164. * 添加一个新表格
  7165. */
  7166. DbStore.prototype.appendNewTable = function (tableInfo) {
  7167. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  7168. if (!schemaRow) {
  7169. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  7170. return;
  7171. }
  7172. schemaRow.table_list.push(tableInfo);
  7173. };
  7174. /**
  7175. * 从数据库结构重新生成元数据
  7176. */
  7177. DbStore.prototype.dbToMetaAndReload = function () {
  7178. var _this = this;
  7179. this.notifyLoading(true);
  7180. dbToMeta().then(function () {
  7181. _this.reloadForce(undefined);
  7182. }).catch(function (e) {
  7183. _this.notifyLoading(false);
  7184. });
  7185. };
  7186. DbStore.prototype.getSchemaDbType = function (schemaName) {
  7187. var dbType = undefined;
  7188. _$2.forEach(this.apiResponse, function (schemaRow) {
  7189. if (schemaRow.schema_name === schemaName) {
  7190. dbType = schemaRow.db_type;
  7191. return false;
  7192. }
  7193. });
  7194. return dbType;
  7195. };
  7196. return DbStore;
  7197. }(CacheStore));
  7198. function syncQueryDSL(_a) {
  7199. var schema_name = _a.schema_name, table_name = _a.table_name;
  7200. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  7201. }
  7202. var instance$1 = new DbStore();
  7203. // // 字段域数据
  7204. // let columnDomain = undefined
  7205. // // 元数据
  7206. // let apiResponse = []
  7207. //
  7208. // // 订阅
  7209. // const subscribeList = []
  7210. // /**
  7211. // * 获取全部元数据
  7212. // */
  7213. // export function getApiResponse() {
  7214. // return apiResponse
  7215. // }
  7216. //
  7217. // export function getColumnDomain() {
  7218. // return columnDomain
  7219. // }
  7220. // window['getApiResponse'] = getApiResponse
  7221. // window['getColumnDomain'] = getColumnDomain
  7222. // window['getDbTreeStore'] = function () {
  7223. // return apiResponse
  7224. // }
  7225. //
  7226. // /**
  7227. // * 订阅结果集
  7228. // */
  7229. // export function subscribe(fn) {
  7230. // subscribeList.push(fn)
  7231. // }
  7232. //
  7233. // /**
  7234. // * 取消订阅
  7235. // */
  7236. // export function describe(fn) {
  7237. // _.remove(subscribeList, item => item === fn)
  7238. // }
  7239. //
  7240. // /**
  7241. // * 刷新,如果前端从来没有取到过结果的话
  7242. // * 如果强制刷新成功,就返回 true
  7243. // * 如果没有被强制刷新,返回 false
  7244. // */
  7245. // export function reloadIfNeed() {
  7246. // if (_.size(apiResponse) <= 0) {
  7247. // reloadForce()
  7248. // return true
  7249. // }
  7250. // return false
  7251. // }
  7252. //
  7253. // export function reloadIfNeedPromise() {
  7254. // return new Promise((resolve, reject) => {
  7255. // if (_.size(apiResponse) <= 0) {
  7256. // // 从未有获取过值
  7257. // reloadForce().then(res => {
  7258. // resolve(apiResponse)
  7259. // })
  7260. // return
  7261. // }
  7262. // resolve(apiResponse)
  7263. // return
  7264. // })
  7265. // }
  7266. //
  7267. // /**
  7268. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  7269. // */
  7270. // export function reloadForce() {
  7271. // _.forEach(subscribeList, fn => {
  7272. // fn(true)
  7273. // })
  7274. //
  7275. // return getMateData().then((content) => {
  7276. // apiResponse = content
  7277. // _.forEach(subscribeList, fn => {
  7278. // fn(apiResponse)
  7279. // })
  7280. // }).finally(() => {
  7281. // _.forEach(subscribeList, fn => {
  7282. // fn(false)
  7283. // })
  7284. // })
  7285. // }
  7286. //
  7287. // /**
  7288. // * 通知刷新元数据
  7289. // */
  7290. // export function notifyRefresh() {
  7291. // _.forEach(subscribeList, fn => {
  7292. // fn(apiResponse)
  7293. // })
  7294. // }
  7295. // export function getAllDomain() {
  7296. // return new Promise((resolve, reject) => {
  7297. // getColumnDomainApi()
  7298. // .then(res => {
  7299. // if (res.success) {
  7300. // columnDomain = res.data
  7301. // resolve(res.data)
  7302. // } else {
  7303. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  7304. // console.error('getColumnDomain', res.msg)
  7305. // }
  7306. //
  7307. // })
  7308. // .catch(e => {
  7309. // showErrorDialog('getColumnDomain error!')
  7310. // console.error('getColumnDomain', e)
  7311. // reject(e)
  7312. // })
  7313. // })
  7314. // }
  7315. //# sourceMappingURL=DbStore.js.map
  7316. var PROJECT_DICT_CACHE = {};
  7317. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  7318. /**
  7319. *项目运行时构建
  7320. **/
  7321. function createRuntime() {
  7322. {
  7323. // 已经构建过了
  7324. return new Promise(function (resolve) {
  7325. resolve();
  7326. });
  7327. }
  7328. }
  7329. //# sourceMappingURL=ProjectRuntime.js.map
  7330. function ReportRunner(reportId, setLoadingFn) {
  7331. return new Promise(function (resolve) {
  7332. setLoadingFn(true);
  7333. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  7334. // const {model, vjson, report} = buildVjson(res.data)
  7335. // const ret = new ReportScope({model, vjson})
  7336. // ret.report_id = reportId
  7337. // ret.report = report
  7338. // resolve(ret)
  7339. var _b = __read(_a, 1), res = _b[0];
  7340. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  7341. resolve(ret);
  7342. }).finally(function () {
  7343. setLoadingFn(false);
  7344. });
  7345. });
  7346. }
  7347. //# sourceMappingURL=ReportRunner.js.map
  7348. //gridCondition
  7349. //gridColumn
  7350. //gridSum
  7351. //sqlSumEditor
  7352. //sqlEditor
  7353. var ReportDesign = /** @class */ (function (_super) {
  7354. __extends(ReportDesign, _super);
  7355. function ReportDesign() {
  7356. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  7357. }
  7358. ReportDesign.prototype.onLoad = function () {
  7359. this.load();
  7360. };
  7361. ReportDesign.prototype.save = function (sender) {
  7362. var _this = this;
  7363. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  7364. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  7365. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  7366. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  7367. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  7368. var report = this.viewModel.get('report');
  7369. var data = {
  7370. report_id: this.viewModel.get('report_id'),
  7371. report_name: this.viewModel.get('report_name'),
  7372. report_enable: this.viewModel.get('report_enable'),
  7373. query_sql: this.viewModel.get('querySql'),
  7374. summary_sql: this.viewModel.get('summarySql'),
  7375. report: json5.stringify(report, null, ' '),
  7376. };
  7377. sender.setLoading(true);
  7378. saveReportApi(data).then(function (res) {
  7379. if (res.success) {
  7380. msg$1('保存成功');
  7381. _this.dialogSuccess(data);
  7382. _this.load();
  7383. }
  7384. }).finally(function () {
  7385. sender.setLoading(false);
  7386. });
  7387. };
  7388. ReportDesign.prototype.preview = function (sender) {
  7389. var reportId = this.viewModel.get('report_id');
  7390. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7391. handles.mainWindow.showReportPreview(reportId, scope);
  7392. });
  7393. };
  7394. ReportDesign.prototype.load = function () {
  7395. var _this = this;
  7396. var reportId = this.viewModel.get('report_id');
  7397. this.setLoading(true);
  7398. reportByIdApi(reportId).then(function (res) {
  7399. 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;
  7400. if (report) {
  7401. report = json5.parse(report);
  7402. }
  7403. else {
  7404. report = {};
  7405. }
  7406. _this.viewModel.set('report_enable', report_enable);
  7407. _this.viewModel.set('report_name', report_name);
  7408. _this.viewModel.set('querySql', query_sql || '');
  7409. _this.viewModel.set('summarySql', summary_sql || '');
  7410. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7411. var query = _this.viewModel.get('report.query') || [];
  7412. var columns = _this.viewModel.get('report.columns') || [];
  7413. var summary = _this.viewModel.get('report.summary') || [];
  7414. var querySql = _this.viewModel.get('querySql');
  7415. var summarySql = _this.viewModel.get('summarySql');
  7416. _this.refs.gridCondition.setData(query);
  7417. _this.refs.gridColumn.setData(columns);
  7418. _this.refs.gridSum.setData(summary);
  7419. _this.refs.sqlEditor.setCode(querySql);
  7420. _this.refs.sqlSumEditor.setCode(summarySql);
  7421. }).finally(function () {
  7422. _this.setLoading(false);
  7423. });
  7424. };
  7425. ReportDesign.prototype.addCondition = function () {
  7426. this.refs.gridCondition.appendEditRow({
  7427. conditionFieldBind: '',
  7428. conditionFieldLabel: '',
  7429. conditionFieldXtype: 'textfield',
  7430. conditionFieldFlex: 1,
  7431. conditionFieldDict: '',
  7432. conditionFieldWrap: false,
  7433. conditionFieldExtend: '{}',
  7434. }, 'conditionFieldBind');
  7435. };
  7436. ReportDesign.prototype.removeCondition = function () {
  7437. var _this = this;
  7438. var rows = [];
  7439. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7440. rows.push(r);
  7441. });
  7442. _.forEach(rows, function (r) {
  7443. _this.refs.gridCondition.getStore().remove(r);
  7444. });
  7445. };
  7446. ReportDesign.prototype.moveUp = function (sender) {
  7447. var grid = sender.up('grid');
  7448. grid.rowMoveUp();
  7449. };
  7450. ReportDesign.prototype.moveDown = function (sender) {
  7451. var grid = sender.up('grid');
  7452. grid.rowMoveDown();
  7453. };
  7454. ReportDesign.prototype.calcCondition = function () {
  7455. var _this = this;
  7456. var sql = this.refs.sqlEditor.getCode();
  7457. var re = sql.matchAll(/#{(.+?)}/gi);
  7458. var rows = this.refs.gridCondition.getDataRows();
  7459. this.refs.gridCondition.setLoading(true);
  7460. Promise.all([
  7461. parseDynamicSqlApi(sql),
  7462. instance$1.reloadIfNeedPromise(),
  7463. ]).then(function (_a) {
  7464. var e_1, _b;
  7465. var _c = __read(_a, 1), res1 = _c[0];
  7466. if (res1.success) {
  7467. var tables_1 = [];
  7468. _.forEach(res1.data, function (parseItem) {
  7469. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7470. if (tableName && !_.includes(tables_1, tableName)) {
  7471. tables_1.push(tableName);
  7472. }
  7473. });
  7474. var _loop_1 = function (m) {
  7475. var e_2, _a;
  7476. var columnName = m[1];
  7477. // 没有这个列才添加
  7478. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7479. var meta = undefined;
  7480. try {
  7481. 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()) {
  7482. var tableName = tables_2_1.value;
  7483. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7484. if (meta) {
  7485. break;
  7486. }
  7487. }
  7488. }
  7489. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7490. finally {
  7491. try {
  7492. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7493. }
  7494. finally { if (e_2) throw e_2.error; }
  7495. }
  7496. if (meta) {
  7497. // 找到元数据
  7498. var r = {
  7499. conditionFieldBind: meta.column_name,
  7500. conditionFieldLabel: meta.column_comment,
  7501. conditionFieldXtype: 'textfield',
  7502. conditionFieldFlex: 1,
  7503. conditionFieldDict: '',
  7504. conditionFieldWrap: false,
  7505. conditionFieldExtend: '{}',
  7506. };
  7507. if (meta.column_ui === 'combo' && meta.column_dict) {
  7508. r.conditionFieldXtype = 'combo';
  7509. r.conditionFieldDict = meta.column_dict;
  7510. }
  7511. else if (meta.column_ui === "checkbox") {
  7512. r.conditionFieldXtype = 'checkbox';
  7513. }
  7514. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7515. r.conditionFieldXtype = 'numberfield';
  7516. }
  7517. _this.refs.gridCondition.appendEditRow(r);
  7518. }
  7519. else {
  7520. // 没找到元数据,直接添加
  7521. _this.refs.gridCondition.appendEditRow({
  7522. conditionFieldBind: columnName,
  7523. conditionFieldLabel: '',
  7524. conditionFieldXtype: 'textfield',
  7525. conditionFieldFlex: 1,
  7526. conditionFieldDict: '',
  7527. conditionFieldWrap: false,
  7528. conditionFieldExtend: '{}',
  7529. });
  7530. }
  7531. }
  7532. };
  7533. try {
  7534. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7535. var m = re_1_1.value;
  7536. _loop_1(m);
  7537. }
  7538. }
  7539. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7540. finally {
  7541. try {
  7542. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7543. }
  7544. finally { if (e_1) throw e_1.error; }
  7545. }
  7546. }
  7547. }).finally(function () {
  7548. _this.refs.gridCondition.setLoading(false);
  7549. });
  7550. };
  7551. ReportDesign.prototype.addColumn = function () {
  7552. this.refs.gridColumn.appendEditRow({
  7553. dataIndex: '',
  7554. header: '',
  7555. xtype: '',
  7556. dataType: '',
  7557. width: '',
  7558. dict: '',
  7559. align: '',
  7560. filterable: true,
  7561. hidden: false,
  7562. sortable: true,
  7563. fieldExtend: '{}',
  7564. }, 'header');
  7565. };
  7566. ReportDesign.prototype.removeColumn = function () {
  7567. var _this = this;
  7568. var rows = [];
  7569. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7570. rows.push(r);
  7571. });
  7572. _.forEach(rows, function (r) {
  7573. _this.refs.gridColumn.getStore().remove(r);
  7574. });
  7575. };
  7576. ReportDesign.prototype.calcColumn = function () {
  7577. var _this = this;
  7578. var sql = this.refs.sqlEditor.getCode();
  7579. this.refs.gridColumn.setLoading(true);
  7580. var rows = this.refs.gridColumn.getDataRows();
  7581. Promise.all([
  7582. parseDynamicSqlApi(sql),
  7583. instance$1.reloadIfNeedPromise(),
  7584. ]).then(function (_a) {
  7585. var _b = __read(_a, 1), res1 = _b[0];
  7586. if (res1.success) {
  7587. _.forEach(res1.data, function (parseItem) {
  7588. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7589. // 是否找到重复字段
  7590. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7591. if (exists) {
  7592. if ((columnTypeName || "").toLowerCase() === "number") {
  7593. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7594. if (record) {
  7595. record.set("dataType", "number");
  7596. record.set("align", "end");
  7597. }
  7598. }
  7599. return;
  7600. }
  7601. if (tableName) {
  7602. // 解出表格名和字段名
  7603. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7604. if (meta) {
  7605. // 找到了元数据
  7606. var r = {
  7607. dataIndex: meta.column_name,
  7608. header: meta.column_comment,
  7609. xtype: '',
  7610. dataType: '',
  7611. width: '',
  7612. dict: '',
  7613. align: '',
  7614. filterable: true,
  7615. hidden: false,
  7616. sortable: true,
  7617. fieldExtend: '{}',
  7618. };
  7619. if (meta.column_ui === 'combo' && meta.column_dict) {
  7620. r.dict = meta.column_dict;
  7621. }
  7622. else if (meta.column_ui === "checkbox") {
  7623. r.xtype = 'checkbox';
  7624. }
  7625. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7626. r.dataType = meta.data_type;
  7627. r.align = 'end';
  7628. }
  7629. if ((columnTypeName || "").toLowerCase() === "number") {
  7630. r.dataType = "number";
  7631. r.align = 'end';
  7632. }
  7633. _this.refs.gridColumn.appendEditRow(r);
  7634. return;
  7635. }
  7636. }
  7637. if (columnName) {
  7638. // 解出字段名
  7639. var r = {
  7640. dataIndex: columnName,
  7641. header: columnName,
  7642. xtype: '',
  7643. dataType: '',
  7644. width: '',
  7645. dict: '',
  7646. align: '',
  7647. filterable: true,
  7648. hidden: false,
  7649. sortable: true,
  7650. fieldExtend: '{}',
  7651. };
  7652. if ((columnTypeName || "").toLowerCase() === "number") {
  7653. r.dataType = "number";
  7654. r.align = 'end';
  7655. }
  7656. _this.refs.gridColumn.appendEditRow(r);
  7657. }
  7658. });
  7659. }
  7660. }).finally(function () {
  7661. _this.refs.gridColumn.setLoading(false);
  7662. });
  7663. };
  7664. ReportDesign.prototype.addSum = function () {
  7665. this.refs.gridSum.appendEditRow({
  7666. sumFieldBind: '',
  7667. sumFieldLabel: '',
  7668. sumFieldFlex: 1,
  7669. sumFieldWrap: false,
  7670. sumFieldExtend: '{}',
  7671. }, 'sumFieldBind');
  7672. };
  7673. ReportDesign.prototype.removeSum = function () {
  7674. var _this = this;
  7675. var rows = [];
  7676. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7677. rows.push(r);
  7678. });
  7679. _.forEach(rows, function (r) {
  7680. _this.refs.gridSum.getStore().remove(r);
  7681. });
  7682. };
  7683. ReportDesign.prototype.calcSum = function () {
  7684. var _this = this;
  7685. var sql = this.refs.sqlSumEditor.getCode();
  7686. var rows = this.refs.gridSum.getDataRows();
  7687. this.refs.gridSum.setLoading(true);
  7688. parseDynamicSqlApi(sql).then(function (res1) {
  7689. if (res1.success) {
  7690. _.forEach(res1.data, function (parseItem) {
  7691. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7692. // 是否找到重复字段
  7693. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7694. return;
  7695. }
  7696. if (columnName) {
  7697. // 解出字段名
  7698. _this.refs.gridSum.appendEditRow({
  7699. sumFieldBind: columnName,
  7700. sumFieldLabel: columnName,
  7701. sumFieldFlex: 1,
  7702. sumFieldWrap: false,
  7703. sumFieldExtend: '{}',
  7704. });
  7705. }
  7706. });
  7707. }
  7708. }).finally(function () {
  7709. _this.refs.gridSum.setLoading(false);
  7710. });
  7711. };
  7712. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7713. get: function () {
  7714. return this.viewModel.get('report_id');
  7715. },
  7716. enumerable: true,
  7717. configurable: true
  7718. });
  7719. return ReportDesign;
  7720. }(Scope));
  7721. //# sourceMappingURL=ReportDesign.js.map
  7722. var model$5 = {
  7723. data: {
  7724. originalTableInfo: {
  7725. table_name: '',
  7726. description: '',
  7727. },
  7728. hasChanged: false,
  7729. schema_name: undefined,
  7730. table_name: undefined,
  7731. column_name: undefined,
  7732. tableInfo: {
  7733. schema_name: '',
  7734. table_name: '',
  7735. description: '',
  7736. biz_category: '',
  7737. note: '',
  7738. archive_enable: false,
  7739. archive_cron: '',
  7740. archive_condition: '',
  7741. column_list: []
  7742. },
  7743. },
  7744. formulas: {
  7745. shouldSave: function (get) {
  7746. // console.log("-->", get('grid1.ischanged'))
  7747. return get('grid1.ischanged')
  7748. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7749. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7750. },
  7751. },
  7752. };
  7753. //# sourceMappingURL=DbColumn.model.js.map
  7754. var vjson$5 = {
  7755. bind: {
  7756. title: '{tableName}{shouldSave?" *":""}',
  7757. },
  7758. layout: 'fit',
  7759. items: [
  7760. {
  7761. layout: 'border',
  7762. tbar: {
  7763. xtype: 'toolbar',
  7764. items: [
  7765. // {
  7766. // xtype: 'button',
  7767. // text: '拉取库结构',
  7768. // iconCls: 'x-fa fa-cloud-download',
  7769. // listeners: {
  7770. // click: 'scope.pullFromDb'
  7771. // }
  7772. // },
  7773. {
  7774. xtype: 'button',
  7775. text: '保存至数据库',
  7776. iconCls: 'x-fa fa-save',
  7777. bind: {
  7778. disabled: '{!shouldSave}'
  7779. },
  7780. listeners: {
  7781. click: 'scope.pushToDb'
  7782. }
  7783. },
  7784. '-',
  7785. {
  7786. xtype: 'button',
  7787. text: '刷新 QueryDSL',
  7788. iconCls: 'x-fa fa-refresh',
  7789. listeners: {
  7790. click: 'scope.syncQueryDSL'
  7791. }
  7792. },
  7793. {
  7794. xtype: 'button',
  7795. text: '生成 DDL',
  7796. iconCls: 'x-fa fa-file-text',
  7797. listeners: {
  7798. click: 'scope.buildDDL'
  7799. }
  7800. }
  7801. ]
  7802. },
  7803. items: [
  7804. {
  7805. region: 'center',
  7806. xtype: 'tabpanel',
  7807. items: [
  7808. {
  7809. title: '字段',
  7810. xtype: 'yvgrid',
  7811. selModel: {
  7812. type: 'spreadsheet',
  7813. columnSelect: true,
  7814. pruneRemoved: false,
  7815. extensible: 'y'
  7816. },
  7817. enableLocking: false,
  7818. idField: 'column_name',
  7819. plugins: {
  7820. clipboard: true,
  7821. selectionreplicator: true
  7822. },
  7823. reference: 'grid1',
  7824. pagination: false,
  7825. // hideFootbar: true,
  7826. tbar: {
  7827. xtype: 'form',
  7828. items: [
  7829. {
  7830. xtype: 'cols',
  7831. items: [
  7832. {
  7833. xtype: 'textfield',
  7834. fieldLabel: '表格名',
  7835. reference: 'text_table_name',
  7836. readOnly: true,
  7837. bind: {
  7838. value: '{tableInfo.table_name}'
  7839. }
  7840. },
  7841. {
  7842. xtype: 'textfield',
  7843. fieldLabel: '描述',
  7844. // readOnly: true,
  7845. bind: {
  7846. value: '{tableInfo.description}'
  7847. }
  7848. },
  7849. ]
  7850. },
  7851. {
  7852. xtype: 'toolbar',
  7853. items: [
  7854. {
  7855. xtype: 'button',
  7856. text: '添加',
  7857. iconCls: 'x-fa fa-plus-circle',
  7858. listeners: {
  7859. click: 'scope.addField'
  7860. }
  7861. },
  7862. {
  7863. xtype: 'button',
  7864. text: '删除',
  7865. iconCls: 'x-fa fa-minus-circle',
  7866. listeners: {
  7867. click: 'scope.removeField'
  7868. }
  7869. },
  7870. ]
  7871. },
  7872. ]
  7873. },
  7874. listeners: {
  7875. editbefore: 'scope.gridEditBefore'
  7876. },
  7877. columns: [
  7878. {
  7879. text: '字段名', dataIndex: 'column_name',
  7880. sortable: false,
  7881. menuDisabled: true,
  7882. width: 120,
  7883. editor: {
  7884. allowBlank: true,
  7885. selectOnFocus: false
  7886. }
  7887. },
  7888. {
  7889. text: '字段中文', dataIndex: 'column_comment',
  7890. width: 130,
  7891. sortable: false,
  7892. menuDisabled: true,
  7893. editor: {
  7894. allowBlank: true,
  7895. selectOnFocus: false
  7896. }
  7897. },
  7898. {
  7899. text: '主键', dataIndex: 'is_primary_key',
  7900. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7901. width: 48, resizable: false,
  7902. },
  7903. {
  7904. text: '必填', dataIndex: 'not_null',
  7905. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7906. width: 48, resizable: false,
  7907. },
  7908. {
  7909. text: '字段域', dataIndex: 'column_domain',
  7910. sortable: false, menuDisabled: true,
  7911. width: 148,
  7912. fix: ['system.getDict("column_domain")'],
  7913. editor: {
  7914. xtype: 'combo',
  7915. allowBlank: true,
  7916. selectOnFocus: true,
  7917. fix: ['system.getDict("column_domain")'],
  7918. listConfig: {
  7919. minWidth: 200
  7920. },
  7921. listeners: {
  7922. change: 'scope.columnDomainChange',
  7923. }
  7924. }
  7925. },
  7926. {
  7927. text: '数据类型', dataIndex: 'data_type',
  7928. sortable: false, menuDisabled: true,
  7929. editor: { allowBlank: true, selectOnFocus: true }
  7930. },
  7931. {
  7932. text: '长度', dataIndex: 'column_size',
  7933. sortable: false, menuDisabled: true,
  7934. xtype: 'numbercolumn', format: '0',
  7935. editor: { allowBlank: true, selectOnFocus: true }
  7936. },
  7937. {
  7938. text: '小数位', dataIndex: 'decimal_digits',
  7939. sortable: false, menuDisabled: true,
  7940. xtype: 'numbercolumn', format: '0',
  7941. editor: { allowBlank: true, selectOnFocus: true }
  7942. },
  7943. {
  7944. text: '默认值', dataIndex: 'default_value',
  7945. sortable: false, menuDisabled: true,
  7946. editor: { allowBlank: true, selectOnFocus: true }
  7947. },
  7948. {
  7949. text: '字典', dataIndex: 'column_dict',
  7950. sortable: false, menuDisabled: true,
  7951. // fix: ['system.getDict("DICT")'],
  7952. width: 200,
  7953. editor: {
  7954. xtype: 'combo',
  7955. allowBlank: true,
  7956. listConfig: {
  7957. minWidth: 350
  7958. },
  7959. }
  7960. },
  7961. {
  7962. text: 'UI建议', dataIndex: 'column_ui',
  7963. sortable: false, menuDisabled: true,
  7964. // fix: ['system.getDict("column_ui")'],
  7965. editor: {
  7966. xtype: 'combo',
  7967. allowBlank: true,
  7968. listConfig: {
  7969. minWidth: 200
  7970. },
  7971. }
  7972. },
  7973. {
  7974. text: '详细描述', dataIndex: 'column_note',
  7975. sortable: false, menuDisabled: true,
  7976. editor: { allowBlank: true, }
  7977. },
  7978. ]
  7979. },
  7980. {
  7981. title: '高级属性',
  7982. xtype: 'form',
  7983. items: [
  7984. // {
  7985. // xtype: 'textfield',
  7986. // fieldLabel: '表格名',
  7987. // bind: {
  7988. // value: '{tableName}'
  7989. // }
  7990. // },
  7991. // {
  7992. // xtype: 'textfield',
  7993. // fieldLabel: '中文含义',
  7994. // bind: {
  7995. // value: '{tableInfo.description}'
  7996. // }
  7997. // },
  7998. {
  7999. xtype: 'combo',
  8000. fieldLabel: '业务类型',
  8001. bind: {
  8002. value: '{tableInfo.biz_category}'
  8003. },
  8004. store: [
  8005. '基础资料',
  8006. '系统',
  8007. '账目与库存',
  8008. '单据',
  8009. '指令',
  8010. '规则与流程',
  8011. '开发辅助',
  8012. ]
  8013. },
  8014. {
  8015. xtype: 'textfield',
  8016. fieldLabel: '详细描述',
  8017. bind: {
  8018. value: '{tableInfo.note}'
  8019. },
  8020. },
  8021. {
  8022. xtype: 'checkbox',
  8023. fieldLabel: '允许归档',
  8024. bind: "{tableInfo.archive_enable}",
  8025. },
  8026. {
  8027. xtype: 'textfield',
  8028. fieldLabel: '归档周期',
  8029. bind: {
  8030. value: '{tableInfo.archive_cron}',
  8031. hidden: '{!tableInfo.archive_enable}',
  8032. }
  8033. },
  8034. {
  8035. xtype: 'textfield',
  8036. fieldLabel: '归档条件',
  8037. bind: {
  8038. value: '{tableInfo.archive_condition}',
  8039. hidden: '{!tableInfo.archive_enable}',
  8040. }
  8041. },
  8042. ]
  8043. },
  8044. ]
  8045. }
  8046. ]
  8047. },
  8048. ]
  8049. };
  8050. //# sourceMappingURL=DbColumn.view.js.map
  8051. var DbColumn = /** @class */ (function (_super) {
  8052. __extends(DbColumn, _super);
  8053. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  8054. var _this = _super.call(this, {
  8055. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  8056. vjson: vjson$5
  8057. }) || this;
  8058. _this.isCreate = false;
  8059. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  8060. return _this;
  8061. }
  8062. DbColumn.prototype.onLoad = function () {
  8063. var _this = this;
  8064. var _a, _b, _c, _d, _e, _f, _g, _h;
  8065. console.log('me', this);
  8066. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  8067. this.refs.grid1.autoSizeColumns();
  8068. // this.refs.grid1.columns[0].hide()
  8069. // 自动定位到选定的列
  8070. if (this.viewModel.get('column_name')) {
  8071. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  8072. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  8073. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  8074. return;
  8075. }
  8076. }
  8077. }
  8078. instance.getColumnDomainComboData().then(function () {
  8079. _this.checkDomain();
  8080. });
  8081. 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 : "");
  8082. 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 : "");
  8083. if (this.isCreate)
  8084. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  8085. };
  8086. DbColumn.prototype.checkDomain = function () {
  8087. // 走查一遍 domain
  8088. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8089. var dbType = this.viewModel.get('tableInfo.db_type');
  8090. var diffColumnName = [];
  8091. var tableInfo = this.viewModel.get('tableInfo');
  8092. this.refs.grid1.store.data.items.forEach(function (record) {
  8093. var data = record.data;
  8094. var column_domain = data.column_domain;
  8095. var domain = instance.getColumnDomainById(column_domain);
  8096. if (!domain) {
  8097. // 没有找到 domain
  8098. return;
  8099. }
  8100. var editRow = applyDomain(dbType, domain);
  8101. // 字段跟领域做对比
  8102. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  8103. if (typeof compareResult === 'string') {
  8104. // 不一样的情况下,要改成一致
  8105. _$2.forOwn(editRow, function (value, key) {
  8106. // 改成与 domain 一致
  8107. record.set(key, value);
  8108. });
  8109. diffColumnName.push(data.column_name + '.' + compareResult);
  8110. }
  8111. });
  8112. if (diffColumnName.length > 0) {
  8113. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  8114. }
  8115. };
  8116. DbColumn.prototype.addField = function () {
  8117. this.refs.grid1.appendEditRow({
  8118. column_name: '',
  8119. column_comment: '',
  8120. is_primary_key: false,
  8121. not_null: true,
  8122. column_domain: '',
  8123. data_type: '',
  8124. column_size: 0,
  8125. decimal_digits: 0,
  8126. default_value: '',
  8127. column_dict: '',
  8128. column_ui: '',
  8129. column_note: '',
  8130. }, 'column_name');
  8131. };
  8132. DbColumn.prototype.removeField = function () {
  8133. var _this = this;
  8134. var rows = [];
  8135. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  8136. rows.push(r);
  8137. });
  8138. _$2.forEach(rows, function (r) {
  8139. _this.refs.grid1.getStore().remove(r);
  8140. });
  8141. };
  8142. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  8143. instance.getColumnDomainComboData().then(function (data) {
  8144. editor.cmp.columns[5].getEditor().setStore({ data: data });
  8145. });
  8146. // 被字段域锁定的内容,不允许修改
  8147. var record = context.record, field = context.field;
  8148. var domainId = record.get('column_domain');
  8149. if (!domainId) {
  8150. return;
  8151. }
  8152. var domain = instance.getColumnDomainById(domainId);
  8153. if (!domain) {
  8154. msg$1('没有找到字段域' + domainId);
  8155. return;
  8156. }
  8157. if (field === "data_type") {
  8158. // 字段类型不允许修改
  8159. context.cancel = true;
  8160. return;
  8161. }
  8162. if (domain.is_fix_size &&
  8163. (field === "column_size" ||
  8164. field === "decimal_digits")) {
  8165. // 锁定长度的情况下,大小不允许修改
  8166. context.cancel = true;
  8167. return;
  8168. }
  8169. if (domain.is_fix_default_value && field === "default_value") {
  8170. // 锁定默认值的情况下,默认值不允许修改
  8171. context.cancel = true;
  8172. return;
  8173. }
  8174. };
  8175. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  8176. if (!newValue) {
  8177. return;
  8178. }
  8179. var grid = editor.up('grid').ownerGrid;
  8180. var domain = instance.getColumnDomainById(newValue);
  8181. if (!domain) {
  8182. msg$1('没有找到 domain:' + newValue);
  8183. return;
  8184. }
  8185. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8186. var dbType = this.viewModel.get('tableInfo.db_type');
  8187. var editRow = applyDomain(dbType, domain);
  8188. grid.setEditRow(editRow);
  8189. };
  8190. DbColumn.prototype.pullFromDb = function () {
  8191. };
  8192. DbColumn.prototype.pushToDb = function (sender) {
  8193. var _this = this;
  8194. // 设置当前界面为 "保存中..." 状态
  8195. var me = this;
  8196. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  8197. this.viewModel.set('tableInfo.table_name', table_name);
  8198. this.viewModel.set('tableInfo.schema_name', schema_name);
  8199. var tableInfo = this.viewModel.get('tableInfo');
  8200. var column_list = this.refs.grid1.getDataRows();
  8201. var hasError = false;
  8202. if (column_list.length <= 0) {
  8203. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  8204. hasError = true;
  8205. }
  8206. var columnNameExistsCheck = {};
  8207. _$2.forEach(column_list, function (row, i) {
  8208. var checkResult = checkColumn(tableInfo, row);
  8209. if (typeof checkResult !== 'undefined') {
  8210. msg$1(checkResult);
  8211. hasError = true;
  8212. _this.refs.grid1.beginEdit(i, 'column_name');
  8213. return false;
  8214. }
  8215. if (!row.column_domain || row.column_domain === '0') {
  8216. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  8217. hasError = true;
  8218. _this.refs.grid1.beginEdit(i, 'column_domain');
  8219. return false;
  8220. }
  8221. if (isEmpty(row.data_type)) {
  8222. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  8223. hasError = true;
  8224. _this.refs.grid1.beginEdit(i, 'data_type');
  8225. return false;
  8226. }
  8227. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  8228. // 列名已存在
  8229. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  8230. hasError = true;
  8231. _this.refs.grid1.beginEdit(i, 'column_name');
  8232. return false;
  8233. }
  8234. columnNameExistsCheck[row.column_name] = true;
  8235. });
  8236. if (hasError)
  8237. return;
  8238. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  8239. me.setLoading(true);
  8240. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  8241. .then(function (res) {
  8242. var _a;
  8243. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  8244. // 返回 DDL 就要显示出来
  8245. var window_1 = Ext.create('Ext.window.Window', {
  8246. title: 'SQL 预览',
  8247. height: 400,
  8248. width: 600,
  8249. modal: true,
  8250. animateTarget: sender,
  8251. maximizable: true,
  8252. layout: 'fit',
  8253. items: {
  8254. xtype: 'sqleditor',
  8255. value: res.data.ddl
  8256. },
  8257. buttons: [
  8258. {
  8259. xtype: 'button',
  8260. text: '执行',
  8261. iconCls: 'x-fa fa-save',
  8262. handler: function (sender) {
  8263. var editor = sender.up('window').down('sqleditor');
  8264. var ddl = editor.getValue();
  8265. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  8266. }
  8267. },
  8268. {
  8269. xtype: 'button',
  8270. text: '取消',
  8271. iconCls: 'x-fa fa-times',
  8272. handler: function () {
  8273. window_1.close();
  8274. }
  8275. }
  8276. ]
  8277. }).show();
  8278. return;
  8279. }
  8280. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8281. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8282. if (!tableRow) {
  8283. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8284. console.log('这是一个新 table');
  8285. instance$1.appendNewTable(tableInfo);
  8286. }
  8287. _this.viewModel.set('schema_name', schema_name);
  8288. _this.viewModel.set('table_name', table_name);
  8289. _this.viewModel.set('tableInfo', tableInfo);
  8290. _this.refs.grid1.setData(tableInfo.column_list);
  8291. if (tableRow)
  8292. Object.assign(tableRow, tableInfo);
  8293. msg$1('保存成功');
  8294. _this.viewModel.set('hasChanged', false);
  8295. })
  8296. .finally(function () {
  8297. me.setLoading(false);
  8298. });
  8299. };
  8300. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  8301. var _this = this;
  8302. window.setLoading(true);
  8303. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  8304. .then(function (res) {
  8305. var _a, _b, _c, _d;
  8306. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8307. // 保存成功就提示一下,并重新载入数据
  8308. msg$1(res.msg);
  8309. instance$1.reloadForce(undefined);
  8310. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8311. if (!tableRow) {
  8312. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8313. console.log('这是一个新 table');
  8314. instance$1.appendNewTable(tableInfo);
  8315. }
  8316. _this.viewModel.set('schema_name', schema_name);
  8317. _this.viewModel.set('table_name', table_name);
  8318. _this.viewModel.set('tableInfo', tableInfo);
  8319. _this.refs.grid1.setData(tableInfo.column_list);
  8320. if (tableRow)
  8321. Object.assign(tableRow, tableInfo);
  8322. instance$1.notifyRefresh();
  8323. window.close();
  8324. _this.viewModel.set('hasChanged', false);
  8325. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  8326. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  8327. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  8328. })
  8329. .finally(function () {
  8330. // 无论正常异常,关闭 "保存中..." 状态
  8331. window.setLoading(false);
  8332. });
  8333. };
  8334. DbColumn.prototype.syncQueryDSL = function () {
  8335. var _this = this;
  8336. var tableInfo = this.viewModel.get("tableInfo");
  8337. this.setLoading(true);
  8338. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  8339. .then(function () {
  8340. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  8341. })
  8342. .finally(function () {
  8343. _this.setLoading(false);
  8344. });
  8345. };
  8346. DbColumn.prototype.buildDDL = function () {
  8347. };
  8348. return DbColumn;
  8349. }(Scope));
  8350. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  8351. model.data.schema_name = schemaName;
  8352. model.data.table_name = tableName;
  8353. model.data.column_name = columnName;
  8354. if (isCreateTable) {
  8355. var dbType = instance$1.getSchemaDbType(schemaName);
  8356. if (!dbType) {
  8357. throw Error('无法识别数据库类型' + schemaName);
  8358. }
  8359. model.data.tableInfo.schema_name = model.data.schema_name;
  8360. model.data.tableInfo.table_name = model.data.table_name;
  8361. model.data.tableInfo.db_type = dbType;
  8362. model.data.tableInfo.column_list = [];
  8363. model.data.tableInfo.is_create = true;
  8364. return model;
  8365. }
  8366. var tableRow = instance$1.getTableByName(schemaName, tableName);
  8367. if (!tableRow) {
  8368. throw Error('没有找到 table' + schemaName + tableName + columnName);
  8369. }
  8370. model.data.tableInfo = _$2.cloneDeep(tableRow);
  8371. model.data.tableInfo.is_create = false;
  8372. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  8373. return model;
  8374. }
  8375. //# sourceMappingURL=DbColumn.js.map
  8376. var model$6 = {
  8377. data: {
  8378. id: '',
  8379. path: '',
  8380. form: {
  8381. title: '',
  8382. sqlId: '',
  8383. }
  8384. }
  8385. };
  8386. //# sourceMappingURL=WidgetDesign.model.js.map
  8387. var vjson$6 = {
  8388. bind: {
  8389. title: '{title}',
  8390. },
  8391. layout: 'fit',
  8392. items: [
  8393. {
  8394. layout: 'border',
  8395. items: [
  8396. {
  8397. region: 'center',
  8398. layout: 'border',
  8399. items: [
  8400. {
  8401. region: 'north',
  8402. items: [
  8403. {
  8404. xtype: 'toolbar',
  8405. border: false,
  8406. items: [
  8407. {
  8408. xtype: 'button',
  8409. text: '刷新',
  8410. iconCls: 'x-fa fa-refresh',
  8411. listeners: {
  8412. click: 'scope.load'
  8413. }
  8414. },
  8415. {
  8416. xtype: 'button',
  8417. text: '保存',
  8418. iconCls: 'x-fa fa-save',
  8419. listeners: {
  8420. click: 'scope.widgetSave'
  8421. }
  8422. },
  8423. {
  8424. xtype: 'button',
  8425. text: '预览',
  8426. iconCls: 'x-fa fa-play-circle-o',
  8427. listeners: {
  8428. //click: 'scope.preview'
  8429. }
  8430. },
  8431. {
  8432. xtype: 'textfield',
  8433. fieldLabel: '弹窗文件',
  8434. reference: "wPath",
  8435. labelWidth: 80,
  8436. //width: 200,
  8437. bind: {
  8438. value: '{widgetPath}',
  8439. },
  8440. readOnly: true,
  8441. },
  8442. {
  8443. xtype: 'textfield',
  8444. fieldLabel: '弹窗名称',
  8445. reference: "wTitle",
  8446. labelWidth: 80,
  8447. //width: 200,
  8448. bind: {
  8449. value: '{form.title}',
  8450. },
  8451. readOnly: true,
  8452. },
  8453. {
  8454. xtype: 'textfield',
  8455. fieldLabel: 'sqlId',
  8456. bind: {
  8457. value: '{form.sqlId}',
  8458. },
  8459. readOnly: true,
  8460. },
  8461. ]
  8462. },
  8463. ]
  8464. },
  8465. {
  8466. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8467. items: [
  8468. {
  8469. title: "SQL和条件",
  8470. layout: 'border',
  8471. border: false,
  8472. items: [
  8473. {
  8474. region: 'north',
  8475. height: 200,
  8476. xtype: 'yvgrid',
  8477. reference: "grid2",
  8478. split: true,
  8479. selModel: {
  8480. selType: 'rowmodel',
  8481. mode: 'SINGLE',
  8482. },
  8483. store: {},
  8484. pagination: false,
  8485. hideFootbar: true,
  8486. tbar: {
  8487. xtype: 'toolbar',
  8488. items: [
  8489. {
  8490. xtype: 'button',
  8491. text: '添加',
  8492. iconCls: 'x-fa fa-plus-circle',
  8493. listeners: {}
  8494. },
  8495. {
  8496. xtype: 'button',
  8497. text: '删除',
  8498. iconCls: 'x-fa fa-minus-circle',
  8499. listeners: {
  8500. click: 'scope.delCondition'
  8501. }
  8502. },
  8503. '-',
  8504. {
  8505. xtype: 'button',
  8506. text: '上移',
  8507. iconCls: 'x-fa fa-refresh',
  8508. listeners: {
  8509. //click: 'scope.saveAll'
  8510. }
  8511. },
  8512. {
  8513. xtype: 'button',
  8514. text: '下移',
  8515. iconCls: 'x-fa fa-refresh',
  8516. listeners: {
  8517. //click: 'scope.saveAll'
  8518. }
  8519. },
  8520. '-',
  8521. {
  8522. xtype: 'button',
  8523. text: '自动分析',
  8524. iconCls: 'x-fa fa-refresh',
  8525. listeners: {
  8526. click: 'scope.calcCondition'
  8527. }
  8528. },
  8529. ]
  8530. },
  8531. columns: [
  8532. {
  8533. text: '条件变量',
  8534. dataIndex: 'conditionFieldBind',
  8535. width: 140,
  8536. sortable: false,
  8537. menuDisabled: true,
  8538. editor: {
  8539. selectOnFocus: true
  8540. },
  8541. },
  8542. {
  8543. text: '中文标题',
  8544. dataIndex: 'conditionFieldLabel',
  8545. width: 120,
  8546. sortable: false,
  8547. menuDisabled: true,
  8548. editor: {
  8549. selectOnFocus: true
  8550. },
  8551. },
  8552. {
  8553. text: '编辑类型',
  8554. dataIndex: 'xtype',
  8555. sortable: false,
  8556. menuDisabled: true,
  8557. editor: {
  8558. xtype: 'combo',
  8559. typeAhead: true,
  8560. triggerAction: 'all',
  8561. selectOnFocus: true,
  8562. store: [
  8563. ['textfield', 'textfield'],
  8564. ['combo', 'combo'],
  8565. ['datefield', 'datefield'],
  8566. ['datetimefield', 'datetimefield'],
  8567. ['numberfield', 'numberfield'],
  8568. ['multiplesearch', 'multiplesearch'],
  8569. ]
  8570. }
  8571. },
  8572. {
  8573. text: '权重',
  8574. dataIndex: 'conditionFieldFlex',
  8575. align: 'right',
  8576. sortable: false,
  8577. menuDisabled: true,
  8578. editor: {
  8579. xtype: 'numberfield',
  8580. selectOnFocus: false,
  8581. minValue: 0,
  8582. maxValue: 10
  8583. },
  8584. },
  8585. {
  8586. text: '字典',
  8587. dataIndex: 'conditionFieldDict',
  8588. width: 160,
  8589. sortable: false,
  8590. menuDisabled: true,
  8591. editor: {
  8592. selectOnFocus: false
  8593. },
  8594. },
  8595. {
  8596. xtype: 'checkcolumn',
  8597. dataIndex: "conditionFieldWrap", header: "换行",
  8598. width: 65,
  8599. sortable: false,
  8600. menuDisabled: true,
  8601. },
  8602. ]
  8603. },
  8604. {
  8605. region: 'center',
  8606. xtype: 'sqleditor',
  8607. layout: 'fit',
  8608. reference: 'sqlEditor',
  8609. split: true,
  8610. bind: {
  8611. value: "{form.sql}"
  8612. },
  8613. },
  8614. ]
  8615. },
  8616. {
  8617. title: "结果字段定义",
  8618. border: false,
  8619. xtype: 'yvgrid',
  8620. reference: "grid3",
  8621. selModel: {
  8622. selType: 'rowmodel',
  8623. mode: 'SINGLE',
  8624. },
  8625. store: {},
  8626. pagination: false,
  8627. hideFootbar: true,
  8628. tbar: {
  8629. xtype: 'toolbar',
  8630. items: [
  8631. {
  8632. xtype: 'button',
  8633. text: '添加',
  8634. iconCls: 'x-fa fa-plus-circle',
  8635. listeners: {}
  8636. },
  8637. {
  8638. xtype: 'button',
  8639. text: '删除',
  8640. iconCls: 'x-fa fa-minus-circle',
  8641. listeners: {
  8642. click: 'scope.delColumn'
  8643. }
  8644. },
  8645. '-',
  8646. {
  8647. xtype: 'button',
  8648. text: '上移',
  8649. iconCls: 'x-fa fa-refresh',
  8650. listeners: {
  8651. //click: 'scope.saveAll'
  8652. }
  8653. },
  8654. {
  8655. xtype: 'button',
  8656. text: '下移',
  8657. iconCls: 'x-fa fa-refresh',
  8658. listeners: {
  8659. //click: 'scope.saveAll'
  8660. }
  8661. },
  8662. '-',
  8663. {
  8664. xtype: 'button',
  8665. text: '自动分析',
  8666. iconCls: 'x-fa fa-refresh',
  8667. listeners: {
  8668. click: 'scope.calcColumn'
  8669. }
  8670. },
  8671. ]
  8672. },
  8673. columns: [
  8674. { xtype: 'rownumberer' },
  8675. {
  8676. text: '字段',
  8677. dataIndex: 'dataIndex',
  8678. width: 140,
  8679. sortable: false,
  8680. menuDisabled: true,
  8681. editor: {
  8682. selectOnFocus: true
  8683. },
  8684. },
  8685. {
  8686. text: '标题',
  8687. dataIndex: 'header',
  8688. width: 120,
  8689. sortable: false,
  8690. menuDisabled: true,
  8691. editor: {
  8692. selectOnFocus: true
  8693. },
  8694. },
  8695. {
  8696. text: '显示类型',
  8697. dataIndex: 'xtype',
  8698. width: 90,
  8699. sortable: false,
  8700. menuDisabled: true,
  8701. editor: {
  8702. xtype: 'combo',
  8703. typeAhead: true,
  8704. triggerAction: 'all',
  8705. selectOnFocus: true,
  8706. store: [
  8707. ['', ''],
  8708. ['rownum', 'rownum'],
  8709. ['button', 'button'],
  8710. ['checkbox', 'checkbox'],
  8711. ['progres', 'progres'],
  8712. ]
  8713. }
  8714. },
  8715. {
  8716. text: '数据类型',
  8717. dataIndex: 'dataType',
  8718. width: 90,
  8719. sortable: false,
  8720. menuDisabled: true,
  8721. editor: {
  8722. xtype: 'combo',
  8723. typeAhead: true,
  8724. triggerAction: 'all',
  8725. selectOnFocus: true,
  8726. store: [
  8727. ['', ''],
  8728. ['string', 'string'],
  8729. ['number', 'number'],
  8730. ['date', 'date'],
  8731. ]
  8732. }
  8733. },
  8734. {
  8735. text: '数据字典',
  8736. dataIndex: 'dict',
  8737. sortable: false,
  8738. menuDisabled: true,
  8739. width: 120,
  8740. editor: {
  8741. selectOnFocus: true,
  8742. },
  8743. },
  8744. ],
  8745. },
  8746. ]
  8747. },
  8748. ]
  8749. },
  8750. ]
  8751. }
  8752. ]
  8753. }; //
  8754. //
  8755. //# sourceMappingURL=WidgetDesign.view.js.map
  8756. var WidgetDesign = /** @class */ (function (_super) {
  8757. __extends(WidgetDesign, _super);
  8758. function WidgetDesign(widgetPath, widgetName) {
  8759. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8760. _this.widgetPath = widgetPath;
  8761. _this.widgetName = widgetName;
  8762. return _this;
  8763. }
  8764. WidgetDesign.prototype.onLoad = function () {
  8765. if (this.widgetPath) {
  8766. this.loadForm(this.widgetPath);
  8767. this.viewModel.set("widgetPath", this.widgetPath);
  8768. this.refs.wTitle.setReadOnly(true);
  8769. this.refs.wPath.setReadOnly(true);
  8770. }
  8771. else {
  8772. this.refs.wTitle.setReadOnly(false);
  8773. this.refs.wPath.setReadOnly(false);
  8774. }
  8775. };
  8776. WidgetDesign.prototype.load = function () {
  8777. var widgetPath = this.viewModel.get("widgetPath");
  8778. if (widgetPath) {
  8779. this.loadForm(widgetPath);
  8780. }
  8781. };
  8782. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8783. var _this = this;
  8784. var me = this;
  8785. me.setLoading(true);
  8786. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8787. msg$1(res.msg);
  8788. if (res.success) {
  8789. _this.viewModel.set("widgetPath", widgetPath);
  8790. me.refs.grid3.getStore().removeAll();
  8791. if (res.data.form.columns) {
  8792. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8793. }
  8794. _this.viewModel.set("form.title", res.data.form.title);
  8795. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8796. // set sql
  8797. _this.refs.sqlEditor.setCode(res.data.sql);
  8798. }
  8799. }).finally(function () {
  8800. me.setLoading(false);
  8801. });
  8802. };
  8803. WidgetDesign.prototype.widgetAdd = function (sender) {
  8804. var _this = this;
  8805. var title = this.viewModel.get("form.title");
  8806. if (title) {
  8807. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8808. if (btn == 'yes') {
  8809. alert(1);
  8810. }
  8811. else {
  8812. alert(2);
  8813. }
  8814. });
  8815. }
  8816. else {
  8817. var me_1 = this;
  8818. var win_1 = new Ext.Window({
  8819. autoDestroy: true,
  8820. title: "新建弹框",
  8821. width: 400,
  8822. height: 220,
  8823. resizable: true,
  8824. closable: true,
  8825. maximizable: true,
  8826. minimizable: true,
  8827. plain: true,
  8828. // constrainHeader: true,
  8829. constrain: true,
  8830. layout: 'fit',
  8831. animateTarget: sender,
  8832. buttonAlign: 'center',
  8833. items: [
  8834. {
  8835. xtype: "form",
  8836. layout: "hbox",
  8837. margin: '10px 20px',
  8838. border: 0,
  8839. items: [
  8840. {
  8841. flex: 1,
  8842. layout: 'vbox',
  8843. items: [
  8844. {
  8845. xtype: "textfield",
  8846. name: "widgetcode",
  8847. fieldLabel: "弹框编号",
  8848. flex: 1,
  8849. allowBlank: false,
  8850. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8851. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8852. labelWidth: 50,
  8853. width: "100%",
  8854. },
  8855. {
  8856. xtype: "textfield",
  8857. name: "widgetname",
  8858. fieldLabel: "弹框名称",
  8859. flex: 1,
  8860. allowBlank: false,
  8861. labelWidth: 50,
  8862. width: "100%",
  8863. },
  8864. ]
  8865. },
  8866. ]
  8867. }
  8868. ],
  8869. //窗口按钮
  8870. buttons: [
  8871. {
  8872. xtype: 'button', text: '保存', handler: function (btn) {
  8873. //窗口获取表单
  8874. var form = win_1.down('form');
  8875. var vaildSuccess = form.isValid();
  8876. if (!vaildSuccess) {
  8877. return;
  8878. }
  8879. var title = form.down('textfield[name="widgetname"]').getValue();
  8880. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8881. me_1.viewModel.set("form.title", title);
  8882. me_1.viewModel.set("widgetPath", widgetPath);
  8883. var formdata = _this.viewModel.get("form");
  8884. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8885. if (res.success) {
  8886. msg$1('添加成功');
  8887. }
  8888. me_1.loadForm(widgetPath);
  8889. win_1.close();
  8890. });
  8891. }
  8892. },
  8893. {
  8894. xtype: 'button', text: '取消', handler: function (btn) {
  8895. //窗口关闭
  8896. win_1.close();
  8897. }
  8898. }
  8899. ]
  8900. });
  8901. win_1.show();
  8902. }
  8903. };
  8904. WidgetDesign.prototype.widgetSave = function () {
  8905. var _this = this;
  8906. var _a, _b;
  8907. var widgetPath = this.viewModel.get("widgetPath");
  8908. if (!widgetPath) {
  8909. msg$1("请选择或添加弹框后再保存!");
  8910. return;
  8911. }
  8912. var title = this.viewModel.get("form.title");
  8913. if (!title) {
  8914. msg$1("请选择或添加弹框后再保存!");
  8915. return;
  8916. }
  8917. // 获取条件
  8918. 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) {
  8919. delete r.id;
  8920. return r;
  8921. });
  8922. this.viewModel.set("form.conditions", conditions);
  8923. // 获取查询列
  8924. 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) {
  8925. delete r.id;
  8926. if (r.dict) {
  8927. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8928. }
  8929. return r;
  8930. });
  8931. this.viewModel.set("form.columns", columns);
  8932. // sql
  8933. var sql = this.refs.sqlEditor.getCode();
  8934. this.viewModel.set("form.sql", sql);
  8935. var form = this.viewModel.get("form");
  8936. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8937. msg$1(res.msg);
  8938. if (res.success) {
  8939. msg$1('保存成功');
  8940. _this.loadForm(widgetPath);
  8941. }
  8942. }).catch(function (res) {
  8943. });
  8944. };
  8945. WidgetDesign.prototype.delCondition = function () {
  8946. var _a;
  8947. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8948. };
  8949. WidgetDesign.prototype.delColumn = function () {
  8950. var _a;
  8951. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8952. };
  8953. WidgetDesign.prototype.calcCondition = function () {
  8954. var _this = this;
  8955. var sql = this.refs.sqlEditor.getCode();
  8956. var re = sql.matchAll(/#{(.+?)}/gi);
  8957. var rows = this.refs.grid2.getDataRows();
  8958. this.refs.grid2.setLoading(true);
  8959. parseDynamicSqlApi(sql).then(function (res) {
  8960. var e_1, _a;
  8961. if (res.success) {
  8962. var tables_1 = [];
  8963. _.forEach(res.data, function (parseItem) {
  8964. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8965. if (tableName && !_.includes(tables_1, tableName)) {
  8966. tables_1.push(tableName);
  8967. }
  8968. });
  8969. var _loop_1 = function (m) {
  8970. var e_2, _a;
  8971. var columnName = m[1];
  8972. // 没有这个列才添加
  8973. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8974. var meta = undefined;
  8975. try {
  8976. 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()) {
  8977. var tableName = tables_2_1.value;
  8978. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8979. if (meta) {
  8980. break;
  8981. }
  8982. }
  8983. }
  8984. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8985. finally {
  8986. try {
  8987. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  8988. }
  8989. finally { if (e_2) throw e_2.error; }
  8990. }
  8991. if (meta) {
  8992. // 没找到元数据,直接添加
  8993. _this.refs.grid2.appendEditRow({
  8994. conditionFieldBind: columnName,
  8995. conditionFieldLabel: meta.column_comment,
  8996. conditionFieldXtype: 'textfield',
  8997. conditionFieldFlex: 1,
  8998. conditionFieldDict: '',
  8999. conditionFieldWrap: false,
  9000. });
  9001. }
  9002. else {
  9003. _this.refs.grid2.appendEditRow({
  9004. conditionFieldBind: columnName,
  9005. conditionFieldLabel: '',
  9006. conditionFieldXtype: 'textfield',
  9007. conditionFieldFlex: 1,
  9008. conditionFieldDict: '',
  9009. conditionFieldWrap: false,
  9010. });
  9011. }
  9012. }
  9013. };
  9014. try {
  9015. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  9016. var m = re_1_1.value;
  9017. _loop_1(m);
  9018. }
  9019. }
  9020. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  9021. finally {
  9022. try {
  9023. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  9024. }
  9025. finally { if (e_1) throw e_1.error; }
  9026. }
  9027. }
  9028. }).finally(function () {
  9029. _this.refs.grid2.setLoading(false);
  9030. });
  9031. };
  9032. WidgetDesign.prototype.calcColumn = function () {
  9033. var _this = this;
  9034. var sql = this.refs.sqlEditor.getCode();
  9035. var rows = this.refs.grid3.getDataRows();
  9036. this.refs.grid3.setLoading(true);
  9037. parseDynamicSqlApi(sql).then(function (res) {
  9038. _.forEach(res.data, function (parseItem) {
  9039. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  9040. // 是否找到重复字段
  9041. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  9042. if (exists) {
  9043. return;
  9044. }
  9045. if (tableName) {
  9046. // 解出表格名和字段名
  9047. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  9048. if (meta) {
  9049. // 找到了元数据
  9050. var r = {
  9051. dataIndex: meta.column_name,
  9052. header: meta.column_comment,
  9053. xtype: '',
  9054. dataType: 'string',
  9055. dict: '',
  9056. };
  9057. if (meta.column_ui === 'combo' && meta.column_dict) {
  9058. r.dict = meta.column_dict;
  9059. }
  9060. else if (meta.column_ui === "checkbox") {
  9061. r.xtype = 'checkbox';
  9062. }
  9063. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  9064. r.dataType = meta.data_type;
  9065. }
  9066. _this.refs.grid3.appendEditRow(r);
  9067. return;
  9068. }
  9069. }
  9070. if (columnName) {
  9071. // 解出字段名
  9072. var r = {
  9073. dataIndex: columnName,
  9074. header: columnName,
  9075. xtype: '',
  9076. dataType: 'string',
  9077. dict: '',
  9078. };
  9079. _this.refs.grid3.appendEditRow(r);
  9080. }
  9081. });
  9082. }).finally(function () {
  9083. _this.refs.grid3.setLoading(false);
  9084. });
  9085. };
  9086. return WidgetDesign;
  9087. }(Scope));
  9088. //# sourceMappingURL=WidgetDesign.js.map
  9089. var model$7 = {
  9090. data: {
  9091. // spreadsheet: false,
  9092. // multSelect: false,
  9093. // showCheckColumn: false,
  9094. // checkColumncheckOnly: false,
  9095. // disableSelection: false,
  9096. vjson: {
  9097. reference: '',
  9098. pagination: false,
  9099. pageSize: false,
  9100. pageSizeOption: false,
  9101. hideFootbar: false,
  9102. hideRefresh: false,
  9103. hideExport: false,
  9104. hideAutoSize: false,
  9105. hideClearFilter: false,
  9106. hideSaveGridUIConfig: false,
  9107. hideClearGridUIConfig: false,
  9108. selectMode: '',
  9109. cellediting_clicksToEdit: 1,
  9110. columnLines: false,
  9111. rowLines: false,
  9112. border: false,
  9113. autoLoad: false,
  9114. remoteSort: false,
  9115. remoteFilter: false,
  9116. enableLocking: false,
  9117. enableColumnHide: false,
  9118. enableColumnMove: false,
  9119. gridfilters: false,
  9120. enableColumnResize: false,
  9121. sortOnClick: false,
  9122. hidden: false,
  9123. cls: '',
  9124. dataSource: {
  9125. url: '',
  9126. params: {
  9127. formData: '{form}',
  9128. },
  9129. },
  9130. listeners: {
  9131. beforeselect: '',
  9132. selectionchange: '',
  9133. itemclick: '',
  9134. itemdblclick: '',
  9135. cellClick: '',
  9136. celldblclick: '',
  9137. afterrender: '',
  9138. destory: '',
  9139. }
  9140. },
  9141. }
  9142. };
  9143. //# sourceMappingURL=YvgridDesign.model.js.map
  9144. var vjson$7 = {
  9145. title: '表格-高级',
  9146. height: 450,
  9147. width: 970,
  9148. layout: 'fit',
  9149. modal: true,
  9150. items: [
  9151. {
  9152. xtype: 'tabpanel',
  9153. items: [
  9154. {
  9155. title: '属性',
  9156. xtype: 'form',
  9157. scrollable: true,
  9158. items: [
  9159. {
  9160. xtype: 'cols',
  9161. items: [
  9162. {
  9163. xtype: 'textfield',
  9164. fieldLabel: '引用名',
  9165. tooltip: 'reference',
  9166. bind: '{vjson.reference}',
  9167. },
  9168. ]
  9169. },
  9170. {
  9171. xtype: 'cols',
  9172. border: false,
  9173. items: [
  9174. // 允许分页、页大小、页大小选项
  9175. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  9176. // 多选、显示勾选、自动勾选、
  9177. // 单击编辑、列分割线、行分割线、边框
  9178. // 数据源自动加载、后端排序、后端过滤
  9179. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  9180. {
  9181. xtype: 'checkbox',
  9182. fieldLabel: '允许分页',
  9183. bind: {
  9184. value: "{vjson.pagination}"
  9185. }
  9186. },
  9187. {
  9188. xtype: 'numberfield',
  9189. fieldLabel: '页大小',
  9190. bind: '{vjson.pageSize}',
  9191. },
  9192. {
  9193. xtype: 'textfield',
  9194. fieldLabel: '页大小选项',
  9195. flex: 2,
  9196. bind: '{vjson.pageSizeOption}',
  9197. },
  9198. ]
  9199. },
  9200. {
  9201. layout: 'hbox',
  9202. border: false,
  9203. items: [
  9204. {
  9205. xtype: 'combo',
  9206. fieldLabel: '选择模式',
  9207. flex: 4,
  9208. data: [
  9209. { id: 'spreadsheet', text: 'Excel模式' },
  9210. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  9211. { id: 'checkColumn', text: '勾选框' },
  9212. { id: 'row_mulity', text: '行选择-允许多选' },
  9213. { id: 'row_single', text: '行选择-单选' },
  9214. { id: 'disableSelection', text: '禁用' },
  9215. ],
  9216. bind: {
  9217. value: '{vjson.selectMode}'
  9218. }
  9219. }
  9220. ]
  9221. },
  9222. {
  9223. layout: 'hbox',
  9224. border: false,
  9225. defaults: {
  9226. xtype: 'checkbox',
  9227. margin: '0 15 0 0',
  9228. },
  9229. items: [
  9230. {
  9231. xtype: 'container',
  9232. margin: '3',
  9233. border: false,
  9234. width: 80,
  9235. },
  9236. {
  9237. boxLabel: '隐藏底部',
  9238. bind: {
  9239. value: "{vjson.hideFootbar}"
  9240. }
  9241. },
  9242. {
  9243. boxLabel: '隐藏刷新',
  9244. bind: {
  9245. value: "{vjson.hideRefresh}"
  9246. }
  9247. },
  9248. {
  9249. boxLabel: '隐藏导出',
  9250. bind: {
  9251. value: "{vjson.hideExport}"
  9252. }
  9253. },
  9254. {
  9255. boxLabel: '隐藏自动调宽',
  9256. bind: {
  9257. value: "{vjson.hideAutoSize}"
  9258. }
  9259. },
  9260. {
  9261. boxLabel: '隐藏清空筛选',
  9262. bind: {
  9263. value: "{vjson.hideClearFilter}"
  9264. }
  9265. },
  9266. {
  9267. boxLabel: '隐藏保存布局',
  9268. bind: {
  9269. value: "{vjson.hideSaveGridUIConfig}"
  9270. }
  9271. },
  9272. {
  9273. boxLabel: '隐藏重置布局',
  9274. bind: {
  9275. value: "{vjson.hideClearGridUIConfig}"
  9276. }
  9277. },
  9278. ]
  9279. },
  9280. {
  9281. layout: 'hbox',
  9282. border: false,
  9283. defaults: {
  9284. xtype: 'checkbox',
  9285. margin: '0 15 0 0',
  9286. },
  9287. items: [
  9288. {
  9289. xtype: 'container',
  9290. margin: '3',
  9291. border: false,
  9292. width: 80
  9293. },
  9294. {
  9295. boxLabel: '单击编辑',
  9296. bind: {
  9297. value: "{vjson.cellediting_clicksToEdit}"
  9298. }
  9299. },
  9300. {
  9301. boxLabel: '列分隔线',
  9302. bind: {
  9303. value: "{vjson.columnLines}"
  9304. }
  9305. },
  9306. {
  9307. boxLabel: '行分隔线',
  9308. bind: {
  9309. value: "{vjson.rowLines}"
  9310. }
  9311. },
  9312. {
  9313. boxLabel: '边框',
  9314. bind: {
  9315. value: "{vjson.border}"
  9316. }
  9317. },
  9318. ]
  9319. },
  9320. {
  9321. layout: 'hbox',
  9322. border: false,
  9323. defaults: {
  9324. xtype: 'checkbox',
  9325. margin: '0 15 0 0',
  9326. },
  9327. items: [
  9328. {
  9329. xtype: 'container',
  9330. margin: '3',
  9331. border: false,
  9332. width: 80
  9333. },
  9334. {
  9335. boxLabel: '数据源自动加载',
  9336. bind: {
  9337. value: "{vjson.autoLoad}"
  9338. }
  9339. },
  9340. {
  9341. boxLabel: '后端排序',
  9342. bind: {
  9343. value: "{vjson.remoteSort}"
  9344. }
  9345. },
  9346. {
  9347. boxLabel: '后端过滤',
  9348. bind: {
  9349. value: "{vjson.remoteFilter}"
  9350. }
  9351. },
  9352. ]
  9353. },
  9354. {
  9355. layout: 'hbox',
  9356. border: false,
  9357. defaults: {
  9358. xtype: 'checkbox',
  9359. margin: '0 15 0 0',
  9360. },
  9361. items: [
  9362. {
  9363. xtype: 'container',
  9364. margin: '3',
  9365. border: false,
  9366. width: 80
  9367. },
  9368. {
  9369. boxLabel: '自定义锁定',
  9370. bind: {
  9371. value: "{vjson.enableLocking}"
  9372. }
  9373. },
  9374. {
  9375. boxLabel: '自定义隐藏',
  9376. bind: {
  9377. value: "{vjson.enableColumnHide}"
  9378. }
  9379. },
  9380. {
  9381. boxLabel: '用户拖拽字段',
  9382. bind: {
  9383. value: "{vjson.enableColumnMove}"
  9384. }
  9385. },
  9386. {
  9387. boxLabel: '自定义筛选',
  9388. bind: {
  9389. value: "{vjson.gridfilters}"
  9390. }
  9391. },
  9392. {
  9393. boxLabel: '用户拖拽字段宽度',
  9394. bind: {
  9395. value: "{vjson.enableColumnResize}"
  9396. }
  9397. },
  9398. {
  9399. boxLabel: '点击列头排序',
  9400. bind: {
  9401. value: "{vjson.sortOnClick}"
  9402. }
  9403. },
  9404. {
  9405. xtype: 'checkbox',
  9406. boxLabel: '隐藏',
  9407. bind: {
  9408. value: "{vjson.hidden}"
  9409. }
  9410. },
  9411. ]
  9412. },
  9413. {
  9414. xtype: 'cols',
  9415. items: [
  9416. {
  9417. xtype: 'textfield',
  9418. fieldLabel: '样式',
  9419. bind: '{vjson.cls}',
  9420. flex: 4
  9421. },
  9422. ]
  9423. },
  9424. ]
  9425. },
  9426. {
  9427. title: '字段',
  9428. xtype: 'yvgrid',
  9429. reference: 'grid1',
  9430. pagination: false,
  9431. hideFootbar: true,
  9432. plugins: {
  9433. clipboard: true,
  9434. selectionreplicator: true
  9435. },
  9436. selModel: {
  9437. type: 'spreadsheet',
  9438. columnSelect: true,
  9439. pruneRemoved: false,
  9440. extensible: 'y'
  9441. },
  9442. listeners: {
  9443. editfinish: 'scope.gridEditFinish',
  9444. },
  9445. tbar: {
  9446. xtype: 'toolbar',
  9447. items: [
  9448. {
  9449. xtype: 'button',
  9450. text: '添加',
  9451. iconCls: 'x-fa fa-plus-circle',
  9452. listeners: {
  9453. click: 'scope.addColumn'
  9454. }
  9455. },
  9456. {
  9457. xtype: 'button',
  9458. text: '删除',
  9459. iconCls: 'x-fa fa-minus-circle',
  9460. listeners: {
  9461. click: 'scope.removeColumn'
  9462. }
  9463. },
  9464. '-',
  9465. {
  9466. xtype: 'button',
  9467. text: '自动分析',
  9468. iconCls: 'x-fa fa-code-fork',
  9469. listeners: {
  9470. click: 'scope.calcColumn'
  9471. }
  9472. },
  9473. {
  9474. xtype: 'button',
  9475. text: '上移',
  9476. iconCls: 'x-fa fa-arrow-up',
  9477. listeners: {
  9478. click: 'scope.moveUp'
  9479. }
  9480. },
  9481. {
  9482. xtype: 'button',
  9483. text: '下移',
  9484. iconCls: 'x-fa fa-arrow-down',
  9485. listeners: {
  9486. click: 'scope.moveDown'
  9487. }
  9488. },
  9489. ]
  9490. },
  9491. columns: [
  9492. { xtype: 'rownumberer' },
  9493. {
  9494. text: '字段',
  9495. dataIndex: 'dataIndex',
  9496. width: 140,
  9497. sortable: false,
  9498. menuDisabled: true,
  9499. editor: {
  9500. selectOnFocus: true,
  9501. },
  9502. },
  9503. {
  9504. text: '标题',
  9505. dataIndex: 'header',
  9506. width: 120,
  9507. sortable: false,
  9508. menuDisabled: true,
  9509. editor: {
  9510. selectOnFocus: true,
  9511. },
  9512. },
  9513. {
  9514. text: '类型',
  9515. dataIndex: 'xtype',
  9516. width: 100,
  9517. sortable: false,
  9518. menuDisabled: true,
  9519. editor: {
  9520. xtype: 'combo',
  9521. typeAhead: true,
  9522. triggerAction: 'all',
  9523. selectOnFocus: false,
  9524. listConfig: {
  9525. minWidth: 200
  9526. },
  9527. store: [
  9528. ['', '默认'],
  9529. ['rownum', 'rownum'],
  9530. ['checkcolumn', 'checkcolumn'],
  9531. ]
  9532. },
  9533. },
  9534. {
  9535. text: '数据类型',
  9536. dataIndex: 'dataType',
  9537. width: 100,
  9538. sortable: false,
  9539. menuDisabled: true,
  9540. editor: {
  9541. xtype: 'combo',
  9542. selectOnFocus: true,
  9543. listConfig: {
  9544. minWidth: 200
  9545. },
  9546. store: [
  9547. ['', '默认'],
  9548. ['string', 'string'],
  9549. ['number', 'number'],
  9550. ['date', 'date'],
  9551. ]
  9552. },
  9553. },
  9554. {
  9555. text: '编辑模式',
  9556. dataIndex: 'editor',
  9557. width: 100,
  9558. sortable: false,
  9559. menuDisabled: true,
  9560. editor: {
  9561. xtype: 'combo',
  9562. selectOnFocus: true,
  9563. listConfig: {
  9564. minWidth: 200
  9565. },
  9566. store: [
  9567. ['', ''],
  9568. ['textfield', 'textfield'],
  9569. ['numberfield', 'numberfield'],
  9570. ['combo', 'combo'],
  9571. ['combogrid', 'combogrid'],
  9572. ['datefield', 'datefield'],
  9573. ]
  9574. },
  9575. },
  9576. {
  9577. text: '宽度',
  9578. dataIndex: 'width',
  9579. align: 'right',
  9580. width: 100,
  9581. sortable: false,
  9582. menuDisabled: true,
  9583. editor: {
  9584. xtype: 'numberfield',
  9585. selectOnFocus: true,
  9586. minValue: 0,
  9587. maxValue: 1000
  9588. },
  9589. },
  9590. {
  9591. text: '权重',
  9592. dataIndex: 'flex',
  9593. align: 'right',
  9594. width: 90,
  9595. sortable: false,
  9596. menuDisabled: true,
  9597. editor: {
  9598. xtype: 'numberfield',
  9599. selectOnFocus: true,
  9600. minValue: 0,
  9601. maxValue: 10
  9602. },
  9603. },
  9604. {
  9605. text: '字典',
  9606. dataIndex: 'dict',
  9607. sortable: false,
  9608. menuDisabled: true,
  9609. width: 210,
  9610. editor: {
  9611. selectOnFocus: true,
  9612. },
  9613. },
  9614. {
  9615. text: '对齐',
  9616. dataIndex: 'align',
  9617. width: 90,
  9618. sortable: false,
  9619. menuDisabled: true,
  9620. editor: {
  9621. xtype: 'combo',
  9622. selectOnFocus: true,
  9623. listConfig: {
  9624. minWidth: 120
  9625. },
  9626. store: [
  9627. ['start', 'start'],
  9628. ['center', 'center'],
  9629. ['end', 'end'],
  9630. ]
  9631. },
  9632. },
  9633. {
  9634. text: '必填',
  9635. dataIndex: 'notAllowBlank',
  9636. width: 50,
  9637. resizable: false,
  9638. sortable: false,
  9639. menuDisabled: true,
  9640. xtype: 'checkcolumn',
  9641. },
  9642. {
  9643. text: '禁用',
  9644. dataIndex: 'disabled',
  9645. width: 50,
  9646. resizable: false,
  9647. sortable: false,
  9648. menuDisabled: true,
  9649. xtype: 'checkcolumn',
  9650. },
  9651. {
  9652. text: '禁菜',
  9653. dataIndex: 'menuDisabled',
  9654. width: 50,
  9655. resizable: false,
  9656. sortable: false,
  9657. menuDisabled: true,
  9658. xtype: 'checkcolumn',
  9659. },
  9660. {
  9661. text: '过滤',
  9662. dataIndex: 'filterable',
  9663. xtype: 'checkcolumn',
  9664. width: 50,
  9665. resizable: false,
  9666. sortable: false,
  9667. menuDisabled: true,
  9668. },
  9669. {
  9670. text: '隐藏',
  9671. dataIndex: 'hidden',
  9672. xtype: 'checkcolumn',
  9673. width: 50,
  9674. resizable: false,
  9675. sortable: false,
  9676. menuDisabled: true,
  9677. },
  9678. {
  9679. text: '可隐',
  9680. dataIndex: 'hideable',
  9681. xtype: 'checkcolumn',
  9682. width: 50,
  9683. resizable: false,
  9684. sortable: false,
  9685. menuDisabled: true,
  9686. },
  9687. {
  9688. text: '调宽',
  9689. dataIndex: 'resizable',
  9690. xtype: 'checkcolumn',
  9691. width: 50,
  9692. resizable: false,
  9693. sortable: false,
  9694. menuDisabled: true,
  9695. },
  9696. {
  9697. text: '排序',
  9698. dataIndex: 'sortable',
  9699. xtype: 'checkcolumn',
  9700. width: 50,
  9701. resizable: false,
  9702. sortable: false,
  9703. menuDisabled: true,
  9704. },
  9705. {
  9706. text: '适宽',
  9707. dataIndex: 'autoSize',
  9708. xtype: 'checkcolumn',
  9709. width: 50,
  9710. resizable: false,
  9711. sortable: false,
  9712. menuDisabled: true,
  9713. },
  9714. ],
  9715. },
  9716. {
  9717. title: '数据源',
  9718. layout: 'border',
  9719. listeners: {
  9720. activate: 'scope.dataSourceActivate'
  9721. },
  9722. items: [
  9723. {
  9724. region: 'north',
  9725. xtype: 'toolbar',
  9726. border: false,
  9727. items: [
  9728. {
  9729. xtype: 'textfield',
  9730. fieldLabel: '数据源',
  9731. flex: 1,
  9732. bind: {
  9733. value: '{vjson.dataSource.url}'
  9734. }
  9735. },
  9736. {
  9737. xtype: 'button',
  9738. text: '保存',
  9739. iconCls: 'x-fa fa-save',
  9740. listeners: {
  9741. click: 'scope.dataSourceSave'
  9742. }
  9743. },
  9744. {
  9745. xtype: 'button',
  9746. text: '读取',
  9747. iconCls: 'x-fa fa-folder-open',
  9748. listeners: {
  9749. click: 'scope.reloadSqlContent'
  9750. }
  9751. },
  9752. ]
  9753. },
  9754. {
  9755. region: 'center',
  9756. xtype: 'sqleditor',
  9757. layout: 'fit',
  9758. reference: 'sqlEditor',
  9759. },
  9760. {
  9761. region: 'south',
  9762. xtype: 'jsoneditor',
  9763. height: 200,
  9764. split: true,
  9765. collapsible: true,
  9766. title: '参数',
  9767. reference: 'sqlParams',
  9768. }
  9769. ]
  9770. },
  9771. {
  9772. title: '事件',
  9773. xtype: 'form',
  9774. scrollable: true,
  9775. margin: '10',
  9776. defaults: {
  9777. width: '100%',
  9778. labelAlign: 'top',
  9779. },
  9780. items: [
  9781. {
  9782. xtype: 'textfield',
  9783. fieldLabel: '选中前触发 beforeSelect',
  9784. bind: {
  9785. value: '{vjson.listeners.beforeselect}'
  9786. },
  9787. },
  9788. {
  9789. xtype: 'textfield',
  9790. fieldLabel: '选择范围改变 selectionChange',
  9791. bind: {
  9792. value: '{vjson.listeners.selectionchange}'
  9793. },
  9794. },
  9795. {
  9796. xtype: 'textfield',
  9797. fieldLabel: '行点击 itemClick',
  9798. bind: {
  9799. value: '{vjson.listeners.itemclick}'
  9800. },
  9801. },
  9802. {
  9803. xtype: 'textfield',
  9804. fieldLabel: '行双击 itemDblClick',
  9805. bind: {
  9806. value: '{vjson.listeners.itemdblclick}'
  9807. },
  9808. },
  9809. {
  9810. xtype: 'textfield',
  9811. fieldLabel: '单元格点击 cellClick',
  9812. bind: {
  9813. value: '{vjson.listeners.cellClick}'
  9814. },
  9815. },
  9816. {
  9817. xtype: 'textfield',
  9818. fieldLabel: '单元格双击 cellDblClick',
  9819. bind: {
  9820. value: '{vjson.listeners.celldblclick}'
  9821. },
  9822. },
  9823. {
  9824. xtype: 'textfield',
  9825. fieldLabel: '渲染后触发 afterrender',
  9826. bind: {
  9827. value: '{vjson.listeners.afterrender}'
  9828. },
  9829. },
  9830. {
  9831. xtype: 'textfield',
  9832. fieldLabel: '销毁后触发 destory',
  9833. bind: {
  9834. value: '{vjson.listeners.destory}'
  9835. },
  9836. },
  9837. ]
  9838. },
  9839. ],
  9840. }
  9841. ],
  9842. fbar: [
  9843. {
  9844. text: '应用', iconCls: 'x-fa fa-save',
  9845. listeners: {
  9846. click: 'scope.save'
  9847. }
  9848. },
  9849. '-',
  9850. {
  9851. text: '确定', iconCls: 'x-fa fa-check-circle',
  9852. listeners: {
  9853. click: 'scope.saveClose'
  9854. }
  9855. },
  9856. {
  9857. text: '取消', iconCls: 'x-fa fa-times-circle',
  9858. listeners: {
  9859. click: 'system.closeMe()'
  9860. }
  9861. },
  9862. ]
  9863. };
  9864. //# sourceMappingURL=YvgridDesign.view.js.map
  9865. var checkFlags = {};
  9866. // ------------------------------------------------------------------------------------------ impls
  9867. function jsViewToVJson(modulePage, jsView) {
  9868. if (!jsView)
  9869. return {};
  9870. jsView = jsView.replace(/^\s*export\s+default/, "");
  9871. jsView = _$2.trim(jsView) || "{}";
  9872. try {
  9873. var json = dist.parse(jsView);
  9874. return modulePage.addViewId(json);
  9875. }
  9876. catch (e) {
  9877. //@ts-ignore
  9878. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9879. }
  9880. }
  9881. function stringToJsonObj(jsonStr) {
  9882. if (!jsonStr)
  9883. return {};
  9884. try {
  9885. return dist.parse(jsonStr);
  9886. }
  9887. catch (e) {
  9888. return {};
  9889. }
  9890. }
  9891. /**
  9892. * 获取view.js 文件 string
  9893. */
  9894. function vjsonTojsView(vjson) {
  9895. var reVjson = _$2.cloneDeep(vjson);
  9896. removeDesignProp(reVjson);
  9897. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9898. }
  9899. var ModuleStore = /** @class */ (function (_super) {
  9900. __extends(ModuleStore, _super);
  9901. function ModuleStore() {
  9902. var _this = _super.call(this) || this;
  9903. _this.store = {};
  9904. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9905. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9906. _this.addModule(id, module, modulePage);
  9907. });
  9908. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9909. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9910. _this.onMainTabChange(moduleId, oldModuleId, from);
  9911. });
  9912. return _this;
  9913. }
  9914. ModuleStore.prototype.getCacheKey = function (param) {
  9915. return "filetree_data.json";
  9916. };
  9917. ModuleStore.prototype.invokeApi = function (param) {
  9918. return moduleTree();
  9919. };
  9920. ModuleStore.prototype.reloadModule = function (id) {
  9921. var moduleObject = this.store[id];
  9922. if (!moduleObject)
  9923. return;
  9924. var module = moduleObject.module;
  9925. getModuleFileContent(module).then(function (_a) {
  9926. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9927. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9928. moduleObject.lastModifyTime = lastModifyTime;
  9929. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9930. // 触发事件 ModuleItemChange
  9931. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9932. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  9933. vjson: moduleObject.moduleObj.vjson,
  9934. from: "reloadModule"
  9935. });
  9936. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9937. });
  9938. };
  9939. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9940. var _this = this;
  9941. window['mainWindow'].setLoading(true);
  9942. getModuleFileContent(module)
  9943. .then(function (_a) {
  9944. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9945. var moduleObject = {
  9946. id: id, module: module,
  9947. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9948. lastModifyTime: lastModifyTime,
  9949. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9950. modulePage: modulePage,
  9951. moduleEventBus: modulePage.moduleEventBus
  9952. };
  9953. _this.store[id] = moduleObject;
  9954. // 触发事件 ModuleItemChange
  9955. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9956. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9957. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9958. })
  9959. .finally(function () {
  9960. window['mainWindow'].setLoading(false);
  9961. });
  9962. };
  9963. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9964. if (this.store[moduleId]) {
  9965. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9966. }
  9967. };
  9968. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9969. var moduleObject = this.store[id];
  9970. moduleObject.fileContent.jsController = codeValue;
  9971. };
  9972. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9973. var moduleObject = this.store[id];
  9974. moduleObject.fileContent.jsView = codeValue;
  9975. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9976. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  9977. vjson: moduleObject.moduleObj.vjson,
  9978. from: from
  9979. });
  9980. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9981. };
  9982. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9983. var moduleObject = this.store[id];
  9984. moduleObject.fileContent.jsModel = codeValue;
  9985. };
  9986. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9987. var moduleObject = this.store[id];
  9988. moduleObject.fileContent.groovy = codeValue;
  9989. };
  9990. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  9991. var moduleObject = this.store[id];
  9992. moduleObject.fileContent.mybatis = codeValue;
  9993. };
  9994. ModuleStore.prototype.getModuleObject = function (id) {
  9995. return this.store[id];
  9996. };
  9997. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  9998. if (checkFlags[moduleId] === 1) {
  9999. // @ts-ignore
  10000. system.msg("正在检测文件是否有外部修改,请稍后操作");
  10001. }
  10002. eventBus.publish(EventType.StopCheckModule, {});
  10003. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  10004. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  10005. saveFile(fileFullPath, fileContent).then(function (res) {
  10006. if (res.data && res.data.lastModified) {
  10007. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  10008. }
  10009. }).finally(function () {
  10010. eventBus.publish(EventType.RunCheckModule, {});
  10011. });
  10012. };
  10013. ModuleStore.prototype.check = function (moduleId) {
  10014. {
  10015. return;
  10016. }
  10017. };
  10018. return ModuleStore;
  10019. }(CacheStore));
  10020. // ------------------------------------------------------------------------------------------ use
  10021. var moduleStore = new ModuleStore();
  10022. var VjsonExchange = /** @class */ (function () {
  10023. function VjsonExchange(vjson) {
  10024. this.pendingSet = true;
  10025. this.vjsonOrigin = _$2.cloneDeep(vjson);
  10026. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  10027. }
  10028. /**
  10029. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  10030. * @param propName
  10031. * @param value
  10032. */
  10033. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10034. if (this.pendingSet) {
  10035. return;
  10036. }
  10037. // selectMode
  10038. // pageSizeOption
  10039. // cellediting_clicksToEdit
  10040. msg$1('' + propName + '=' + value);
  10041. _$2.set(this.vjson, propName, value);
  10042. };
  10043. /**
  10044. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10045. */
  10046. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10047. var _a, _b, _c;
  10048. if (this.pendingSet) {
  10049. return;
  10050. }
  10051. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10052. // 如果不使用默认属性,就直接设定 undefined
  10053. var vs = {
  10054. dataIndex: undefined,
  10055. header: undefined,
  10056. xtype: '',
  10057. width: undefined,
  10058. flex: undefined,
  10059. align: 'start',
  10060. editor: undefined,
  10061. dataType: 'string',
  10062. dict: undefined,
  10063. disabled: false,
  10064. menuDisabled: false,
  10065. notAllowBlank: false,
  10066. filterable: true,
  10067. hidden: false,
  10068. hideable: true,
  10069. resizable: true,
  10070. sortable: true,
  10071. autoSize: true,
  10072. };
  10073. var raw = record.get('raw');
  10074. if (raw === undefined || raw == null) {
  10075. raw = {};
  10076. record.set('raw', raw);
  10077. }
  10078. var setRaw = function (propName, value) {
  10079. if (typeof value === 'undefined' || value == null) {
  10080. msg$1("delete columns[" + rowIdx + "]." + propName);
  10081. delete raw[propName];
  10082. return;
  10083. }
  10084. var defaultValue = vs[propName];
  10085. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10086. // 要设的值,与默认值相同,就直接删除这个属性
  10087. msg$1("delete columns[" + rowIdx + "]." + propName);
  10088. delete raw[propName];
  10089. return;
  10090. }
  10091. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10092. _$2.set(raw, propName, value);
  10093. };
  10094. if (!vs.hasOwnProperty(propName)) {
  10095. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10096. return;
  10097. }
  10098. else if (propName === 'dict') {
  10099. if (value) {
  10100. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10101. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10102. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10103. }
  10104. }
  10105. else {
  10106. setRaw('fix', undefined);
  10107. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10108. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10109. delete raw.editor.fix;
  10110. }
  10111. }
  10112. }
  10113. else if (propName === 'xtype') {
  10114. if (!value) {
  10115. setRaw('xtype', undefined);
  10116. }
  10117. else {
  10118. setRaw('xtype', value);
  10119. }
  10120. }
  10121. else if (propName === 'notAllowBlank') {
  10122. setRaw('editor.allowBlank', !value);
  10123. }
  10124. else if (propName === 'editor') {
  10125. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10126. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10127. value = undefined;
  10128. }
  10129. // editor.xtype
  10130. if (!value) {
  10131. // 不需要编辑器
  10132. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10133. msg$1("delete columns[" + rowIdx + "].editor");
  10134. delete raw.editor;
  10135. record.set('notAllowBlank', false);
  10136. }
  10137. }
  10138. else {
  10139. setRaw('editor.xtype', value);
  10140. var dict = record.get('dict');
  10141. if (value === 'combo' && dict) {
  10142. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10143. }
  10144. }
  10145. }
  10146. else if (propName === 'width') {
  10147. var width = value;
  10148. var flex = record.get('flex');
  10149. if (!width && !flex) {
  10150. setRaw('width', undefined);
  10151. setRaw('flex', undefined);
  10152. record.set('flex', undefined);
  10153. record.set('width', undefined);
  10154. return;
  10155. }
  10156. else if (!!width) {
  10157. setRaw('flex', undefined);
  10158. record.set('flex', undefined);
  10159. setRaw('width', width);
  10160. return;
  10161. }
  10162. }
  10163. else if (propName === 'flex') {
  10164. var width = record.get('width');
  10165. var flex = value;
  10166. if (!width && !flex) {
  10167. setRaw('width', undefined);
  10168. setRaw('flex', undefined);
  10169. record.set('flex', undefined);
  10170. record.set('width', undefined);
  10171. return;
  10172. }
  10173. else if (!!flex) {
  10174. setRaw('width', undefined);
  10175. record.set('width', undefined);
  10176. setRaw('flex', flex);
  10177. return;
  10178. }
  10179. }
  10180. else {
  10181. // 其他属性,作为同名属性,与 raw 同步
  10182. setRaw(propName, value);
  10183. }
  10184. };
  10185. /**
  10186. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10187. */
  10188. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10189. var _this = this;
  10190. var vs = [
  10191. 'reference', 'pagination', 'pageSize',
  10192. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10193. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10194. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10195. 'listeners.beforeselect',
  10196. 'listeners.selectionchange',
  10197. 'listeners.itemclick',
  10198. 'listeners.itemdblclick',
  10199. 'listeners.cellClick',
  10200. 'listeners.celldblclick',
  10201. 'listeners.afterrender',
  10202. 'listeners.destory',
  10203. ];
  10204. _$2.forEach(vs, function (v) {
  10205. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10206. });
  10207. };
  10208. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10209. var me = this;
  10210. return function (value) {
  10211. me.setPropValue(propName, value);
  10212. };
  10213. };
  10214. VjsonExchange.prototype.parseModel = function () {
  10215. var _this = this;
  10216. 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;
  10217. //@ts-ignore
  10218. var df = YvanUI.Defaults.grid;
  10219. var vjson = _$2.assign({}, df, this.vjson);
  10220. var model = {
  10221. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10222. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10223. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10224. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10225. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10226. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10227. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10228. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10229. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10230. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10231. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10232. selectMode: 'spreadsheet',
  10233. cellediting_clicksToEdit: true,
  10234. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10235. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10236. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10237. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10238. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10239. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10240. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10241. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10242. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10243. gridfilters: true,
  10244. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10245. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10246. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10247. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10248. columns: [],
  10249. listeners: {
  10250. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10251. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10252. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10253. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10254. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10255. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10256. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10257. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10258. }
  10259. };
  10260. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10261. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10262. }
  10263. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10264. if (_$2.get(vjson, 'disableSelection') == true) {
  10265. model.selectMode = 'disableSelection';
  10266. }
  10267. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10268. model.selectMode = 'spreadsheet';
  10269. }
  10270. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10271. model.selectMode = 'onlyCheckColumn';
  10272. }
  10273. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10274. model.selectMode = 'checkColumn';
  10275. }
  10276. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10277. model.selectMode = 'row_mulity';
  10278. }
  10279. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10280. model.selectMode = 'row_single';
  10281. }
  10282. else {
  10283. model.selectMode = 'row_single';
  10284. }
  10285. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10286. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10287. model.dataSource = {
  10288. url: _$2.get(vjson, 'dataSource.url'),
  10289. //@ts-ignore
  10290. params: _$2.get(vjson, 'dataSource.params')
  10291. };
  10292. }
  10293. _$2.forEach(vjson.columns, function (column) {
  10294. model.columns.push(_this.parseColumn(column));
  10295. });
  10296. return model;
  10297. };
  10298. VjsonExchange.prototype.parseColumn = function (column) {
  10299. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10300. var model = {
  10301. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10302. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10303. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10304. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10305. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10306. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10307. editor: '',
  10308. editParam: '',
  10309. dict: '',
  10310. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10311. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10312. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10313. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10314. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10315. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10316. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10317. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10318. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10319. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10320. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10321. raw: _$2.cloneDeep(column),
  10322. };
  10323. // width / flex 只能留一个属性, 或者全不留
  10324. if (model.width <= 0 && model.flex <= 0) {
  10325. delete model.width;
  10326. delete model.flex;
  10327. }
  10328. else if (model.width > 0) {
  10329. delete model.flex;
  10330. }
  10331. else {
  10332. delete model.width;
  10333. }
  10334. // editor
  10335. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10336. model.editor = _$2.get(column, 'editor.xtype');
  10337. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10338. if (!model.editor) {
  10339. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10340. model.editor = 'textfield';
  10341. }
  10342. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10343. msg$1('不可识别的 editor.xtype=' + model.editor);
  10344. console.error('不可识别的 editor.xtype', column);
  10345. }
  10346. if (_$2.get(column, 'editor.allowBlank') === false) {
  10347. model.notAllowBlank = true;
  10348. }
  10349. }
  10350. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10351. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10352. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10353. if (match && match[1]) {
  10354. model.dict = match[1];
  10355. }
  10356. }
  10357. return model;
  10358. };
  10359. return VjsonExchange;
  10360. }());
  10361. //
  10362. //# sourceMappingURL=YvgridExchange.js.map
  10363. var YvgridDesign = /** @class */ (function (_super) {
  10364. __extends(YvgridDesign, _super);
  10365. function YvgridDesign(moduleId) {
  10366. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10367. _this.moduleId = '';
  10368. _this.name = 'YvgridDesign';
  10369. _this.dataSourceIsActived = false;
  10370. _this.setModuleId(moduleId);
  10371. return _this;
  10372. }
  10373. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10374. var _this = this;
  10375. this.moduleId = moduleId;
  10376. if (this.componentSelectionChangeSubscribe) {
  10377. this.componentSelectionChangeSubscribe.cancel();
  10378. this.componentSelectionChangeSubscribe = null;
  10379. }
  10380. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10381. var id = _a.id, from = _a.from;
  10382. _this.onComponentSelectionChange(id, from);
  10383. });
  10384. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10385. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10386. if (vj.xtype !== 'yvgrid') {
  10387. throw Error('非 yvgrid 组件');
  10388. }
  10389. this.vjsonExchange = new VjsonExchange(vj);
  10390. };
  10391. YvgridDesign.prototype.onLoad = function () {
  10392. var _this = this;
  10393. var model = this.vjsonExchange.parseModel();
  10394. this.vjsonExchange.pendingSet = true;
  10395. mergeViewModel(this.viewModel, "vjson", model, false);
  10396. this.refs.grid1.setData(model.columns);
  10397. this.vjsonExchange.attachViewModel(this.viewModel);
  10398. _$2.defer(function () {
  10399. _this.vjsonExchange.pendingSet = false;
  10400. });
  10401. };
  10402. YvgridDesign.prototype.moveUp = function (sender) {
  10403. var grid = sender.up('grid');
  10404. grid.rowMoveUp();
  10405. };
  10406. YvgridDesign.prototype.moveDown = function (sender) {
  10407. var grid = sender.up('grid');
  10408. grid.rowMoveDown();
  10409. };
  10410. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10411. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10412. };
  10413. YvgridDesign.prototype.reloadSqlContent = function () {
  10414. var _this = this;
  10415. var url = this.viewModel.get('vjson.dataSource.url');
  10416. if (url) {
  10417. loadSqlContentApi(url).then(function (res) {
  10418. _this.refs.sqlEditor.setCode('');
  10419. if (res.success) {
  10420. _this.refs.sqlEditor.setCode(res.data.content);
  10421. }
  10422. }).catch(function () {
  10423. _this.refs.sqlEditor.setCode('');
  10424. });
  10425. }
  10426. };
  10427. YvgridDesign.prototype.dataSourceSave = function () {
  10428. var url = this.viewModel.get('vjson.dataSource.url');
  10429. if (!url) {
  10430. msg$1('必须填写 groovy/SQL 模块路径');
  10431. return;
  10432. }
  10433. var content = this.refs.sqlEditor.getCode();
  10434. saveSqlContentApi(url, content).then(function (res) {
  10435. if (res.success) {
  10436. msg$1('保存成功');
  10437. }
  10438. else {
  10439. msg$1(res.msg);
  10440. }
  10441. });
  10442. };
  10443. YvgridDesign.prototype.dataSourceActivate = function () {
  10444. if (!this.dataSourceIsActived) {
  10445. // 激活
  10446. this.reloadSqlContent();
  10447. var params = this.viewModel.get('vjson.dataSource.params');
  10448. if (_$2.isObject(params)) {
  10449. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10450. }
  10451. this.dataSourceIsActived = true;
  10452. }
  10453. };
  10454. // 外部控件选择发生改变
  10455. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10456. if (!id || from === this.name) {
  10457. return;
  10458. }
  10459. this.setVjson(id);
  10460. };
  10461. YvgridDesign.prototype.setVjson = function (id) {
  10462. // 找到对应的组件 判断是不是表格
  10463. };
  10464. YvgridDesign.prototype.save = function () {
  10465. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10466. if (this.dataSourceIsActived) {
  10467. var url = this.viewModel.get('vjson.dataSource.url');
  10468. // 解析 params
  10469. var paramsString = this.refs.sqlParams.getCode('');
  10470. var params = undefined;
  10471. if (paramsString) {
  10472. try {
  10473. params = window['YvanUI'].json5.parse(paramsString);
  10474. }
  10475. catch (e) {
  10476. msg$1('dataSource.params 格式非法,请检查');
  10477. return;
  10478. }
  10479. }
  10480. if (typeof params === 'undefined') {
  10481. params = this.viewModel.get('vjson.dataSource.params');
  10482. }
  10483. if (url) {
  10484. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10485. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10486. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10487. }
  10488. else {
  10489. delete this.vjsonExchange.vjson['dataSource'];
  10490. }
  10491. }
  10492. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10493. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10494. from: this.name,
  10495. ignoreRenderUI: false
  10496. });
  10497. };
  10498. YvgridDesign.prototype.saveClose = function () {
  10499. this.save();
  10500. this.close();
  10501. };
  10502. YvgridDesign.prototype.addColumn = function () {
  10503. this.refs.grid1.appendEditRow({
  10504. dataIndex: '',
  10505. header: '',
  10506. xtype: '',
  10507. width: 80,
  10508. align: '',
  10509. editor: '',
  10510. editParam: '',
  10511. dict: '',
  10512. disabled: false,
  10513. notAllowBlank: false,
  10514. menuDisabled: false,
  10515. filterable: false,
  10516. hidden: false,
  10517. hideable: true,
  10518. resizable: true,
  10519. sortable: true,
  10520. locked: false,
  10521. lockable: false,
  10522. autoSize: true,
  10523. raw: undefined,
  10524. }, 'header');
  10525. };
  10526. YvgridDesign.prototype.removeColumn = function () {
  10527. var _this = this;
  10528. var rows = [];
  10529. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10530. rows.push(r);
  10531. });
  10532. _$2.forEach(rows, function (r) {
  10533. _this.refs.grid1.getStore().remove(r);
  10534. });
  10535. };
  10536. YvgridDesign.prototype.calcColumn = function () {
  10537. msg$1('暂未实现');
  10538. };
  10539. YvgridDesign.prototype.onDestroy = function () {
  10540. if (this.componentSelectionChangeSubscribe) {
  10541. this.componentSelectionChangeSubscribe.cancel();
  10542. this.componentSelectionChangeSubscribe = null;
  10543. }
  10544. };
  10545. return YvgridDesign;
  10546. }(Scope));
  10547. //# sourceMappingURL=YvgridDesign.js.map
  10548. // export const idPrefix = "_ds_"
  10549. var _designInstance;
  10550. function setDesignInstance(instance) {
  10551. _designInstance = instance;
  10552. }
  10553. function getDesignInstance() {
  10554. return _designInstance;
  10555. }
  10556. function delegateDragmove(node, source, info) {
  10557. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10558. //@ts-ignore
  10559. _designInstance.dragmove(node, source, info);
  10560. }
  10561. }
  10562. function delegateDragend(node, source, info) {
  10563. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10564. //@ts-ignore
  10565. _designInstance.dragend(node, source, info);
  10566. }
  10567. }
  10568. //# sourceMappingURL=DropHelper.js.map
  10569. var YvanUI$1 = window['YvanUI'];
  10570. var _$1 = window["_"];
  10571. var Ext$1 = window['Ext'];
  10572. var $$1 = window["$"];
  10573. var historySize = 100;
  10574. var ViewDesign = /** @class */ (function () {
  10575. function ViewDesign(moduleId, reference) {
  10576. var _this = this;
  10577. this.name = "ViewDesign";
  10578. this.expandedVjsonObjArray = [];
  10579. // 编辑历史
  10580. this.undoVjsonList = [];
  10581. // 撤销历史
  10582. this.redoVjsonList = [];
  10583. // 订阅事件列表
  10584. this.subscribeList = [];
  10585. // private getOuterCopyValueTimer: any = null
  10586. /**
  10587. * 唯一编号
  10588. */
  10589. this.id = _$1.uniqueId("_dv");
  10590. this.moduleId = moduleId;
  10591. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10592. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10593. this.designReference = reference;
  10594. this.designElement = reference.ariaEl.dom;
  10595. this.$overlay.appendTo(this.designElement);
  10596. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10597. // 添加到撤销
  10598. this.lastVjson = _$1.cloneDeep(this.vjson);
  10599. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10600. event.stopPropagation();
  10601. event.preventDefault();
  10602. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10603. });
  10604. this.$overlay.on('click', '.studio_mask', function (event) {
  10605. event.stopPropagation();
  10606. event.preventDefault();
  10607. _this.clearSelection();
  10608. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10609. _$1.defer(function () {
  10610. _this.$overlay.focus();
  10611. });
  10612. });
  10613. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10614. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10615. this.$overlay.on('copy', this.onCopy.bind(this));
  10616. this.$overlay.on('paste', this.onPaste.bind(this));
  10617. this.$overlay.on('focus', this.onfocus.bind(this));
  10618. // this.$overlay.on('mouseenter', ()=>{
  10619. // clearTimeout(this.getOuterCopyValueTimer);
  10620. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10621. // })
  10622. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10623. _this.onMousemove(event);
  10624. }, 300, { maxWait: 500 }).bind(this));
  10625. window.addEventListener('message', this.onMessageEvent.bind(this));
  10626. this.subscribe();
  10627. setDesignInstance(this);
  10628. }
  10629. // todo ======== 方法 ==========
  10630. ViewDesign.prototype.subscribe = function () {
  10631. var _this = this;
  10632. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10633. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10634. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10635. _this.setVjson(vjson, from, ignoreRenderUI);
  10636. }));
  10637. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10638. var id = _a.id, from = _a.from;
  10639. _this.onComponentSelectionChange(id, from);
  10640. }));
  10641. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10642. var id = _a.id, from = _a.from;
  10643. _this.onComponentDelete(id, from);
  10644. }));
  10645. };
  10646. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10647. if (vjson === void 0) { vjson = this.vjson; }
  10648. if (from === void 0) { from = this.name; }
  10649. this.vjson = vjson;
  10650. if (from !== "undo" && from !== "redo") {
  10651. if (this.undoVjsonList.length >= 100) {
  10652. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10653. }
  10654. this.undoVjsonList.push(this.lastVjson);
  10655. }
  10656. this.lastVjson = _$1.cloneDeep(vjson);
  10657. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10658. };
  10659. /**
  10660. * 覆盖层点击事件
  10661. */
  10662. ViewDesign.prototype.overlayClickFunction = function (event) {
  10663. if (!event.altKey && !event.shiftKey) {
  10664. var target = this.findElByXY(event.clientX, event.clientY);
  10665. if (target) {
  10666. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10667. var extHandle = Ext$1.get(target).component;
  10668. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10669. rect.x = position.x;
  10670. rect.y = position.y;
  10671. this.clearSelection();
  10672. this.appendMaskbox(rect, extHandle.id);
  10673. }
  10674. }
  10675. };
  10676. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10677. if (dragType === void 0) { dragType = ""; }
  10678. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10679. var ele = document.elementsFromPoint(x, y);
  10680. if (ele.length <= 1) {
  10681. return;
  10682. }
  10683. var target = null;
  10684. for (var i = 0; i < ele.length; i++) {
  10685. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10686. 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) {
  10687. switch (dragType) {
  10688. case "cols-container":
  10689. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10690. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10691. target = ele[i];
  10692. }
  10693. break;
  10694. case "col-item":
  10695. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10696. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10697. target = ele[i];
  10698. }
  10699. break;
  10700. case "rows-container":
  10701. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10702. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10703. target = ele[i];
  10704. }
  10705. break;
  10706. case "row-item":
  10707. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10708. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10709. target = ele[i];
  10710. }
  10711. break;
  10712. default:
  10713. target = ele[i];
  10714. break;
  10715. }
  10716. if (target) {
  10717. break;
  10718. }
  10719. }
  10720. }
  10721. return target;
  10722. };
  10723. /**
  10724. * 清空选择项
  10725. */
  10726. ViewDesign.prototype.clearSelection = function () {
  10727. // $(this.designElement).removeClass('selected');
  10728. // // $(this.designElement).find('.selected').removeClass('selected')
  10729. // $(this.designElement).find('.ds_mask')
  10730. // .not('.mask_not_hide')
  10731. // .remove();
  10732. $$1('.studio_mask').remove();
  10733. // $(this.designElement).find('.selected').each(function () {
  10734. // $(this).removeClass('selected');
  10735. // // const extHandle = Ext.get(this).component
  10736. // // if (extHandle) {
  10737. // // extHandle.removeCls('selected')
  10738. // // }
  10739. // })
  10740. };
  10741. /**
  10742. * 添加遮罩层
  10743. */
  10744. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10745. var that = this;
  10746. if (vjsonId) {
  10747. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10748. }
  10749. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10750. // return item === cj.xtype
  10751. // }) >= 0
  10752. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10753. 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>");
  10754. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10755. this.$mask.css({
  10756. position: 'absolute',
  10757. top: top, left: left, width: width, height: height,
  10758. border: '2px dashed #1890ff',
  10759. zIndex: 100,
  10760. });
  10761. this.$mask.appendTo(this.$overlay);
  10762. this.$mask.on("click", ".ds_del", function (e) {
  10763. e.stopPropagation();
  10764. e.preventDefault();
  10765. that.deleteComponent(vjsonId);
  10766. });
  10767. // 点击选中父级
  10768. this.$mask.on('click', '.ds_parent', function (e) {
  10769. e.stopPropagation();
  10770. e.preventDefault();
  10771. that.selectParent(vjsonId);
  10772. });
  10773. var sel = document.getElementById(vjsonId);
  10774. var sVjosn = findInCode(this.vjson, vjsonId);
  10775. // 限制可以拖动的组件
  10776. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10777. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10778. this.dragSource = new Ext$1.drag.Source({
  10779. element: this.$mask[0],
  10780. constrain: this.$overlay[0],
  10781. listeners: {
  10782. dragmove: this.dragmove.bind(that, this.vjson),
  10783. dragend: this.dragend.bind(that, this.vjson)
  10784. },
  10785. startRect: rect,
  10786. sourceVjson: findInCode(this.vjson, vjsonId),
  10787. sourceVjsonId: vjsonId,
  10788. dragType: dragType
  10789. });
  10790. }
  10791. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10792. };
  10793. /**
  10794. * 选中某个选项
  10795. */
  10796. ViewDesign.prototype.setSelection = function (id) {
  10797. var _a, _b;
  10798. if (!this.designElement) {
  10799. return;
  10800. }
  10801. // 清空选中内容
  10802. this.clearSelection();
  10803. if (!id) {
  10804. return;
  10805. }
  10806. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10807. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10808. rect.x = position.x;
  10809. rect.y = position.y;
  10810. this.appendMaskbox(rect, id);
  10811. };
  10812. /**
  10813. * 删除组件
  10814. * @param id
  10815. */
  10816. ViewDesign.prototype.deleteComponent = function (id) {
  10817. deletVjsonById(this.vjson, id);
  10818. this.moduleObject.modulePage.currentComponentSelectId = null;
  10819. this.setVjson();
  10820. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10821. this.clearSelection();
  10822. };
  10823. ViewDesign.prototype.selectParent = function (id) {
  10824. var pid = getSuperVjsonId(this.vjson, id);
  10825. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10826. this.setSelection(pid);
  10827. };
  10828. // todo ====== 拖拽事件 ======
  10829. ViewDesign.prototype.dragmove = function (node, source, info) {
  10830. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10831. if (!target) {
  10832. return;
  10833. }
  10834. var rect = target.getBoundingClientRect();
  10835. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10836. var extHandle = Ext$1.get(target).component;
  10837. if (!extHandle) {
  10838. return;
  10839. }
  10840. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10841. rect.x = position.x;
  10842. rect.y = position.y;
  10843. this.appendDirection(rect, extHandle.id, direction);
  10844. };
  10845. ViewDesign.prototype.dragend = function (node, source, info) {
  10846. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10847. if (!target) {
  10848. return;
  10849. }
  10850. var rect = target.getBoundingClientRect();
  10851. var extHandle = Ext$1.get(target).component;
  10852. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10853. if (!extHandle) {
  10854. return;
  10855. }
  10856. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10857. this.removeDirection();
  10858. };
  10859. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10860. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10861. var cv = findInCode(this.vjson, vjsonId);
  10862. if (this.$direction) {
  10863. $$1('#direction' + this.id).remove();
  10864. }
  10865. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10866. //
  10867. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10868. if (direction) {
  10869. if (direction === "top") {
  10870. // direction = 'center'
  10871. height = height / 4;
  10872. }
  10873. else if (direction === "bottom") {
  10874. // direction = 'center'
  10875. top = top + height / 4 * 3;
  10876. height = height / 4;
  10877. }
  10878. else if (direction === "left") {
  10879. width = width / 4;
  10880. }
  10881. else if (direction === "right") {
  10882. left = left + width / 4 * 3;
  10883. width = width / 4;
  10884. }
  10885. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10886. this.$direction.css({
  10887. position: 'absolute',
  10888. top: top, left: left, width: width, height: height,
  10889. // border: '2px dashed #1890ff',
  10890. background: 'rgba(40,224,218,0.75)',
  10891. zIndex: 100,
  10892. });
  10893. this.$direction.appendTo(this.$overlay);
  10894. // }
  10895. }
  10896. };
  10897. ViewDesign.prototype.removeDirection = function () {
  10898. if (this.$direction) {
  10899. this.$direction.remove();
  10900. this.$direction = null;
  10901. }
  10902. };
  10903. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10904. var arrS;
  10905. if (sourceVjId) {
  10906. arrS = findArrayContainer(this.vjson, sourceVjId);
  10907. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10908. var indexS = _$1.findIndex(arrS, function (v) {
  10909. return v.id === sourceVjId;
  10910. });
  10911. if (indexS < 0) {
  10912. return;
  10913. }
  10914. }
  10915. delete sourceVjson.id;
  10916. var vjsonT = findInCode(this.vjson, targetVjId);
  10917. var arrT = findArrayContainer(this.vjson, targetVjId);
  10918. var indexT = _$1.findIndex(arrT, function (v) {
  10919. return v.id === targetVjId;
  10920. });
  10921. if (indexT < 0) {
  10922. return;
  10923. }
  10924. switch (direction) {
  10925. case 'top':
  10926. case 'left':
  10927. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10928. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10929. vjsonT.items.splice(0, 0, sourceVjson);
  10930. }
  10931. else {
  10932. arrT.splice(indexT, 0, sourceVjson);
  10933. }
  10934. break;
  10935. case 'bottom':
  10936. case 'right':
  10937. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10938. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10939. vjsonT.items.push(sourceVjson);
  10940. }
  10941. else {
  10942. arrT.splice(indexT + 1, 0, sourceVjson);
  10943. }
  10944. break;
  10945. case 'center':
  10946. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10947. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10948. vjsonT.items.push(sourceVjson);
  10949. }
  10950. else {
  10951. arrT.splice(indexT, 1, sourceVjson);
  10952. }
  10953. break;
  10954. }
  10955. if (sourceVjId) {
  10956. deletVjsonById(this.vjson, sourceVjId);
  10957. sourceVjson.id = sourceVjId;
  10958. }
  10959. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10960. };
  10961. // todo ======== 事件 ==========
  10962. // 接收 postMessage 事件分发
  10963. ViewDesign.prototype.onMessageEvent = function (event) {
  10964. var _a, _b;
  10965. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10966. if (fucName && typeof this[fucName] === 'function') {
  10967. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10968. }
  10969. };
  10970. // 接收外部选中组件事件
  10971. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10972. if (from !== this.name) {
  10973. this.setSelection(id);
  10974. }
  10975. };
  10976. // 接收外部组件删除事件
  10977. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10978. if (from !== this.name) {
  10979. this.deleteComponent(id);
  10980. }
  10981. };
  10982. // 组件被选中
  10983. ViewDesign.prototype.onComponentSelect = function (args) {
  10984. if (args[2] != this.moduleId) {
  10985. return;
  10986. }
  10987. if (args[0]) {
  10988. var rect = args[0];
  10989. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10990. rect.x = position.x;
  10991. rect.y = position.y;
  10992. this.clearSelection();
  10993. this.appendMaskbox(rect, args[1]);
  10994. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  10995. }
  10996. };
  10997. ViewDesign.prototype.onComponentInfo = function (_a) {
  10998. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  10999. if (moduleId != this.moduleId) {
  11000. return;
  11001. }
  11002. if (rect) {
  11003. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11004. rect.x = position.x;
  11005. rect.y = position.y;
  11006. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  11007. var cv_1 = findInCode(this.vjson, vjsonId);
  11008. if (this.$direction) {
  11009. $$1('#direction' + this.id).remove();
  11010. }
  11011. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  11012. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  11013. if (direction) {
  11014. if (direction === "top") {
  11015. direction = 'center';
  11016. //height = height/3
  11017. }
  11018. else if (direction === "bottom") {
  11019. direction = 'center';
  11020. // top=top+height/3*2
  11021. // height = height/3
  11022. }
  11023. else if (direction === "left") {
  11024. width = width / 3;
  11025. }
  11026. else if (direction === "right") {
  11027. left = left + width / 3 * 2;
  11028. width = width / 3;
  11029. }
  11030. this.$direction = $$1("<div id='direction" + this.id + "'>");
  11031. this.$direction.css({
  11032. position: 'absolute',
  11033. top: top, left: left, width: width, height: height,
  11034. // border: '2px dashed #1890ff',
  11035. background: 'rgba(74,106,201,0.42)',
  11036. zIndex: 100,
  11037. });
  11038. this.$direction.appendTo(this.$overlay);
  11039. }
  11040. }
  11041. console.log("direction", direction);
  11042. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11043. // rect.x = position.x
  11044. // rect.y = position.y
  11045. // this.clearSelection()
  11046. // this.appendMaskbox(rect, args[1])
  11047. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11048. }
  11049. };
  11050. ViewDesign.prototype.onUndo = function () {
  11051. if (this.undoVjsonList.length > 0) {
  11052. if (this.redoVjsonList.length >= 100) {
  11053. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11054. }
  11055. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11056. this.vjson = this.undoVjsonList.pop();
  11057. // this.setVjson(this.vjson, "", false, "undo")
  11058. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11059. }
  11060. };
  11061. ViewDesign.prototype.onRedo = function () {
  11062. if (this.redoVjsonList.length > 0) {
  11063. if (this.undoVjsonList.length >= 100) {
  11064. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11065. }
  11066. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11067. this.vjson = this.redoVjsonList.pop();
  11068. // this.setVjson(this.vjson, "", false, "redo")
  11069. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11070. }
  11071. };
  11072. ViewDesign.prototype.onKeyPress = function (event) {
  11073. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11074. // if (this.backStep()) {
  11075. // event.stopPropagation()
  11076. // event.preventDefault()
  11077. // return
  11078. // }
  11079. // }
  11080. //
  11081. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11082. // if (this.recoverStep()) {
  11083. // event.stopPropagation()
  11084. // event.preventDefault()
  11085. // return
  11086. // }
  11087. // }
  11088. // if (event.key === 'ArrowUp') {
  11089. // if (this.selectParent()) {
  11090. // event.stopPropagation()
  11091. // event.preventDefault()
  11092. // return;
  11093. // }
  11094. // }
  11095. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11096. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11097. event.stopPropagation();
  11098. event.preventDefault();
  11099. return;
  11100. }
  11101. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11102. // if (this.copyView()) {
  11103. // event.stopPropagation()
  11104. // event.preventDefault()
  11105. // return;
  11106. // }
  11107. // }
  11108. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11109. // if (this.copyView(true)) {
  11110. // event.stopPropagation()
  11111. // event.preventDefault()
  11112. // return;
  11113. // }
  11114. // }
  11115. //
  11116. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11117. // if (this.selectRoot()) {
  11118. // event.stopPropagation()
  11119. // event.preventDefault()
  11120. // return;
  11121. // }
  11122. //
  11123. };
  11124. ViewDesign.prototype.onCopy = function (event) {
  11125. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11126. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11127. if (copyVjson) {
  11128. removeDesignProp(copyVjson);
  11129. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11130. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11131. }
  11132. }
  11133. };
  11134. ViewDesign.prototype.onPaste = function (event) {
  11135. debugger;
  11136. };
  11137. ViewDesign.prototype.onfocus = function () {
  11138. console.log("getCopy");
  11139. console.log("document.activeElement", document.activeElement.id);
  11140. // clearTimeout(this.getOuterCopyValueTimer);
  11141. // native.clipboardRead()
  11142. };
  11143. ViewDesign.prototype.onMousemove = function (event) {
  11144. var _a;
  11145. if (document.activeElement.id === this.$overlay[0].id) {
  11146. // console.log(event.clientX, event.clientY)
  11147. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11148. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11149. // this.iframeWindow.postMessage({
  11150. // method: 'overlayGetInfo',
  11151. // args: [position, this.moduleId]
  11152. // }, '*')
  11153. }
  11154. }
  11155. };
  11156. ViewDesign.prototype.onDestroy = function () {
  11157. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11158. for (var i = 0; i < this.subscribeList.length; i++) {
  11159. this.subscribeList[i].cancel();
  11160. }
  11161. };
  11162. // todo ======== 工具方法 ==========
  11163. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11164. if (relative === void 0) { relative = null; }
  11165. if (from === "main" && to === "overlay") {
  11166. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11167. var x = overlayRect.x;
  11168. var y = overlayRect.y;
  11169. if (relative) {
  11170. var relativeRect = relative.getBoundingClientRect();
  11171. console.log("main->", relativeRect.x, relativeRect.y);
  11172. x = x - relativeRect.x;
  11173. y = y - relativeRect.y;
  11174. }
  11175. pos.x = pos.x - x;
  11176. pos.y = pos.y - y;
  11177. }
  11178. else if (from === "overlay" && to === "main") {
  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("iframe->", 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. return pos;
  11192. };
  11193. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11194. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11195. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11196. return "center";
  11197. }
  11198. // col-item 只能放左右
  11199. if (dragType === "col-item" || dragType === "") {
  11200. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11201. if (x > rect.x && x < rect.x + rect.width / 3) {
  11202. return "left";
  11203. }
  11204. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11205. return "right";
  11206. }
  11207. }
  11208. }
  11209. // cols-container 只能放上下
  11210. if (dragType === "cols-container" || dragType === "") {
  11211. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11212. if (y > rect.y && y < rect.y + rect.height / 3) {
  11213. return "top";
  11214. }
  11215. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11216. return "bottom";
  11217. }
  11218. }
  11219. }
  11220. return "";
  11221. };
  11222. return ViewDesign;
  11223. }());
  11224. //
  11225. //# sourceMappingURL=ViewDesign.js.map
  11226. var model$8 = {
  11227. data: {
  11228. iframeSrc: ''
  11229. }
  11230. };
  11231. //# sourceMappingURL=ModulePage.model.js.map
  11232. var vjson$8 = {
  11233. layout: 'fit',
  11234. border: false,
  11235. iconCls: 'x-fa fa-newspaper-o',
  11236. referenceHolder: true,
  11237. items: [
  11238. {
  11239. layout: 'border',
  11240. border: false,
  11241. items: [
  11242. {
  11243. region: 'center',
  11244. xtype: 'tabpanel',
  11245. border: false,
  11246. tabPosition: 'bottom',
  11247. reference: 'tabPanel',
  11248. listeners: {
  11249. tabchange: 'scope.tabchange'
  11250. },
  11251. defaults: {
  11252. border: false,
  11253. },
  11254. items: [
  11255. {
  11256. title: 'controller.js',
  11257. xtype: 'jseditor',
  11258. reference: 'controllerEditor',
  11259. },
  11260. {
  11261. title: 'view.design',
  11262. xtype: 'designer',
  11263. reference: 'designer',
  11264. listeners: {
  11265. afterrender: 'scope.previewRender'
  11266. },
  11267. },
  11268. {
  11269. title: 'view.js',
  11270. xtype: 'jseditor',
  11271. reference: 'viewEditor',
  11272. },
  11273. {
  11274. title: 'model.js',
  11275. xtype: 'jseditor',
  11276. reference: 'modelEditor',
  11277. },
  11278. {
  11279. title: 'groovy',
  11280. xtype: 'groovyeditor',
  11281. reference: 'groovyEditor',
  11282. },
  11283. {
  11284. title: 'SQL',
  11285. xtype: 'sqleditor',
  11286. reference: 'sqlEditor',
  11287. }
  11288. ]
  11289. }
  11290. ]
  11291. }
  11292. ]
  11293. };
  11294. //# sourceMappingURL=ModulePage.view.js.map
  11295. var ModulePage = /** @class */ (function (_super) {
  11296. __extends(ModulePage, _super);
  11297. function ModulePage(moduleId, module) {
  11298. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11299. _this.name = "ModulePage";
  11300. _this.viewDesign = null;
  11301. _this.maxViewId = 0;
  11302. _this.moduleEventBus = new EventBus();
  11303. _this.codeChange = _$2.debounce(function (code, from, e) {
  11304. try {
  11305. switch (from) {
  11306. case _this.refs.controllerEditor.name:
  11307. moduleStore.updateJsController(_this.moduleId, code, from);
  11308. break;
  11309. case _this.refs.viewEditor.name:
  11310. moduleStore.updateJsView(_this.moduleId, code, from);
  11311. break;
  11312. case _this.refs.modelEditor.name:
  11313. moduleStore.updateJsModel(_this.moduleId, code, from);
  11314. break;
  11315. case _this.refs.groovyEditor.name:
  11316. moduleStore.updateGroovy(_this.moduleId, code, from);
  11317. break;
  11318. case _this.refs.sqlEditor.name:
  11319. moduleStore.updateMybatis(_this.moduleId, code, from);
  11320. break;
  11321. }
  11322. }
  11323. catch (e) {
  11324. }
  11325. }, 500, { maxWait: 10000 });
  11326. _this.moduleId = moduleId;
  11327. _this.module = module;
  11328. _this.cancelSubscribe = [];
  11329. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11330. _this.initEditor(moduleItem);
  11331. }));
  11332. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11333. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11334. _this.previewReRender();
  11335. }));
  11336. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11337. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11338. _this.updateVjson(vjson, from, ignoreRenderUI);
  11339. }));
  11340. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11341. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11342. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11343. }));
  11344. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11345. var id = _a.id, from = _a.from;
  11346. _this.onComponentSelectionChange(id, from);
  11347. }));
  11348. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11349. _this.onUndo();
  11350. }));
  11351. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11352. _this.onRedo();
  11353. }));
  11354. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11355. _this.currentCopyVjson = stringToJsonObj(value);
  11356. }));
  11357. return _this;
  11358. }
  11359. ModulePage.prototype.onLoad = function () {
  11360. var _this = this;
  11361. // this.refs.preview.src = href
  11362. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11363. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11364. _this.saveCall();
  11365. }));
  11366. this.activeEditor = this.refs.controllerEditor;
  11367. this.refs.controllerEditor.modulePage = this;
  11368. this.refs.viewEditor.modulePage = this;
  11369. this.refs.modelEditor.modulePage = this;
  11370. this.refs.groovyEditor.modulePage = this;
  11371. this.refs.sqlEditor.modulePage = this;
  11372. this.refs.controllerEditor.name = "controllerEditor";
  11373. this.refs.viewEditor.name = "viewEditor";
  11374. this.refs.modelEditor.name = "modelEditor";
  11375. this.refs.groovyEditor.name = "groovyEditor";
  11376. this.refs.sqlEditor.name = "sqlEditor";
  11377. this.refs.controllerEditor.codeChange = this.codeChange;
  11378. this.refs.viewEditor.codeChange = this.codeChange;
  11379. this.refs.modelEditor.codeChange = this.codeChange;
  11380. this.refs.groovyEditor.codeChange = this.codeChange;
  11381. this.refs.sqlEditor.codeChange = this.codeChange;
  11382. };
  11383. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11384. if (!cmpVjson || from === this.name) {
  11385. return;
  11386. }
  11387. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11388. replaceVjsonById(vj, cmpVjson);
  11389. this.updateVjson(vj, from, ignoreRenderUI);
  11390. };
  11391. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11392. var _this = this;
  11393. var _a, _b;
  11394. if (!vjson || from === this.name) {
  11395. return;
  11396. }
  11397. this.addViewId(vjson);
  11398. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11399. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11400. (_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);
  11401. this.previewReRender();
  11402. _$2.defer(function () {
  11403. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11404. });
  11405. };
  11406. ModulePage.prototype.previewRender = function (sender) {
  11407. var _this = this;
  11408. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11409. if (!this.designScope) {
  11410. this.designScope = new Scope({
  11411. vjson: vjson,
  11412. model: {
  11413. data: {}
  11414. }
  11415. });
  11416. }
  11417. else {
  11418. this.designScope.vjson = vjson;
  11419. }
  11420. this.designScope.showDesigner(sender, {
  11421. moduleId: this.moduleId,
  11422. });
  11423. if (this.viewDesign) {
  11424. return;
  11425. }
  11426. _$2.defer(function () {
  11427. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11428. handles$1.mainWindow.setLoading(false);
  11429. });
  11430. };
  11431. ModulePage.prototype.previewReRender = function () {
  11432. var designer = this.refs.designer;
  11433. this.previewRender(designer);
  11434. };
  11435. ModulePage.prototype.initEditor = function (moduleItem) {
  11436. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11437. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11438. return;
  11439. (_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);
  11440. (_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);
  11441. (_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);
  11442. (_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);
  11443. (_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);
  11444. };
  11445. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11446. this.currentComponentSelectId = id;
  11447. };
  11448. ModulePage.prototype.onUndo = function () {
  11449. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11450. this.viewDesign.onUndo();
  11451. }
  11452. };
  11453. ModulePage.prototype.onRedo = function () {
  11454. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11455. this.viewDesign.onRedo();
  11456. }
  11457. };
  11458. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11459. this.activeEditor = newCard;
  11460. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11461. };
  11462. ModulePage.prototype.saveCall = function () {
  11463. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11464. moduleStore.saveFile(this.moduleId, "jsView");
  11465. }
  11466. else if (this.activeEditor === this.refs.controllerEditor) {
  11467. moduleStore.saveFile(this.moduleId, "jsController");
  11468. }
  11469. else if (this.activeEditor === this.refs.modelEditor) {
  11470. moduleStore.saveFile(this.moduleId, "jsModel");
  11471. }
  11472. else if (this.activeEditor === this.refs.groovyEditor) {
  11473. moduleStore.saveFile(this.moduleId, "groovy");
  11474. }
  11475. else if (this.activeEditor === this.refs.sqlEditor) {
  11476. moduleStore.saveFile(this.moduleId, "mybatis");
  11477. }
  11478. };
  11479. ModulePage.prototype.check = function () {
  11480. moduleStore.check(this.moduleId);
  11481. };
  11482. /**
  11483. * 为vjson添加id
  11484. * @param vjson
  11485. * @param isAll
  11486. */
  11487. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11488. var _this = this;
  11489. if (isAll === void 0) { isAll = false; }
  11490. var maxIdTag = 0;
  11491. // 先提取当前的最大id
  11492. deepTravVJson(vjson, function (obj) {
  11493. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11494. return;
  11495. }
  11496. if (obj.id && obj.id.indexOf(idPrefix)) {
  11497. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11498. if (sutr.length > 0) {
  11499. var tid = sutr.replace(idPrefix, "");
  11500. var idNum = parseInt(tid);
  11501. if (idNum && maxIdTag < idNum) {
  11502. maxIdTag = idNum;
  11503. }
  11504. }
  11505. }
  11506. });
  11507. // 标记最大的id号,避免重复
  11508. this.maxViewId = maxIdTag;
  11509. deepTravVJson(vjson, function (obj) {
  11510. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11511. return;
  11512. }
  11513. if (!obj.hasOwnProperty('id')) {
  11514. obj.id = _this.createViewId();
  11515. }
  11516. if (!obj.hasOwnProperty('designMode')) {
  11517. obj.designMode = true;
  11518. }
  11519. // if (obj.xtype == "tabview" && obj.activeTab) {
  11520. // // 设置默认的选项
  11521. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11522. // if (typeof obj.activeTab === 'number') {
  11523. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11524. // } else if (typeof obj.activeTab === 'string') {
  11525. // this._tabViewSelect[obj.id] = obj.activeTab
  11526. // }
  11527. //
  11528. // }
  11529. // }
  11530. if (isAll && obj.hasOwnProperty("view")) ;
  11531. });
  11532. return vjson;
  11533. };
  11534. /**
  11535. * 为组件创建 ID
  11536. */
  11537. ModulePage.prototype.createViewId = function () {
  11538. this.maxViewId++;
  11539. return this.id + idPrefix + this.maxViewId;
  11540. };
  11541. ModulePage.prototype.onDestroy = function () {
  11542. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11543. this.cancelSubscribe[i].cancel();
  11544. }
  11545. _super.prototype.onDestroy.call(this);
  11546. };
  11547. return ModulePage;
  11548. }(Scope));
  11549. //# sourceMappingURL=ModulePage.js.map
  11550. var camundaModdleDescriptor = {
  11551. "name": "Camunda",
  11552. "uri": "http://camunda.org/schema/1.0/bpmn",
  11553. "prefix": "camunda",
  11554. "xml": {
  11555. "tagAlias": "lowerCase"
  11556. },
  11557. "associations": [],
  11558. "types": [
  11559. {
  11560. "name": "Definitions",
  11561. "isAbstract": true,
  11562. "extends": [
  11563. "bpmn:Definitions"
  11564. ],
  11565. "properties": [
  11566. {
  11567. "name": "diagramRelationId",
  11568. "isAttr": true,
  11569. "type": "String"
  11570. }
  11571. ]
  11572. },
  11573. {
  11574. "name": "InOutBinding",
  11575. "superClass": [
  11576. "Element"
  11577. ],
  11578. "isAbstract": true,
  11579. "properties": [
  11580. {
  11581. "name": "source",
  11582. "isAttr": true,
  11583. "type": "String"
  11584. },
  11585. {
  11586. "name": "sourceExpression",
  11587. "isAttr": true,
  11588. "type": "String"
  11589. },
  11590. {
  11591. "name": "target",
  11592. "isAttr": true,
  11593. "type": "String"
  11594. },
  11595. {
  11596. "name": "businessKey",
  11597. "isAttr": true,
  11598. "type": "String"
  11599. },
  11600. {
  11601. "name": "local",
  11602. "isAttr": true,
  11603. "type": "Boolean",
  11604. "default": false
  11605. },
  11606. {
  11607. "name": "variables",
  11608. "isAttr": true,
  11609. "type": "String"
  11610. }
  11611. ]
  11612. },
  11613. {
  11614. "name": "In",
  11615. "superClass": [
  11616. "InOutBinding"
  11617. ],
  11618. "meta": {
  11619. "allowedIn": [
  11620. "bpmn:CallActivity",
  11621. "bpmn:SignalEventDefinition"
  11622. ]
  11623. }
  11624. },
  11625. {
  11626. "name": "Out",
  11627. "superClass": [
  11628. "InOutBinding"
  11629. ],
  11630. "meta": {
  11631. "allowedIn": [
  11632. "bpmn:CallActivity"
  11633. ]
  11634. }
  11635. },
  11636. {
  11637. "name": "AsyncCapable",
  11638. "isAbstract": true,
  11639. "extends": [
  11640. "bpmn:Activity",
  11641. "bpmn:Gateway",
  11642. "bpmn:Event"
  11643. ],
  11644. "properties": [
  11645. {
  11646. "name": "async",
  11647. "isAttr": true,
  11648. "type": "Boolean",
  11649. "default": false
  11650. },
  11651. {
  11652. "name": "asyncBefore",
  11653. "isAttr": true,
  11654. "type": "Boolean",
  11655. "default": false
  11656. },
  11657. {
  11658. "name": "asyncAfter",
  11659. "isAttr": true,
  11660. "type": "Boolean",
  11661. "default": false
  11662. },
  11663. {
  11664. "name": "exclusive",
  11665. "isAttr": true,
  11666. "type": "Boolean",
  11667. "default": true
  11668. }
  11669. ]
  11670. },
  11671. {
  11672. "name": "JobPriorized",
  11673. "isAbstract": true,
  11674. "extends": [
  11675. "bpmn:Process",
  11676. "camunda:AsyncCapable"
  11677. ],
  11678. "properties": [
  11679. {
  11680. "name": "jobPriority",
  11681. "isAttr": true,
  11682. "type": "String"
  11683. }
  11684. ]
  11685. },
  11686. {
  11687. "name": "SignalEventDefinitionExtension",
  11688. "isAbstract": true,
  11689. "extends": [
  11690. "bpmn:SignalEventDefinition"
  11691. ],
  11692. "properties": [
  11693. {
  11694. "name": "async",
  11695. "isAttr": true,
  11696. "type": "Boolean",
  11697. "default": false
  11698. }
  11699. ]
  11700. },
  11701. {
  11702. "name": "ErrorEventDefinitionExtension",
  11703. "isAbstract": true,
  11704. "extends": [
  11705. "bpmn:ErrorEventDefinition"
  11706. ],
  11707. "properties": [
  11708. {
  11709. "name": "errorCodeVariable",
  11710. "isAttr": true,
  11711. "type": "String"
  11712. },
  11713. {
  11714. "name": "errorMessageVariable",
  11715. "isAttr": true,
  11716. "type": "String"
  11717. }
  11718. ]
  11719. },
  11720. {
  11721. "name": "ErrorEventDefinition",
  11722. "superClass": [
  11723. "bpmn:ErrorEventDefinition",
  11724. "Element"
  11725. ],
  11726. "properties": [
  11727. {
  11728. "name": "expression",
  11729. "isAttr": true,
  11730. "type": "String"
  11731. }
  11732. ],
  11733. "meta": {
  11734. "allowedIn": ["bpmn:ServiceTask"]
  11735. }
  11736. },
  11737. {
  11738. "name": "Error",
  11739. "isAbstract": true,
  11740. "extends": [
  11741. "bpmn:Error"
  11742. ],
  11743. "properties": [
  11744. {
  11745. "name": "camunda:errorMessage",
  11746. "isAttr": true,
  11747. "type": "String"
  11748. }
  11749. ]
  11750. },
  11751. {
  11752. "name": "PotentialStarter",
  11753. "superClass": [
  11754. "Element"
  11755. ],
  11756. "properties": [
  11757. {
  11758. "name": "resourceAssignmentExpression",
  11759. "type": "bpmn:ResourceAssignmentExpression"
  11760. }
  11761. ]
  11762. },
  11763. {
  11764. "name": "FormSupported",
  11765. "isAbstract": true,
  11766. "extends": [
  11767. "bpmn:StartEvent",
  11768. "bpmn:UserTask"
  11769. ],
  11770. "properties": [
  11771. {
  11772. "name": "formHandlerClass",
  11773. "isAttr": true,
  11774. "type": "String"
  11775. },
  11776. {
  11777. "name": "formKey",
  11778. "isAttr": true,
  11779. "type": "String"
  11780. },
  11781. {
  11782. "name": "formRef",
  11783. "isAttr": true,
  11784. "type": "String"
  11785. },
  11786. {
  11787. "name": "formRefBinding",
  11788. "isAttr": true,
  11789. "type": "String"
  11790. },
  11791. {
  11792. "name": "formRefVersion",
  11793. "isAttr": true,
  11794. "type": "String"
  11795. }
  11796. ]
  11797. },
  11798. {
  11799. "name": "TemplateSupported",
  11800. "isAbstract": true,
  11801. "extends": [
  11802. "bpmn:Collaboration",
  11803. "bpmn:Process",
  11804. "bpmn:FlowElement"
  11805. ],
  11806. "properties": [
  11807. {
  11808. "name": "modelerTemplate",
  11809. "isAttr": true,
  11810. "type": "String"
  11811. },
  11812. {
  11813. "name": "modelerTemplateVersion",
  11814. "isAttr": true,
  11815. "type": "Integer"
  11816. }
  11817. ]
  11818. },
  11819. {
  11820. "name": "Initiator",
  11821. "isAbstract": true,
  11822. "extends": ["bpmn:StartEvent"],
  11823. "properties": [
  11824. {
  11825. "name": "initiator",
  11826. "isAttr": true,
  11827. "type": "String"
  11828. }
  11829. ]
  11830. },
  11831. {
  11832. "name": "ScriptTask",
  11833. "isAbstract": true,
  11834. "extends": [
  11835. "bpmn:ScriptTask"
  11836. ],
  11837. "properties": [
  11838. {
  11839. "name": "resultVariable",
  11840. "isAttr": true,
  11841. "type": "String"
  11842. },
  11843. {
  11844. "name": "resource",
  11845. "isAttr": true,
  11846. "type": "String"
  11847. }
  11848. ]
  11849. },
  11850. {
  11851. "name": "Process",
  11852. "isAbstract": true,
  11853. "extends": [
  11854. "bpmn:Process"
  11855. ],
  11856. "properties": [
  11857. {
  11858. "name": "candidateStarterGroups",
  11859. "isAttr": true,
  11860. "type": "String"
  11861. },
  11862. {
  11863. "name": "candidateStarterUsers",
  11864. "isAttr": true,
  11865. "type": "String"
  11866. },
  11867. {
  11868. "name": "versionTag",
  11869. "isAttr": true,
  11870. "type": "String"
  11871. },
  11872. {
  11873. "name": "historyTimeToLive",
  11874. "isAttr": true,
  11875. "type": "String"
  11876. },
  11877. {
  11878. "name": "isStartableInTasklist",
  11879. "isAttr": true,
  11880. "type": "Boolean",
  11881. "default": true
  11882. }
  11883. ]
  11884. },
  11885. {
  11886. "name": "EscalationEventDefinitionExtension",
  11887. "isAbstract": true,
  11888. "extends": [
  11889. "bpmn:EscalationEventDefinition"
  11890. ],
  11891. "properties": [
  11892. {
  11893. "name": "escalationCodeVariable",
  11894. "isAttr": true,
  11895. "type": "String"
  11896. }
  11897. ]
  11898. },
  11899. {
  11900. "name": "FormalExpression",
  11901. "isAbstract": true,
  11902. "extends": [
  11903. "bpmn:FormalExpression"
  11904. ],
  11905. "properties": [
  11906. {
  11907. "name": "resource",
  11908. "isAttr": true,
  11909. "type": "String"
  11910. }
  11911. ]
  11912. },
  11913. {
  11914. "name": "Assignable",
  11915. "extends": ["bpmn:UserTask"],
  11916. "properties": [
  11917. {
  11918. "name": "assignee",
  11919. "isAttr": true,
  11920. "type": "String"
  11921. },
  11922. {
  11923. "name": "candidateUsers",
  11924. "isAttr": true,
  11925. "type": "String"
  11926. },
  11927. {
  11928. "name": "candidateGroups",
  11929. "isAttr": true,
  11930. "type": "String"
  11931. },
  11932. {
  11933. "name": "dueDate",
  11934. "isAttr": true,
  11935. "type": "String"
  11936. },
  11937. {
  11938. "name": "followUpDate",
  11939. "isAttr": true,
  11940. "type": "String"
  11941. },
  11942. {
  11943. "name": "priority",
  11944. "isAttr": true,
  11945. "type": "String"
  11946. }
  11947. ]
  11948. },
  11949. {
  11950. "name": "CallActivity",
  11951. "extends": ["bpmn:CallActivity"],
  11952. "properties": [
  11953. {
  11954. "name": "calledElementBinding",
  11955. "isAttr": true,
  11956. "type": "String",
  11957. "default": "latest"
  11958. },
  11959. {
  11960. "name": "calledElementVersion",
  11961. "isAttr": true,
  11962. "type": "String"
  11963. },
  11964. {
  11965. "name": "calledElementVersionTag",
  11966. "isAttr": true,
  11967. "type": "String"
  11968. },
  11969. {
  11970. "name": "calledElementTenantId",
  11971. "isAttr": true,
  11972. "type": "String"
  11973. },
  11974. {
  11975. "name": "caseRef",
  11976. "isAttr": true,
  11977. "type": "String"
  11978. },
  11979. {
  11980. "name": "caseBinding",
  11981. "isAttr": true,
  11982. "type": "String",
  11983. "default": "latest"
  11984. },
  11985. {
  11986. "name": "caseVersion",
  11987. "isAttr": true,
  11988. "type": "String"
  11989. },
  11990. {
  11991. "name": "caseTenantId",
  11992. "isAttr": true,
  11993. "type": "String"
  11994. },
  11995. {
  11996. "name": "variableMappingClass",
  11997. "isAttr": true,
  11998. "type": "String"
  11999. },
  12000. {
  12001. "name": "variableMappingDelegateExpression",
  12002. "isAttr": true,
  12003. "type": "String"
  12004. }
  12005. ]
  12006. },
  12007. {
  12008. "name": "ServiceTaskLike",
  12009. "extends": [
  12010. "bpmn:ServiceTask",
  12011. "bpmn:BusinessRuleTask",
  12012. "bpmn:SendTask",
  12013. "bpmn:MessageEventDefinition"
  12014. ],
  12015. "properties": [
  12016. {
  12017. "name": "expression",
  12018. "isAttr": true,
  12019. "type": "String"
  12020. },
  12021. {
  12022. "name": "class",
  12023. "isAttr": true,
  12024. "type": "String"
  12025. },
  12026. {
  12027. "name": "delegateExpression",
  12028. "isAttr": true,
  12029. "type": "String"
  12030. },
  12031. {
  12032. "name": "resultVariable",
  12033. "isAttr": true,
  12034. "type": "String"
  12035. }
  12036. ]
  12037. },
  12038. {
  12039. "name": "DmnCapable",
  12040. "extends": [
  12041. "bpmn:BusinessRuleTask"
  12042. ],
  12043. "properties": [
  12044. {
  12045. "name": "decisionRef",
  12046. "isAttr": true,
  12047. "type": "String"
  12048. },
  12049. {
  12050. "name": "decisionRefBinding",
  12051. "isAttr": true,
  12052. "type": "String",
  12053. "default": "latest"
  12054. },
  12055. {
  12056. "name": "decisionRefVersion",
  12057. "isAttr": true,
  12058. "type": "String"
  12059. },
  12060. {
  12061. "name": "mapDecisionResult",
  12062. "isAttr": true,
  12063. "type": "String",
  12064. "default": "resultList"
  12065. },
  12066. {
  12067. "name": "decisionRefTenantId",
  12068. "isAttr": true,
  12069. "type": "String"
  12070. }
  12071. ]
  12072. },
  12073. {
  12074. "name": "ExternalCapable",
  12075. "extends": [
  12076. "camunda:ServiceTaskLike"
  12077. ],
  12078. "properties": [
  12079. {
  12080. "name": "type",
  12081. "isAttr": true,
  12082. "type": "String"
  12083. },
  12084. {
  12085. "name": "topic",
  12086. "isAttr": true,
  12087. "type": "String"
  12088. }
  12089. ]
  12090. },
  12091. {
  12092. "name": "TaskPriorized",
  12093. "extends": [
  12094. "bpmn:Process",
  12095. "camunda:ExternalCapable"
  12096. ],
  12097. "properties": [
  12098. {
  12099. "name": "taskPriority",
  12100. "isAttr": true,
  12101. "type": "String"
  12102. }
  12103. ]
  12104. },
  12105. {
  12106. "name": "Properties",
  12107. "superClass": [
  12108. "Element"
  12109. ],
  12110. "meta": {
  12111. "allowedIn": ["*"]
  12112. },
  12113. "properties": [
  12114. {
  12115. "name": "values",
  12116. "type": "Property",
  12117. "isMany": true
  12118. }
  12119. ]
  12120. },
  12121. {
  12122. "name": "Property",
  12123. "superClass": [
  12124. "Element"
  12125. ],
  12126. "properties": [
  12127. {
  12128. "name": "id",
  12129. "type": "String",
  12130. "isAttr": true
  12131. },
  12132. {
  12133. "name": "name",
  12134. "type": "String",
  12135. "isAttr": true
  12136. },
  12137. {
  12138. "name": "value",
  12139. "type": "String",
  12140. "isAttr": true
  12141. }
  12142. ]
  12143. },
  12144. {
  12145. "name": "Connector",
  12146. "superClass": [
  12147. "Element"
  12148. ],
  12149. "meta": {
  12150. "allowedIn": [
  12151. "camunda:ServiceTaskLike"
  12152. ]
  12153. },
  12154. "properties": [
  12155. {
  12156. "name": "inputOutput",
  12157. "type": "InputOutput"
  12158. },
  12159. {
  12160. "name": "connectorId",
  12161. "type": "String"
  12162. }
  12163. ]
  12164. },
  12165. {
  12166. "name": "InputOutput",
  12167. "superClass": [
  12168. "Element"
  12169. ],
  12170. "meta": {
  12171. "allowedIn": [
  12172. "bpmn:FlowNode",
  12173. "camunda:Connector"
  12174. ]
  12175. },
  12176. "properties": [
  12177. {
  12178. "name": "inputOutput",
  12179. "type": "InputOutput"
  12180. },
  12181. {
  12182. "name": "connectorId",
  12183. "type": "String"
  12184. },
  12185. {
  12186. "name": "inputParameters",
  12187. "isMany": true,
  12188. "type": "InputParameter"
  12189. },
  12190. {
  12191. "name": "outputParameters",
  12192. "isMany": true,
  12193. "type": "OutputParameter"
  12194. }
  12195. ]
  12196. },
  12197. {
  12198. "name": "InputOutputParameter",
  12199. "properties": [
  12200. {
  12201. "name": "name",
  12202. "isAttr": true,
  12203. "type": "String"
  12204. },
  12205. {
  12206. "name": "value",
  12207. "isBody": true,
  12208. "type": "String"
  12209. },
  12210. {
  12211. "name": "definition",
  12212. "type": "InputOutputParameterDefinition"
  12213. }
  12214. ]
  12215. },
  12216. {
  12217. "name": "InputOutputParameterDefinition",
  12218. "isAbstract": true
  12219. },
  12220. {
  12221. "name": "List",
  12222. "superClass": ["InputOutputParameterDefinition"],
  12223. "properties": [
  12224. {
  12225. "name": "items",
  12226. "isMany": true,
  12227. "type": "InputOutputParameterDefinition"
  12228. }
  12229. ]
  12230. },
  12231. {
  12232. "name": "Map",
  12233. "superClass": ["InputOutputParameterDefinition"],
  12234. "properties": [
  12235. {
  12236. "name": "entries",
  12237. "isMany": true,
  12238. "type": "Entry"
  12239. }
  12240. ]
  12241. },
  12242. {
  12243. "name": "Entry",
  12244. "properties": [
  12245. {
  12246. "name": "key",
  12247. "isAttr": true,
  12248. "type": "String"
  12249. },
  12250. {
  12251. "name": "value",
  12252. "isBody": true,
  12253. "type": "String"
  12254. },
  12255. {
  12256. "name": "definition",
  12257. "type": "InputOutputParameterDefinition"
  12258. }
  12259. ]
  12260. },
  12261. {
  12262. "name": "Value",
  12263. "superClass": [
  12264. "InputOutputParameterDefinition"
  12265. ],
  12266. "properties": [
  12267. {
  12268. "name": "id",
  12269. "isAttr": true,
  12270. "type": "String"
  12271. },
  12272. {
  12273. "name": "name",
  12274. "isAttr": true,
  12275. "type": "String"
  12276. },
  12277. {
  12278. "name": "value",
  12279. "isBody": true,
  12280. "type": "String"
  12281. }
  12282. ]
  12283. },
  12284. {
  12285. "name": "Script",
  12286. "superClass": ["InputOutputParameterDefinition"],
  12287. "properties": [
  12288. {
  12289. "name": "scriptFormat",
  12290. "isAttr": true,
  12291. "type": "String"
  12292. },
  12293. {
  12294. "name": "resource",
  12295. "isAttr": true,
  12296. "type": "String"
  12297. },
  12298. {
  12299. "name": "value",
  12300. "isBody": true,
  12301. "type": "String"
  12302. }
  12303. ]
  12304. },
  12305. {
  12306. "name": "Field",
  12307. "superClass": ["Element"],
  12308. "meta": {
  12309. "allowedIn": [
  12310. "camunda:ServiceTaskLike",
  12311. "camunda:ExecutionListener",
  12312. "camunda:TaskListener"
  12313. ]
  12314. },
  12315. "properties": [
  12316. {
  12317. "name": "name",
  12318. "isAttr": true,
  12319. "type": "String"
  12320. },
  12321. {
  12322. "name": "expression",
  12323. "type": "String"
  12324. },
  12325. {
  12326. "name": "stringValue",
  12327. "isAttr": true,
  12328. "type": "String"
  12329. },
  12330. {
  12331. "name": "string",
  12332. "type": "String"
  12333. }
  12334. ]
  12335. },
  12336. {
  12337. "name": "InputParameter",
  12338. "superClass": ["InputOutputParameter"]
  12339. },
  12340. {
  12341. "name": "OutputParameter",
  12342. "superClass": ["InputOutputParameter"]
  12343. },
  12344. {
  12345. "name": "Collectable",
  12346. "isAbstract": true,
  12347. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12348. "superClass": ["camunda:AsyncCapable"],
  12349. "properties": [
  12350. {
  12351. "name": "collection",
  12352. "isAttr": true,
  12353. "type": "String"
  12354. },
  12355. {
  12356. "name": "elementVariable",
  12357. "isAttr": true,
  12358. "type": "String"
  12359. }
  12360. ]
  12361. },
  12362. {
  12363. "name": "FailedJobRetryTimeCycle",
  12364. "superClass": ["Element"],
  12365. "meta": {
  12366. "allowedIn": [
  12367. "camunda:AsyncCapable",
  12368. "bpmn:MultiInstanceLoopCharacteristics"
  12369. ]
  12370. },
  12371. "properties": [
  12372. {
  12373. "name": "body",
  12374. "isBody": true,
  12375. "type": "String"
  12376. }
  12377. ]
  12378. },
  12379. {
  12380. "name": "ExecutionListener",
  12381. "superClass": ["Element"],
  12382. "meta": {
  12383. "allowedIn": [
  12384. "bpmn:Task",
  12385. "bpmn:ServiceTask",
  12386. "bpmn:UserTask",
  12387. "bpmn:BusinessRuleTask",
  12388. "bpmn:ScriptTask",
  12389. "bpmn:ReceiveTask",
  12390. "bpmn:ManualTask",
  12391. "bpmn:ExclusiveGateway",
  12392. "bpmn:SequenceFlow",
  12393. "bpmn:ParallelGateway",
  12394. "bpmn:InclusiveGateway",
  12395. "bpmn:EventBasedGateway",
  12396. "bpmn:StartEvent",
  12397. "bpmn:IntermediateCatchEvent",
  12398. "bpmn:IntermediateThrowEvent",
  12399. "bpmn:EndEvent",
  12400. "bpmn:BoundaryEvent",
  12401. "bpmn:CallActivity",
  12402. "bpmn:SubProcess",
  12403. "bpmn:Process"
  12404. ]
  12405. },
  12406. "properties": [
  12407. {
  12408. "name": "expression",
  12409. "isAttr": true,
  12410. "type": "String"
  12411. },
  12412. {
  12413. "name": "class",
  12414. "isAttr": true,
  12415. "type": "String"
  12416. },
  12417. {
  12418. "name": "delegateExpression",
  12419. "isAttr": true,
  12420. "type": "String"
  12421. },
  12422. {
  12423. "name": "event",
  12424. "isAttr": true,
  12425. "type": "String"
  12426. },
  12427. {
  12428. "name": "script",
  12429. "type": "Script"
  12430. },
  12431. {
  12432. "name": "fields",
  12433. "type": "Field",
  12434. "isMany": true
  12435. }
  12436. ]
  12437. },
  12438. {
  12439. "name": "TaskListener",
  12440. "superClass": ["Element"],
  12441. "meta": {
  12442. "allowedIn": [
  12443. "bpmn:UserTask"
  12444. ]
  12445. },
  12446. "properties": [
  12447. {
  12448. "name": "expression",
  12449. "isAttr": true,
  12450. "type": "String"
  12451. },
  12452. {
  12453. "name": "class",
  12454. "isAttr": true,
  12455. "type": "String"
  12456. },
  12457. {
  12458. "name": "delegateExpression",
  12459. "isAttr": true,
  12460. "type": "String"
  12461. },
  12462. {
  12463. "name": "event",
  12464. "isAttr": true,
  12465. "type": "String"
  12466. },
  12467. {
  12468. "name": "script",
  12469. "type": "Script"
  12470. },
  12471. {
  12472. "name": "fields",
  12473. "type": "Field",
  12474. "isMany": true
  12475. },
  12476. {
  12477. "name": "id",
  12478. "type": "String",
  12479. "isAttr": true
  12480. },
  12481. {
  12482. "name": "eventDefinitions",
  12483. "type": "bpmn:TimerEventDefinition",
  12484. "isMany": true
  12485. }
  12486. ]
  12487. },
  12488. {
  12489. "name": "FormProperty",
  12490. "superClass": ["Element"],
  12491. "meta": {
  12492. "allowedIn": [
  12493. "bpmn:StartEvent",
  12494. "bpmn:UserTask"
  12495. ]
  12496. },
  12497. "properties": [
  12498. {
  12499. "name": "id",
  12500. "type": "String",
  12501. "isAttr": true
  12502. },
  12503. {
  12504. "name": "name",
  12505. "type": "String",
  12506. "isAttr": true
  12507. },
  12508. {
  12509. "name": "type",
  12510. "type": "String",
  12511. "isAttr": true
  12512. },
  12513. {
  12514. "name": "required",
  12515. "type": "String",
  12516. "isAttr": true
  12517. },
  12518. {
  12519. "name": "readable",
  12520. "type": "String",
  12521. "isAttr": true
  12522. },
  12523. {
  12524. "name": "writable",
  12525. "type": "String",
  12526. "isAttr": true
  12527. },
  12528. {
  12529. "name": "variable",
  12530. "type": "String",
  12531. "isAttr": true
  12532. },
  12533. {
  12534. "name": "expression",
  12535. "type": "String",
  12536. "isAttr": true
  12537. },
  12538. {
  12539. "name": "datePattern",
  12540. "type": "String",
  12541. "isAttr": true
  12542. },
  12543. {
  12544. "name": "default",
  12545. "type": "String",
  12546. "isAttr": true
  12547. },
  12548. {
  12549. "name": "values",
  12550. "type": "Value",
  12551. "isMany": true
  12552. }
  12553. ]
  12554. },
  12555. {
  12556. "name": "FormData",
  12557. "superClass": ["Element"],
  12558. "meta": {
  12559. "allowedIn": [
  12560. "bpmn:StartEvent",
  12561. "bpmn:UserTask"
  12562. ]
  12563. },
  12564. "properties": [
  12565. {
  12566. "name": "fields",
  12567. "type": "FormField",
  12568. "isMany": true
  12569. },
  12570. {
  12571. "name": "businessKey",
  12572. "type": "String",
  12573. "isAttr": true
  12574. }
  12575. ]
  12576. },
  12577. {
  12578. "name": "FormField",
  12579. "superClass": ["Element"],
  12580. "properties": [
  12581. {
  12582. "name": "id",
  12583. "type": "String",
  12584. "isAttr": true
  12585. },
  12586. {
  12587. "name": "label",
  12588. "type": "String",
  12589. "isAttr": true
  12590. },
  12591. {
  12592. "name": "type",
  12593. "type": "String",
  12594. "isAttr": true
  12595. },
  12596. {
  12597. "name": "datePattern",
  12598. "type": "String",
  12599. "isAttr": true
  12600. },
  12601. {
  12602. "name": "defaultValue",
  12603. "type": "String",
  12604. "isAttr": true
  12605. },
  12606. {
  12607. "name": "properties",
  12608. "type": "Properties"
  12609. },
  12610. {
  12611. "name": "validation",
  12612. "type": "Validation"
  12613. },
  12614. {
  12615. "name": "values",
  12616. "type": "Value",
  12617. "isMany": true
  12618. }
  12619. ]
  12620. },
  12621. {
  12622. "name": "Validation",
  12623. "superClass": ["Element"],
  12624. "properties": [
  12625. {
  12626. "name": "constraints",
  12627. "type": "Constraint",
  12628. "isMany": true
  12629. }
  12630. ]
  12631. },
  12632. {
  12633. "name": "Constraint",
  12634. "superClass": ["Element"],
  12635. "properties": [
  12636. {
  12637. "name": "name",
  12638. "type": "String",
  12639. "isAttr": true
  12640. },
  12641. {
  12642. "name": "config",
  12643. "type": "String",
  12644. "isAttr": true
  12645. }
  12646. ]
  12647. },
  12648. {
  12649. "name": "ConditionalEventDefinitionExtension",
  12650. "isAbstract": true,
  12651. "extends": [
  12652. "bpmn:ConditionalEventDefinition"
  12653. ],
  12654. "properties": [
  12655. {
  12656. "name": "variableName",
  12657. "isAttr": true,
  12658. "type": "String"
  12659. },
  12660. {
  12661. "name": "variableEvents",
  12662. "isAttr": true,
  12663. "type": "String"
  12664. }
  12665. ]
  12666. }
  12667. ],
  12668. "emumerations": []
  12669. };
  12670. //# sourceMappingURL=camundaModdleDescriptor.js.map
  12671. /**
  12672. * This is a sample file that should be replaced with the actual translation.
  12673. *
  12674. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12675. * translations and labels to translate.
  12676. */
  12677. var translations = {
  12678. // Labels
  12679. 'Activate the global connect tool': '激活全局连接工具',
  12680. 'Append {type}': '追加 {type}',
  12681. 'Append EndEvent': '追加 结束事件 ',
  12682. 'Append Task': '追加 任务',
  12683. 'Append Gateway': '追加 网关',
  12684. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12685. 'Add Lane above': '在上面添加道',
  12686. 'Divide into two Lanes': '分割成两个道',
  12687. 'Divide into three Lanes': '分割成三个道',
  12688. 'Add Lane below': '在下面添加道',
  12689. 'Append compensation activity': '追加补偿活动',
  12690. 'Change type': '修改类型',
  12691. 'Connect using Association': '使用关联连接',
  12692. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12693. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12694. 'Remove': '移除',
  12695. 'Activate the hand tool': '激活抓手工具',
  12696. 'Activate the lasso tool': '激活套索工具',
  12697. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12698. 'Create expanded SubProcess': '创建扩展子过程',
  12699. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12700. 'Create Pool/Participant': '创建池/参与者',
  12701. 'Parallel Multi Instance': '并行多重事件',
  12702. 'Sequential Multi Instance': '时序多重事件',
  12703. 'DataObjectReference': '数据对象参考',
  12704. 'DataStoreReference': '数据存储参考',
  12705. 'Loop': '循环',
  12706. 'Ad-hoc': '即席',
  12707. 'Create {type}': '创建 {type}',
  12708. 'Create Task': '创建任务',
  12709. 'Create StartEvent': '创建开始事件',
  12710. 'Create EndEvent': '创建结束事件',
  12711. 'Create Group': '创建组',
  12712. 'Task': '任务',
  12713. 'Send Task': '发送任务',
  12714. 'Receive Task': '接收任务',
  12715. 'User Task': '用户任务',
  12716. 'Manual Task': '手工任务',
  12717. 'Business Rule Task': '业务规则任务',
  12718. 'Service Task': '服务任务',
  12719. 'Script Task': '脚本任务',
  12720. 'Call Activity': '调用活动',
  12721. 'Sub Process (collapsed)': '子流程(折叠的)',
  12722. 'Sub Process (expanded)': '子流程(展开的)',
  12723. 'Start Event': '开始事件',
  12724. 'StartEvent': '开始事件',
  12725. 'Intermediate Throw Event': '中间事件',
  12726. 'End Event': '结束事件',
  12727. 'EndEvent': '结束事件',
  12728. 'Create Gateway': '创建网关',
  12729. 'GateWay': '网关',
  12730. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12731. 'Message Start Event': '消息开始事件',
  12732. 'Timer Start Event': '定时开始事件',
  12733. 'Conditional Start Event': '条件开始事件',
  12734. 'Signal Start Event': '信号开始事件',
  12735. 'Error Start Event': '错误开始事件',
  12736. 'Escalation Start Event': '升级开始事件',
  12737. 'Compensation Start Event': '补偿开始事件',
  12738. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12739. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12740. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12741. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12742. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12743. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12744. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12745. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12746. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12747. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12748. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12749. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12750. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12751. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12752. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12753. 'Message End Event': '消息结束事件',
  12754. 'Escalation End Event': '定时结束事件',
  12755. 'Error End Event': '错误结束事件',
  12756. 'Cancel End Event': '取消结束事件',
  12757. 'Compensation End Event': '补偿结束事件',
  12758. 'Signal End Event': '信号结束事件',
  12759. 'Terminate End Event': '终止结束事件',
  12760. 'Message Boundary Event': '消息边界事件',
  12761. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12762. 'Timer Boundary Event': '定时边界事件',
  12763. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12764. 'Escalation Boundary Event': '升级边界事件',
  12765. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12766. 'Conditional Boundary Event': '条件边界事件',
  12767. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12768. 'Error Boundary Event': '错误边界事件',
  12769. 'Cancel Boundary Event': '取消边界事件',
  12770. 'Signal Boundary Event': '信号边界事件',
  12771. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12772. 'Compensation Boundary Event': '补偿边界事件',
  12773. 'Exclusive Gateway': '互斥网关',
  12774. 'Parallel Gateway': '并行网关',
  12775. 'Inclusive Gateway': '相容网关',
  12776. 'Complex Gateway': '复杂网关',
  12777. 'Event based Gateway': '事件网关',
  12778. 'Transaction': '转运',
  12779. 'Sub Process': '子流程',
  12780. 'Event Sub Process': '事件子流程',
  12781. 'Collapsed Pool': '折叠池',
  12782. 'Expanded Pool': '展开池',
  12783. // Errors
  12784. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12785. 'no shape type specified': '没有指定的形状类型',
  12786. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12787. 'out of bounds release': 'out of bounds release',
  12788. 'more than {count} child lanes': '子道大于{count} ',
  12789. 'element required': '元素不能为空',
  12790. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12791. 'no diagram to display': '没有可展示的流程图',
  12792. 'no process or collaboration to display': '没有可展示的流程/协作',
  12793. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12794. 'already rendered {element}': '{element} 已被渲染',
  12795. 'failed to import {element}': '导入{element}失败',
  12796. // 属性面板的参数
  12797. 'Id': '编号',
  12798. 'Name': '名称',
  12799. 'General': '常规',
  12800. 'Details': '详情',
  12801. 'Message Name': '消息名称',
  12802. 'Message': '消息',
  12803. 'Initiator': '创建者',
  12804. 'Asynchronous Continuations': '持续异步',
  12805. 'Asynchronous Before': '异步前',
  12806. 'Asynchronous After': '异步后',
  12807. 'Job Configuration': '工作配置',
  12808. 'Exclusive': '排除',
  12809. 'Job Priority': '工作优先级',
  12810. 'Retry Time Cycle': '重试时间周期',
  12811. 'Documentation': '文档',
  12812. 'Element Documentation': '元素文档',
  12813. 'History Configuration': '历史配置',
  12814. 'History Time To Live': '历史的生存时间',
  12815. 'Forms': '表单',
  12816. 'Form Key': '表单key',
  12817. 'Form Fields': '表单字段',
  12818. 'Business Key': '业务key',
  12819. 'Form Field': '表单字段',
  12820. 'ID': '编号',
  12821. 'Type': '类型',
  12822. 'Label': '名称',
  12823. 'Default Value': '默认值',
  12824. 'Validation': '校验',
  12825. 'Add Constraint': '添加约束',
  12826. 'Config': '配置',
  12827. 'Properties': '属性',
  12828. 'Add Property': '添加属性',
  12829. 'Value': '值',
  12830. 'Add': '添加',
  12831. 'Values': '值',
  12832. 'Add Value': '添加值',
  12833. 'Listeners': '监听器',
  12834. 'Execution Listener': '执行监听',
  12835. 'Event Type': '事件类型',
  12836. 'Listener Type': '监听器类型',
  12837. 'Java Class': 'Java类',
  12838. 'Expression': '表达式',
  12839. 'Must provide a value': '必须提供一个值',
  12840. 'Delegate Expression': '代理表达式',
  12841. 'Script': '脚本',
  12842. 'Script Format': '脚本格式',
  12843. 'Script Type': '脚本类型',
  12844. 'Inline Script': '内联脚本',
  12845. 'External Script': '外部脚本',
  12846. 'Resource': '资源',
  12847. 'Field Injection': '字段注入',
  12848. 'Extensions': '扩展',
  12849. 'Input/Output': '输入/输出',
  12850. 'Input Parameters': '输入参数',
  12851. 'Output Parameters': '输出参数',
  12852. 'Parameters': '参数',
  12853. 'Output Parameter': '输出参数',
  12854. 'Timer Definition Type': '定时器定义类型',
  12855. 'Timer Definition': '定时器定义',
  12856. 'Date': '日期',
  12857. 'Duration': '持续',
  12858. 'Cycle': '循环',
  12859. 'Signal': '信号',
  12860. 'Signal Name': '信号名称',
  12861. 'Escalation': '升级',
  12862. 'Error': '错误',
  12863. 'Link Name': '链接名称',
  12864. 'Condition': '条件名称',
  12865. 'Variable Name': '变量名称',
  12866. 'Variable Event': '变量事件',
  12867. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12868. 'Wait for Completion': '等待完成',
  12869. 'Activity Ref': '活动参考',
  12870. 'Version Tag': '版本标签',
  12871. 'Executable': '可执行文件',
  12872. 'External Task Configuration': '扩展任务配置',
  12873. 'Task Priority': '任务优先级',
  12874. 'External': '外部',
  12875. 'Connector': '连接器',
  12876. 'Must configure Connector': '必须配置连接器',
  12877. 'Connector Id': '连接器编号',
  12878. 'Implementation': '实现方式',
  12879. 'Field Injections': '字段注入',
  12880. 'Fields': '字段',
  12881. 'Result Variable': '结果变量',
  12882. 'Topic': '主题',
  12883. 'Configure Connector': '配置连接器',
  12884. 'Input Parameter': '输入参数',
  12885. 'Assignee': '代理人',
  12886. 'Candidate Users': '候选用户',
  12887. 'Candidate Groups': '候选组',
  12888. 'Due Date': '到期时间',
  12889. 'Follow Up Date': '跟踪日期',
  12890. 'Priority': '优先级',
  12891. // eslint-disable-next-line no-template-curly-in-string
  12892. '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',
  12893. // eslint-disable-next-line no-template-curly-in-string
  12894. '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',
  12895. 'Variables': '变量',
  12896. 'Candidate Starter Configuration': '候选开始配置',
  12897. 'Task Listener': '任务监听器',
  12898. 'Candidate Starter Groups': '候选开始组',
  12899. 'Candidate Starter Users': '候选开始用户',
  12900. 'Tasklist Configuration': '任务列表配置',
  12901. 'Startable': '启动',
  12902. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12903. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12904. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12905. 'CallActivity Type': '调用活动类型',
  12906. 'Condition Type': '条件类型',
  12907. 'Create UserTask': '创建用户任务',
  12908. 'Create CallActivity': '创建调用活动',
  12909. 'Called Element': '调用元素',
  12910. 'Create DataObjectReference': '创建数据对象引用',
  12911. 'Create DataStoreReference': '创建数据存储引用',
  12912. 'Multi Instance': '多实例',
  12913. 'Loop Cardinality': '实例数量',
  12914. Collection: '任务参与人列表',
  12915. 'Element Variable': '元素变量',
  12916. 'Completion Condition': '完成条件'
  12917. };
  12918. //# sourceMappingURL=translations.js.map
  12919. function customTranslate(template, replacements) {
  12920. replacements = replacements || {};
  12921. // Translate
  12922. template = translations[template] || template;
  12923. // Replace
  12924. return template.replace(/{([^}]+)}/g, function (_, key) {
  12925. return replacements[key] || '{' + key + '}';
  12926. });
  12927. }
  12928. //# sourceMappingURL=customTranslate.js.map
  12929. var vjson$9 = {
  12930. title: '导入流程',
  12931. layout: 'fit',
  12932. width: 400,
  12933. height: 400,
  12934. items: [
  12935. {
  12936. layout: 'border',
  12937. items: [
  12938. {
  12939. xtype: 'form',
  12940. items: [
  12941. // {
  12942. // xtype: 'cols',
  12943. // items: [
  12944. // {
  12945. // xtype: 'textfield',
  12946. // allowBlank: false,
  12947. // fieldLabel: '流程名称',
  12948. // bind: '{name}'
  12949. // },
  12950. // ],
  12951. // },
  12952. {
  12953. xtype: 'cols',
  12954. items: [
  12955. {
  12956. xtype: 'filefield',
  12957. name: 'deployFile',
  12958. fieldLabel: '文件名称',
  12959. // labelWidth: '100%',
  12960. msgTarget: 'side',
  12961. reference: 'MOBANB_FILE',
  12962. fileUpload: true,
  12963. allowBlank: false,
  12964. // flex: 1,
  12965. // width: '100%',
  12966. buttonText: '请选择文件位置',
  12967. listeners: {
  12968. change: 'scope.fileChange'
  12969. }
  12970. // bind: '{FILE}'
  12971. },
  12972. ]
  12973. }
  12974. ],
  12975. region: 'center',
  12976. split: true,
  12977. },
  12978. ],
  12979. },
  12980. ],
  12981. fbar: {
  12982. xtype: 'toolbar',
  12983. items: [
  12984. {
  12985. xtype: 'button',
  12986. text: '保存',
  12987. iconCls: 'x-fa fa-save',
  12988. listeners: {
  12989. click: 'scope.save',
  12990. },
  12991. }
  12992. ],
  12993. },
  12994. };
  12995. //# sourceMappingURL=ImportBpmn.view.js.map
  12996. var model$9 = {
  12997. data: {
  12998. name: '',
  12999. file_content: ''
  13000. }
  13001. };
  13002. //# sourceMappingURL=ImportBpmn.model.js.map
  13003. var ImportBpmn = /** @class */ (function (_super) {
  13004. __extends(ImportBpmn, _super);
  13005. function ImportBpmn() {
  13006. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  13007. }
  13008. ImportBpmn.prototype.onLoad = function () {
  13009. };
  13010. ImportBpmn.prototype.save = function (sender) {
  13011. if (this.data.file_content) {
  13012. this.dialogSuccess(this.data);
  13013. }
  13014. else {
  13015. Ext.Msg.alert('提示', "请先上传文件");
  13016. }
  13017. };
  13018. ImportBpmn.prototype.fileChange = function (e) {
  13019. var _this = this;
  13020. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  13021. var file = e.fileInputEl.dom.files[0]; //获取文件
  13022. var reader = new FileReader();
  13023. reader.readAsText(file, "UTF-8");
  13024. reader.onload = function () {
  13025. _this.data.file_content = reader.result;
  13026. };
  13027. };
  13028. return ImportBpmn;
  13029. }(Scope));
  13030. //# sourceMappingURL=ImportBpmn.js.map
  13031. var model$a = {
  13032. data: {
  13033. form_id: '',
  13034. form_name: '',
  13035. save_dir_path: '',
  13036. absolute_path: '',
  13037. form: {
  13038. id: '',
  13039. code: '',
  13040. name: '',
  13041. table: '',
  13042. controller: '',
  13043. groovy: '',
  13044. fields: [],
  13045. buttons: [],
  13046. },
  13047. }
  13048. };
  13049. //# sourceMappingURL=ConfigStrategy.model.js.map
  13050. var vjson$a = {
  13051. title: '配置适配策略',
  13052. layout: 'fit',
  13053. items: [
  13054. {
  13055. layout: 'border',
  13056. items: [
  13057. {
  13058. region: 'center',
  13059. xtype: 'yvgrid',
  13060. pagination: false,
  13061. hideFootbar: true,
  13062. plugins: {
  13063. clipboard: true,
  13064. selectionreplicator: true
  13065. },
  13066. tbar: {
  13067. xtype: 'toolbar',
  13068. items: [
  13069. {
  13070. xtype: 'button',
  13071. text: '添加策略',
  13072. iconCls: 'x-fa fa-plus-circle',
  13073. listeners: {
  13074. click: 'scope.addStrategy'
  13075. }
  13076. },
  13077. {
  13078. xtype: 'button',
  13079. text: '删除',
  13080. iconCls: 'x-fa fa-minus-circle',
  13081. listeners: {}
  13082. },
  13083. '-',
  13084. {
  13085. xtype: 'button',
  13086. text: '上移',
  13087. iconCls: 'x-fa fa-arrow-up',
  13088. listeners: {}
  13089. },
  13090. {
  13091. xtype: 'button',
  13092. text: '下移',
  13093. iconCls: 'x-fa fa-arrow-down',
  13094. listeners: {}
  13095. },
  13096. ]
  13097. },
  13098. columns: [
  13099. { xtype: 'rownumberer' },
  13100. {
  13101. header: '优先级',
  13102. dataIndex: 'priority',
  13103. width: 140,
  13104. sortable: false,
  13105. menuDisabled: true,
  13106. editor: {
  13107. selectOnFocus: true
  13108. },
  13109. },
  13110. {
  13111. header: '策略编号',
  13112. dataIndex: 'strategy_code',
  13113. width: 140,
  13114. sortable: false,
  13115. menuDisabled: true,
  13116. editor: {
  13117. selectOnFocus: true
  13118. },
  13119. },
  13120. {
  13121. header: '策略名称',
  13122. dataIndex: 'strategy_name',
  13123. width: 140,
  13124. sortable: false,
  13125. menuDisabled: true,
  13126. editor: {
  13127. selectOnFocus: true
  13128. },
  13129. },
  13130. {
  13131. header: "条件表达式",
  13132. dataIndex: "strategy_exp",
  13133. },
  13134. ],
  13135. },
  13136. {
  13137. title: '适配条件',
  13138. region: 'south',
  13139. height: '50%',
  13140. xtype: 'form',
  13141. items: [
  13142. {
  13143. xtype: 'cols',
  13144. items: [
  13145. {
  13146. xtype: 'rows',
  13147. items: [
  13148. {
  13149. xtype: 'textfield',
  13150. fieldLabel: "仓库",
  13151. },
  13152. {
  13153. xtype: 'textfield',
  13154. fieldLabel: "货主",
  13155. },
  13156. {
  13157. xtype: 'textfield',
  13158. fieldLabel: "项目",
  13159. },
  13160. {
  13161. xtype: 'textfield',
  13162. fieldLabel: "行政区划",
  13163. },
  13164. {
  13165. xtype: 'textfield',
  13166. fieldLabel: "客户",
  13167. },
  13168. {
  13169. xtype: 'textfield',
  13170. fieldLabel: "商品",
  13171. }
  13172. ]
  13173. },
  13174. {
  13175. xtype: 'rows',
  13176. margin: '8 0 0 10',
  13177. items: [
  13178. {
  13179. xtype: 'label',
  13180. html: '自定义表达式',
  13181. },
  13182. {
  13183. xtype: 'textarea',
  13184. }
  13185. ]
  13186. }
  13187. ]
  13188. }
  13189. ]
  13190. }
  13191. ]
  13192. }
  13193. ]
  13194. };
  13195. //
  13196. //# sourceMappingURL=ConfigStrategy.view.js.map
  13197. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13198. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13199. // import ReportRunner from "./ReportRunner";
  13200. var ConfigStrategy = /** @class */ (function (_super) {
  13201. __extends(ConfigStrategy, _super);
  13202. function ConfigStrategy() {
  13203. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13204. }
  13205. ConfigStrategy.prototype.onLoad = function () {
  13206. this.load();
  13207. };
  13208. ConfigStrategy.prototype.load = function () {
  13209. var _this = this;
  13210. var form_id = this.viewModel.get("form_id");
  13211. var absolute_path = this.viewModel.get("absolute_path");
  13212. var save_dir_path = this.viewModel.get("save_dir_path");
  13213. if (absolute_path && form_id) {
  13214. this.setLoading(true);
  13215. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13216. if (res.success) {
  13217. // 基础属性
  13218. _this.viewModel.set('form', res.data.form);
  13219. // 字段定义
  13220. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13221. // 按钮
  13222. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13223. }
  13224. }).finally(function () {
  13225. _this.setLoading(false);
  13226. });
  13227. }
  13228. };
  13229. ConfigStrategy.prototype.saveAll = function () {
  13230. var _this = this;
  13231. var save_dir_path = this.viewModel.get("save_dir_path");
  13232. if (!save_dir_path) {
  13233. msg("save_dir_path error");
  13234. return;
  13235. }
  13236. var form_id = this.viewModel.get("form_id");
  13237. var absolute_path = this.viewModel.get("absolute_path");
  13238. // 表格校验
  13239. if (!this.refs.form1.isValid()) {
  13240. msg("请检查表单必填项!");
  13241. return;
  13242. }
  13243. // 字段数据
  13244. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13245. delete item.id;
  13246. if (item.hide) {
  13247. delete item.hide_text;
  13248. }
  13249. else {
  13250. item.hide = item.hide_text;
  13251. delete item.hide_text;
  13252. }
  13253. if (item.readonly) {
  13254. delete item.readonly_text;
  13255. }
  13256. else {
  13257. item.readonly = item.readonly_text;
  13258. delete item.readonly_text;
  13259. }
  13260. if (item.disabled) {
  13261. delete item.disabled_text;
  13262. }
  13263. else {
  13264. item.disabled = item.disabled_text;
  13265. delete item.disabled_text;
  13266. }
  13267. if (item.required) {
  13268. delete item.required_text;
  13269. }
  13270. else {
  13271. item.required = item.required_text;
  13272. delete item.required_text;
  13273. }
  13274. return item;
  13275. });
  13276. this.viewModel.set("form.fields", gridColumnRows);
  13277. // 按钮数据
  13278. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13279. delete item.id;
  13280. return item;
  13281. });
  13282. this.viewModel.set("form.buttons", gridBtnRows);
  13283. // 查询条件
  13284. // 策略
  13285. var form = this.viewModel.get("form");
  13286. this.setLoading(true);
  13287. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13288. if (res.success) {
  13289. msg('保存成功');
  13290. handles$1.mainWindow.refs['exporerTree'].reload();
  13291. }
  13292. }).finally(function () {
  13293. _this.setLoading(false);
  13294. });
  13295. };
  13296. ConfigStrategy.prototype.addColumn = function () {
  13297. this.refs.gridColumn.getStore().add({});
  13298. };
  13299. ConfigStrategy.prototype.removeColumn = function () {
  13300. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13301. };
  13302. ConfigStrategy.prototype.calcColumn = function (sender) {
  13303. var _this = this;
  13304. var table = this.viewModel.get("form.table");
  13305. if (!table) {
  13306. msg("表名不存在!");
  13307. return;
  13308. }
  13309. this.setLoading(true);
  13310. calcColumnForm({ table: table }).then(function (res) {
  13311. if (res.success) {
  13312. msg(res.msg);
  13313. if (res.data.columns.length > 0) {
  13314. _$2.forEach(res.data.columns, function (it) {
  13315. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13316. });
  13317. }
  13318. }
  13319. }).finally(function () {
  13320. _this.setLoading(false);
  13321. });
  13322. };
  13323. ConfigStrategy.prototype.addButton = function () {
  13324. this.refs.gridButton.getStore().add({});
  13325. };
  13326. ConfigStrategy.prototype.moveUp = function (sender) {
  13327. var grid = sender.up('grid');
  13328. grid.rowMoveUp();
  13329. };
  13330. ConfigStrategy.prototype.moveDown = function (sender) {
  13331. var grid = sender.up('grid');
  13332. grid.rowMoveDown();
  13333. };
  13334. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13335. var win = new Ext.Window({
  13336. autoDestroy: true,
  13337. title: "添加(编辑)策略",
  13338. width: 400,
  13339. height: 300,
  13340. resizable: true,
  13341. closable: true,
  13342. maximizable: true,
  13343. minimizable: true,
  13344. plain: true,
  13345. // constrainHeader: true,
  13346. constrain: true,
  13347. layout: 'fit',
  13348. animateTarget: sender,
  13349. buttonAlign: 'center',
  13350. items: [
  13351. {
  13352. xtype: "form",
  13353. layout: "hbox",
  13354. margin: '10px 20px',
  13355. border: 0,
  13356. items: [
  13357. {
  13358. flex: 1,
  13359. layout: 'vbox',
  13360. items: [
  13361. {
  13362. xtype: "numberfield",
  13363. fieldLabel: "优先级",
  13364. flex: 1,
  13365. allowBlank: false,
  13366. labelWidth: 50,
  13367. width: "100%",
  13368. },
  13369. {
  13370. xtype: "textfield",
  13371. fieldLabel: "策略名称",
  13372. flex: 1,
  13373. allowBlank: false,
  13374. labelWidth: 50,
  13375. width: "100%",
  13376. },
  13377. {
  13378. xtype: "textfield",
  13379. fieldLabel: "策略编号",
  13380. flex: 1,
  13381. allowBlank: false,
  13382. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13383. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13384. labelWidth: 50,
  13385. width: "100%",
  13386. },
  13387. {
  13388. xtype: "textfield",
  13389. fieldLabel: "仓库ID",
  13390. flex: 1,
  13391. allowBlank: false,
  13392. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13393. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13394. labelWidth: 50,
  13395. width: "100%",
  13396. },
  13397. ]
  13398. },
  13399. ]
  13400. }
  13401. ],
  13402. //窗口按钮
  13403. buttons: [
  13404. {
  13405. xtype: 'button', text: '保存', handler: function (btn) {
  13406. //窗口获取表单
  13407. var form = win.down('form');
  13408. var vaildSuccess = form.isValid();
  13409. if (!vaildSuccess) {
  13410. return;
  13411. }
  13412. var filename = form.down('textfield[name="filename"]').getValue();
  13413. }
  13414. },
  13415. {
  13416. xtype: 'button', text: '取消', handler: function (btn) {
  13417. //窗口关闭
  13418. win.close();
  13419. }
  13420. }
  13421. ]
  13422. });
  13423. win.show();
  13424. };
  13425. return ConfigStrategy;
  13426. }(Scope));
  13427. //# sourceMappingURL=ConfigStrategy.js.map
  13428. var buildVjson = function () {
  13429. return {
  13430. bind: {
  13431. title: '流程编辑-{text}',
  13432. },
  13433. layout: 'fit',
  13434. items: [{
  13435. layout: 'border',
  13436. tbar: {
  13437. xtype: 'toolbar',
  13438. items: [
  13439. {
  13440. xtype: 'button',
  13441. text: '撤销',
  13442. listeners: {
  13443. click: "scope.undo"
  13444. }
  13445. },
  13446. {
  13447. xtype: 'button',
  13448. text: '还原',
  13449. listeners: {
  13450. click: "scope.redo"
  13451. }
  13452. },
  13453. {
  13454. xtype: 'button',
  13455. text: '保存',
  13456. listeners: {
  13457. click: "scope.save"
  13458. }
  13459. },
  13460. {
  13461. xtype: 'button',
  13462. text: '导入BPM',
  13463. listeners: {
  13464. click: "scope.importBpm"
  13465. }
  13466. },
  13467. {
  13468. xtype: 'button',
  13469. text: '配置适配策略',
  13470. listeners: {
  13471. click: "scope.configStrategy"
  13472. }
  13473. },
  13474. {
  13475. fieldLabel: '选择配置分支',
  13476. xtype: 'combogrid',
  13477. },
  13478. ]
  13479. },
  13480. items: [
  13481. {
  13482. xtype: "panel",
  13483. region: 'center',
  13484. reference: "bpmn_view",
  13485. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13486. },
  13487. {
  13488. split: true,
  13489. xtype: "panel",
  13490. region: 'east',
  13491. width: '30%',
  13492. reference: "bpmn_properties",
  13493. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13494. }
  13495. ],
  13496. }],
  13497. listeners: {
  13498. afterrender: 'scope.onViewRender'
  13499. }
  13500. };
  13501. };
  13502. var BpmnDesign = /** @class */ (function (_super) {
  13503. __extends(BpmnDesign, _super);
  13504. function BpmnDesign() {
  13505. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13506. _this.bpmnModeler = null;
  13507. _this.bpmnModelerName = "";
  13508. return _this;
  13509. }
  13510. BpmnDesign.prototype.onLoad = function () {
  13511. var _this = this;
  13512. _super.prototype.onLoad.call(this);
  13513. this.setLoading(true);
  13514. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13515. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13516. if (res && res.success && res.data && res.data.bpmn) {
  13517. var diagramXML = res.data.bpmn;
  13518. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13519. var elements = _this.bpmnModeler._definitions.rootElements;
  13520. if (Array.isArray(elements) && elements.length > 0) {
  13521. elements[0].name = _this.bpmnModelerName;
  13522. }
  13523. }).catch(function (err) {
  13524. msgError(err);
  13525. });
  13526. }
  13527. else {
  13528. msgError(res.msg);
  13529. }
  13530. }).finally(function () {
  13531. _this.setLoading(false);
  13532. });
  13533. };
  13534. BpmnDesign.prototype.onViewRender = function (sender) {
  13535. var customTranslateModule = {
  13536. translate: ['value', customTranslate]
  13537. };
  13538. this.bpmnModeler = new BpmnModeler({
  13539. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13540. propertiesPanel: {
  13541. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13542. },
  13543. additionalModules: [
  13544. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13545. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13546. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13547. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13548. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13549. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13550. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13551. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13552. customTranslateModule,
  13553. ],
  13554. moddleExtensions: {
  13555. camunda: camundaModdleDescriptor
  13556. },
  13557. keyboard: { bindTo: document } // 使用键盘快捷键
  13558. });
  13559. };
  13560. //开启快捷键
  13561. //modeler.get('keyboard').bind(document);
  13562. //关闭快捷键
  13563. //modeler.get('keyboard').unbind();
  13564. BpmnDesign.prototype.undo = function (sender) {
  13565. this.bpmnModeler.get('commandStack').undo();
  13566. };
  13567. BpmnDesign.prototype.redo = function (sender) {
  13568. this.bpmnModeler.get('commandStack').redo();
  13569. };
  13570. BpmnDesign.prototype.save = function (sender) {
  13571. var _this = this;
  13572. this.setLoading(true);
  13573. this.bpmnModeler.saveXML().then(function (resBpm) {
  13574. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13575. if (res.success) {
  13576. msg$1("保存成功");
  13577. }
  13578. else {
  13579. msgError(res.msg);
  13580. }
  13581. }).catch(function (e) {
  13582. var _a, _b;
  13583. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13584. msgError(msg);
  13585. }).finally(function () {
  13586. _this.setLoading(false);
  13587. });
  13588. }).catch(function (e) {
  13589. msgError(e);
  13590. _this.setLoading(false);
  13591. });
  13592. };
  13593. BpmnDesign.prototype.importBpm = function (sender) {
  13594. var _this = this;
  13595. var dlg = new ImportBpmn();
  13596. //@ts-ignore
  13597. dlg.success = function (sen, data) {
  13598. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13599. var elements = _this.bpmnModeler._definitions.rootElements;
  13600. if (Array.isArray(elements) && elements.length > 0) {
  13601. elements[0].name = _this.bpmnModelerName;
  13602. }
  13603. }).catch(function (err) {
  13604. msgError(err);
  13605. });
  13606. };
  13607. dlg.showDialog(sender, {}, {});
  13608. // this.bpmnModeler.importXML()
  13609. };
  13610. BpmnDesign.prototype.configStrategy = function (sender) {
  13611. var configStrategy = new ConfigStrategy();
  13612. configStrategy.showDialog(sender, {}, {});
  13613. };
  13614. return BpmnDesign;
  13615. }(Scope));
  13616. //# sourceMappingURL=BpmnDesign.js.map
  13617. var model$b = {
  13618. data: {
  13619. id: '',
  13620. path: '',
  13621. form: {
  13622. title: '',
  13623. sqlId: '',
  13624. }
  13625. }
  13626. };
  13627. //# sourceMappingURL=WhLayoutDesign.model.js.map
  13628. var vjson$b = {
  13629. bind: {
  13630. title: '{title}',
  13631. },
  13632. layout: 'fit',
  13633. items: [
  13634. {
  13635. layout: 'border',
  13636. items: [
  13637. {
  13638. region: 'center',
  13639. reference: 'editor',
  13640. border: true,
  13641. // html: '<div class="geEditor"></div>',
  13642. // listeners: {
  13643. // afterrender: 'scope.editorInit'
  13644. // }
  13645. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  13646. listeners: {
  13647. afterrender: 'scope.iframeRender'
  13648. }
  13649. },
  13650. ]
  13651. }
  13652. ]
  13653. }; //
  13654. //
  13655. //# sourceMappingURL=WhLayoutDesign.view.js.map
  13656. var WidgetDesign$1 = /** @class */ (function (_super) {
  13657. __extends(WidgetDesign, _super);
  13658. function WidgetDesign(layoutCode, layoutName) {
  13659. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13660. _this.layoutCode = layoutCode;
  13661. _this.layoutName = layoutName;
  13662. return _this;
  13663. }
  13664. WidgetDesign.prototype.onLoad = function () {
  13665. this.viewModel.set('layoutCode', this.layoutCode);
  13666. this.viewModel.set('layoutName', this.layoutName);
  13667. if (this.layoutCode) {
  13668. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13669. }
  13670. else {
  13671. this.viewModel.set('title', '新建图纸');
  13672. }
  13673. };
  13674. WidgetDesign.prototype.reload = function () {
  13675. var _this = this;
  13676. this.setLoading(true);
  13677. loadWhLayout({
  13678. layoutCode: this.layoutCode,
  13679. layoutName: this.layoutName,
  13680. }).then(function (res) {
  13681. if (res.success) {
  13682. var xml = res.data.layoutContent;
  13683. var doc = _this.mxUtils.parseXml(xml);
  13684. var graph = _this.editorUi.editor.graph;
  13685. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13686. }
  13687. }).finally(function () {
  13688. _this.setLoading(false);
  13689. });
  13690. };
  13691. WidgetDesign.prototype.editorInit = function (sender) {
  13692. var that = this;
  13693. var dom = $(sender.el.dom).find('.geEditor')[0];
  13694. //@ts-ignore
  13695. require(['mxgraph'], function () {
  13696. var editorUiInit = EditorUi.prototype.init;
  13697. EditorUi.prototype.init = function () {
  13698. editorUiInit.apply(this, arguments);
  13699. this.actions.get('save').funct = that.onFileSave.bind(that);
  13700. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13701. this.actions.get('open').visible = false;
  13702. this.actions.get('new').visible = false;
  13703. this.actions.get('preview').visible = false;
  13704. this.actions.get('print').visible = false;
  13705. this.actions.get('pageSetup').visible = false;
  13706. this.actions.get('help').visible = false;
  13707. this.actions.get('export').visible = false;
  13708. this.actions.get('about').visible = false;
  13709. this.menus.menus.help.setEnabled(false);
  13710. that.editorUi = this;
  13711. if (that.layoutCode) {
  13712. that.reload();
  13713. }
  13714. };
  13715. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13716. var mxLanguage = 'zh';
  13717. mxResources.loadDefaultBundle = false;
  13718. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13719. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13720. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13721. // Fixes possible asynchronous requests
  13722. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13723. // Adds bundle text to resources
  13724. mxResources.parse(xhr[0].getText());
  13725. // Configures the default graph theme
  13726. var themes = new Object();
  13727. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13728. // Main
  13729. new EditorUi(new Editor(false, themes), dom);
  13730. }, function () {
  13731. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13732. });
  13733. });
  13734. };
  13735. WidgetDesign.prototype.iframeRender = function (sender) {
  13736. var that = this;
  13737. var iframe = $(sender.el.dom).find('iframe')[0];
  13738. iframe.contentWindow['designer'] = that;
  13739. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  13740. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  13741. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13742. editorUi.actions.get('open').visible = false;
  13743. editorUi.actions.get('new').visible = false;
  13744. editorUi.actions.get('preview').visible = false;
  13745. editorUi.actions.get('print').visible = false;
  13746. editorUi.actions.get('pageSetup').visible = false;
  13747. editorUi.actions.get('help').visible = false;
  13748. editorUi.actions.get('export').visible = false;
  13749. editorUi.actions.get('about').visible = false;
  13750. editorUi.menus.menus.help.setEnabled(false);
  13751. that.editorUi = editorUi;
  13752. that.mxUtils = iframe.contentWindow['mxUtils'];
  13753. if (that.layoutCode) {
  13754. that.reload();
  13755. }
  13756. };
  13757. };
  13758. WidgetDesign.prototype.onDestroy = function () {
  13759. var _a;
  13760. try {
  13761. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13762. }
  13763. catch (e) {
  13764. }
  13765. };
  13766. WidgetDesign.prototype.onFileSaveAs = function () {
  13767. var _this = this;
  13768. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13769. .then(function (_a) {
  13770. var code = _a.code, name = _a.name;
  13771. _this.layoutCode = code;
  13772. _this.layoutName = name;
  13773. _this.onSave();
  13774. });
  13775. };
  13776. WidgetDesign.prototype.onSave = function () {
  13777. var _this = this;
  13778. var layoutContent = this.editorUi.getEditBlankXml();
  13779. var layoutCode = this.layoutCode;
  13780. var layoutName = this.layoutName;
  13781. if (!layoutCode || !layoutName) {
  13782. msg$1('图形编号和图形名称必填');
  13783. return;
  13784. }
  13785. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13786. this.setLoading(true);
  13787. saveWhLayout({
  13788. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13789. }).then(function (res) {
  13790. msg$1(res.msg);
  13791. handles$1.whLayout.reload();
  13792. }).finally(function () {
  13793. _this.setLoading(false);
  13794. });
  13795. };
  13796. WidgetDesign.prototype.onFileSave = function () {
  13797. if (!this.layoutCode || !this.layoutName) {
  13798. this.onFileSaveAs();
  13799. }
  13800. else {
  13801. this.onSave();
  13802. }
  13803. };
  13804. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13805. var code = _a.code, name = _a.name;
  13806. return new Promise(function (resolve, reject) {
  13807. var viewModel = new Ext.app.ViewModel({
  13808. data: {
  13809. code: code !== null && code !== void 0 ? code : '',
  13810. name: name !== null && name !== void 0 ? name : '',
  13811. }
  13812. });
  13813. var dlg = Ext.create('Ext.window.Window', {
  13814. title: '保存',
  13815. viewModel: viewModel,
  13816. layout: {
  13817. type: "vbox",
  13818. pack: "start",
  13819. align: "stretch"
  13820. },
  13821. items: [
  13822. {
  13823. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13824. bind: '{code}'
  13825. },
  13826. {
  13827. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13828. bind: '{name}'
  13829. }
  13830. ],
  13831. fbar: [
  13832. {
  13833. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13834. click: function () {
  13835. var code = viewModel.get('code');
  13836. var name = viewModel.get('name');
  13837. resolve({ code: code, name: name });
  13838. dlg.close();
  13839. }
  13840. }
  13841. },
  13842. {
  13843. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13844. click: function () {
  13845. dlg.close();
  13846. }
  13847. }
  13848. },
  13849. ]
  13850. });
  13851. dlg.show();
  13852. });
  13853. };
  13854. return WidgetDesign;
  13855. }(Scope));
  13856. //# sourceMappingURL=WhLayoutDesign.js.map
  13857. // init()
  13858. var Workbench = /** @class */ (function (_super) {
  13859. __extends(Workbench, _super);
  13860. // activeModulePage: ModulePage = null
  13861. function Workbench() {
  13862. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13863. _this.name = "MainWindow";
  13864. _this.modules = [];
  13865. _this.yvgridDesign = null;
  13866. return _this;
  13867. }
  13868. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13869. if (newCard) {
  13870. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13871. }
  13872. else {
  13873. this.viewModel.set('leftTabTitle', '未选中');
  13874. }
  13875. };
  13876. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13877. get: function () {
  13878. var _a;
  13879. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13880. },
  13881. enumerable: true,
  13882. configurable: true
  13883. });
  13884. Workbench.prototype.documentKeydown = function (event) {
  13885. if (event.ctrlKey || event.metaKey) {
  13886. if (event.key.toLowerCase() === 's') {
  13887. eventBus.publish(EventType.SaveCall, {});
  13888. event.stopPropagation();
  13889. event.preventDefault();
  13890. }
  13891. else if (event.key.toLowerCase() === 'z') {
  13892. if (event.shiftKey) {
  13893. eventBus.publish(EventType.Redo, {});
  13894. event.stopPropagation();
  13895. event.preventDefault();
  13896. }
  13897. else {
  13898. eventBus.publish(EventType.Undo, {});
  13899. event.stopPropagation();
  13900. event.preventDefault();
  13901. }
  13902. }
  13903. }
  13904. };
  13905. Workbench.prototype.onLoad = function () {
  13906. var _this = this;
  13907. window["tt"] = this.refs['tt'];
  13908. window["vm"] = this.viewModel;
  13909. $('#loading').remove();
  13910. setMainWindow(this);
  13911. setStatusbar(this.down('statusbar'));
  13912. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13913. var currentProject = getCurrentProject();
  13914. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13915. // handles.fileTree.reload()
  13916. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13917. _this.showModule(rawData);
  13918. });
  13919. eventBus.subscribe(EventType.Undo, function () {
  13920. _this.onUndo();
  13921. });
  13922. eventBus.subscribe(EventType.Redo, function () {
  13923. _this.onRedo();
  13924. });
  13925. eventBus.subscribe(EventType.Cut, function (_a) {
  13926. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13927. _this.onCut(a, b, c, d);
  13928. });
  13929. eventBus.subscribe(EventType.Copy, function (_a) {
  13930. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13931. _this.onCopy(a, b, c, d);
  13932. });
  13933. eventBus.subscribe(EventType.Paste, function (_a) {
  13934. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13935. _this.onPaste(a, b, c, d);
  13936. });
  13937. eventBus.subscribe(EventType.SelectAll, function () {
  13938. _this.onSelectAll();
  13939. });
  13940. eventBus.subscribe(EventType.SelectAll, function () {
  13941. _this.onSelectAll();
  13942. });
  13943. eventBus.subscribe(EventType.RunCheckModule, function () {
  13944. _this.runCheckModule();
  13945. });
  13946. eventBus.subscribe(EventType.StopCheckModule, function () {
  13947. _this.stopCheckModule();
  13948. });
  13949. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13950. _this.onCompoentContextMenu(args);
  13951. });
  13952. this.runCheckModule();
  13953. };
  13954. Workbench.prototype.onCompoentContextMenu = function (args) {
  13955. var _this = this;
  13956. if (!this.yvgridDesign) {
  13957. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13958. this.yvgridDesign.showDialog(null, {}, {});
  13959. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13960. this.yvgridDesign.onDestroy = function () {
  13961. fn_1();
  13962. _this.yvgridDesign = null;
  13963. };
  13964. }
  13965. };
  13966. Workbench.prototype.runCheckModule = function () {
  13967. var _this = this;
  13968. if (this.checkTimer) {
  13969. return;
  13970. }
  13971. this.checkTimer = setInterval(function () {
  13972. var _a;
  13973. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13974. _this.activeModulePage.check();
  13975. }
  13976. }, 5000);
  13977. };
  13978. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13979. var dlg = new WidgetDesign(widgetPath, widgetName);
  13980. dlg.showPage({
  13981. id: 'widget_' + widgetPath,
  13982. path: 'widget_' + widgetPath,
  13983. }, {
  13984. data: {
  13985. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13986. }
  13987. });
  13988. dlg.dialogSuccess = successCallback;
  13989. };
  13990. Workbench.prototype.stopCheckModule = function () {
  13991. clearInterval(this.checkTimer);
  13992. this.checkTimer = null;
  13993. };
  13994. Workbench.prototype.showDataSync = function () {
  13995. var ins = new DbSync();
  13996. ins.showPage({
  13997. id: 'db_sync__',
  13998. path: 'db_sync__',
  13999. }, {
  14000. data: {}
  14001. });
  14002. };
  14003. /**
  14004. * 打开一个项目
  14005. */
  14006. Workbench.prototype.openProject = function (project) {
  14007. setCurrentProject(project);
  14008. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  14009. handles$1.fileTree.reload();
  14010. };
  14011. /**
  14012. * 打开模板开发面板
  14013. */
  14014. Workbench.prototype.showTemplateDev = function () {
  14015. var ins = new TemplateDev();
  14016. ins.showPage({
  14017. id: 'template_dev__',
  14018. path: 'template_dev__',
  14019. }, {
  14020. data: {}
  14021. });
  14022. };
  14023. Workbench.prototype.openScope = function () {
  14024. };
  14025. /**
  14026. * 显示字段域管理器
  14027. */
  14028. Workbench.prototype.showColumnDomain = function () {
  14029. var instance = new DbDomain();
  14030. instance.showPage({
  14031. id: 'domain__',
  14032. path: 'domain__',
  14033. }, {
  14034. data: {}
  14035. });
  14036. };
  14037. /**
  14038. * 显示性能统计
  14039. */
  14040. Workbench.prototype.showPerform = function () {
  14041. // const instance = new PerformStats()
  14042. // instance.showPage({
  14043. // id: 'perform__',
  14044. // path: 'perform__',
  14045. //
  14046. // }, {
  14047. // data: {}
  14048. // })
  14049. };
  14050. /**
  14051. * 显示数据库代码模板库
  14052. */
  14053. Workbench.prototype.showDbCodeTemplate = function () {
  14054. // const instance = new DbCodeTemplate()
  14055. // instance.showPage({
  14056. // id: 'dbcode__',
  14057. // path: 'dbcode__',
  14058. //
  14059. // }, {
  14060. // data: {}
  14061. // })
  14062. };
  14063. /**
  14064. * 显示数据库代码模板库
  14065. */
  14066. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14067. var instance = new ReportDesign();
  14068. instance.showPage({
  14069. id: 'report_' + report_id,
  14070. path: 'report_' + report_id,
  14071. }, {
  14072. data: {
  14073. report_id: report_id,
  14074. report_name: report_name,
  14075. }
  14076. });
  14077. instance.dialogSuccess = success;
  14078. };
  14079. /**
  14080. * 显示报表
  14081. */
  14082. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14083. instance.showPage({
  14084. id: 'REPORT__' + report_id,
  14085. path: 'REPORT__' + report_id,
  14086. }, {
  14087. data: {
  14088. report_id: report_id,
  14089. }
  14090. });
  14091. var reportName = instance.viewModel.get('report_name');
  14092. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14093. };
  14094. /**
  14095. * 显示运维页面
  14096. */
  14097. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14098. // const instance = new DevOpsTerminal()
  14099. // instance.showPage({
  14100. // id: 'ops_' + opsId,
  14101. // path: 'ops_' + opsId,
  14102. //
  14103. // }, {
  14104. // data: {
  14105. // opsId: opsId,
  14106. // name: name,
  14107. // }
  14108. // })
  14109. // instance.dialogSuccess = success
  14110. };
  14111. /**
  14112. * 显示表结构
  14113. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14114. * columnName 可以为空
  14115. */
  14116. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14117. var id = 'tableColumn_' + tableName;
  14118. var isCreateTable = false;
  14119. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14120. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14121. if (!tableName) {
  14122. id = _$2.uniqueId('new_table');
  14123. tableName = id;
  14124. isCreateTable = true;
  14125. }
  14126. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14127. instance.showPage({
  14128. id: id,
  14129. path: id,
  14130. locatPath: locatPath
  14131. }, {
  14132. data: {
  14133. tableName: tableName,
  14134. columnName: columnName
  14135. }
  14136. });
  14137. };
  14138. /**
  14139. * 打开某个模块
  14140. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14141. */
  14142. Workbench.prototype.showModule = function (rawData) {
  14143. var id = rawData.id, path = rawData.path;
  14144. var separator = '/';
  14145. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14146. var module = this.modules[idx];
  14147. var pageId = path.replaceAll('/', '_');
  14148. console.log('open module', module);
  14149. var instance = new ModulePage(id, module);
  14150. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14151. instance.showPage({
  14152. id: 'module_' + pageId,
  14153. path: path,
  14154. title: module.name
  14155. }, {
  14156. data: {}
  14157. });
  14158. };
  14159. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14160. var bpmnDesign = new BpmnDesign();
  14161. bpmnDesign.showPage({}, {
  14162. data: {
  14163. absolutePath: absolutePath,
  14164. id: id,
  14165. text: text
  14166. }
  14167. });
  14168. };
  14169. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14170. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  14171. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14172. layoutDesign.showPage({
  14173. id: id,
  14174. path: id,
  14175. }, {
  14176. data: {}
  14177. });
  14178. };
  14179. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14180. var _a;
  14181. // this.activeModulePage = newCard.yvanScope
  14182. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14183. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14184. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14185. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14186. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14187. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14188. eventBus.publish(EventType.MainTabChange, {
  14189. moduleId: newCard.yvanScope.moduleId,
  14190. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14191. from: this.name
  14192. });
  14193. };
  14194. Workbench.prototype.onUndo = function () {
  14195. var _a;
  14196. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14197. };
  14198. Workbench.prototype.onRedo = function () {
  14199. var _a;
  14200. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14201. };
  14202. Workbench.prototype.onCut = function (a, b, c, d) {
  14203. var _a;
  14204. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14205. };
  14206. Workbench.prototype.onCopy = function (a, b, c, d) {
  14207. var _a;
  14208. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14209. };
  14210. Workbench.prototype.onPaste = function (a, b, c, d) {
  14211. var _a;
  14212. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14213. };
  14214. Workbench.prototype.onSelectAll = function () {
  14215. var _a;
  14216. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14217. };
  14218. return Workbench;
  14219. }(Scope));
  14220. //# sourceMappingURL=Workbench.js.map
  14221. (function (FuncDomain) {
  14222. FuncDomain["SCOPE"] = "scope";
  14223. FuncDomain["SYSTEM"] = "system";
  14224. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14225. (function (BizMode) {
  14226. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14227. BizMode[BizMode["query"] = 1] = "query";
  14228. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14229. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14230. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14231. })(exports.BizMode || (exports.BizMode = {}));
  14232. (function (BizFormat) {
  14233. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14234. BizFormat[BizFormat["button"] = 1] = "button";
  14235. BizFormat[BizFormat["progress"] = 2] = "progress";
  14236. BizFormat[BizFormat["date"] = 3] = "date";
  14237. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14238. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14239. })(exports.BizFormat || (exports.BizFormat = {}));
  14240. (function (BizUnique) {
  14241. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14242. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14243. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14244. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14245. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14246. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14247. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14248. })(exports.BizUnique || (exports.BizUnique = {}));
  14249. var ScopeEngine = /** @class */ (function () {
  14250. function ScopeEngine() {
  14251. }
  14252. ScopeEngine.getBizFile = function (director) {
  14253. return new Promise(function (resolve, reject) {
  14254. debugger;
  14255. });
  14256. };
  14257. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14258. return new Promise(function (resolve, reject) {
  14259. var requireArr = [];
  14260. var requireKeyArr = [];
  14261. _$2.forOwn(billFile.domains, function (v, k) {
  14262. requireArr.push(v.domain);
  14263. requireKeyArr.push(k);
  14264. if (v.layout) {
  14265. requireArr.push(v.layout);
  14266. requireKeyArr.push(k + "_layout");
  14267. }
  14268. });
  14269. requireArr.push(billFile.layout);
  14270. requireKeyArr.push("layout");
  14271. requireArr.push(billFile.converter);
  14272. requireKeyArr.push("converter");
  14273. // @ts-ignore
  14274. require(requireArr, function () {
  14275. var requireReArr = [];
  14276. for (var _i = 0; _i < arguments.length; _i++) {
  14277. requireReArr[_i] = arguments[_i];
  14278. }
  14279. if (requireReArr.length <= 0) {
  14280. reject(new Error("没有加载到相关的文件!"));
  14281. }
  14282. var domains = {};
  14283. for (var i = 0; i < requireReArr.length - 2; i++) {
  14284. if (requireKeyArr[i].endsWith("_layout")) {
  14285. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14286. domains[key_d].layout = requireReArr[i].default;
  14287. }
  14288. else {
  14289. domains[requireKeyArr[i]] = requireReArr[i].default;
  14290. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14291. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14292. }
  14293. }
  14294. var bizFile = {
  14295. bill: billFile,
  14296. domains: domains,
  14297. layout: requireReArr[requireReArr.length - 2].default,
  14298. converter: requireReArr[requireReArr.length - 1].default,
  14299. };
  14300. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14301. scope.billSetting = bizFile;
  14302. resolve(scope);
  14303. });
  14304. });
  14305. };
  14306. ScopeEngine.buildScopeFromPath = function (path) {
  14307. return new Promise(function (resolve, reject) {
  14308. // @ts-ignore
  14309. require([path], function (bill) {
  14310. bill = bill.default;
  14311. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14312. resolve(scope);
  14313. }).catch(function (e) {
  14314. reject(e);
  14315. });
  14316. });
  14317. });
  14318. };
  14319. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14320. var controller = {};
  14321. var vjson = {
  14322. layout: 'fit',
  14323. title: bizFile.bill.name,
  14324. items: []
  14325. };
  14326. var model = {};
  14327. if (bizFile.layout.layout === "fit") {
  14328. vjson.items = bizFile.layout.items;
  14329. }
  14330. else if (bizFile.layout.layout === "border") {
  14331. vjson.items = [bizFile.layout];
  14332. }
  14333. var domainsVjson = {};
  14334. _$2.forOwn(bizFile.domains, function (v, k) {
  14335. var domainVjson = null;
  14336. var buttons = bizFile.domains[k].buttons;
  14337. if (bizFile.bill.domains[k].mode === "form") {
  14338. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14339. if (Array.isArray(buttons) && buttons.length > 0) {
  14340. if (bizFile.bill.domains[k].type === "header") {
  14341. vjson.tbar = {
  14342. xtype: 'toolbar',
  14343. items: ScopeEngine.buildButton(controller, buttons)
  14344. };
  14345. }
  14346. else {
  14347. domainVjson.items.push({
  14348. xtype: "cols",
  14349. items: ScopeEngine.buildButton(controller, buttons)
  14350. });
  14351. }
  14352. }
  14353. }
  14354. else if (bizFile.bill.domains[k].mode === "table") {
  14355. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14356. if (Array.isArray(buttons) && buttons.length > 0) {
  14357. if (bizFile.bill.domains[k].type === "header") {
  14358. vjson.tbar = {
  14359. xtype: 'toolbar',
  14360. items: ScopeEngine.buildButton(controller, buttons)
  14361. };
  14362. }
  14363. else {
  14364. domainVjson.tbar = {
  14365. xtype: 'toolbar',
  14366. items: ScopeEngine.buildButton(controller, buttons)
  14367. };
  14368. }
  14369. }
  14370. }
  14371. if (domainVjson) {
  14372. domainsVjson[k] = domainVjson;
  14373. }
  14374. });
  14375. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14376. var scope = new Scope({ model: model, vjson: vjson });
  14377. scope['bill_define'] = bizFile;
  14378. _$2.merge(scope, controller);
  14379. console.log('bill_define', vjson, scope, scope['bill_define']);
  14380. return scope;
  14381. };
  14382. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14383. var fieldGroups = {};
  14384. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14385. var field = bizFile.domains[domainKey].fields[i];
  14386. var item = { sort: field.form_sort };
  14387. item.xtype = field.xtype;
  14388. item.fieldLabel = field.column_desc;
  14389. item.bind = {
  14390. value: "{" + domainKey + "." + field.column_name + "}",
  14391. };
  14392. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14393. // if (field.disabled !== "true" && field.disabled !== "false") {
  14394. // item.bind.disabled = eval(field.disabled)
  14395. // } else {
  14396. // item.disabled = (field.disabled === "true")
  14397. // }
  14398. // if (field.readonly !== "true" && field.readonly !== "false") {
  14399. // item.bind.disabled = eval(field.readonly)
  14400. // } else {
  14401. // item.readonly = (field.readonly === "true")
  14402. // }
  14403. // if (field.required !== "true" && field.required !== "false") {
  14404. // item.bind.required = eval(field.required)
  14405. // } else {
  14406. // item.required = (field.required === "true")
  14407. // }
  14408. // if (field.hide !== "true" && field.hide !== "false") {
  14409. // item.bind.hidden = eval(field.hide)
  14410. // } else {
  14411. // item.hidden = (field.hide === "true")
  14412. // }
  14413. // item.flex = field.
  14414. if (field.dict) {
  14415. item.fix = eval(field.dict);
  14416. }
  14417. // _.set(formModel, "", "")
  14418. item.field = field;
  14419. if (field.form_group) {
  14420. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14421. fieldGroups[field.form_group] = [item];
  14422. }
  14423. else {
  14424. fieldGroups[field.form_group].push(item);
  14425. }
  14426. }
  14427. }
  14428. var formVjson = {
  14429. xtype: "form",
  14430. title: bizFile.domains[domainKey].name,
  14431. items: []
  14432. };
  14433. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14434. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14435. if (items) {
  14436. var fieldsetVjson = {
  14437. xtype: "fieldset",
  14438. title: k,
  14439. items: items
  14440. };
  14441. formVjson.items.push(fieldsetVjson);
  14442. }
  14443. });
  14444. return formVjson;
  14445. };
  14446. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14447. // const vjson = { xtype: "grid", items: []}
  14448. var gridVjson = {
  14449. xtype: "yvgrid",
  14450. columns: [],
  14451. split: true,
  14452. reference: domainKey,
  14453. listeners: {
  14454. itemdblclick: function () {
  14455. },
  14456. },
  14457. };
  14458. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14459. var field = bizFile.domains[domainKey].fields[i];
  14460. gridVjson.columns.push({
  14461. dataIndex: field.column_name,
  14462. header: field.column_desc,
  14463. });
  14464. }
  14465. return gridVjson;
  14466. };
  14467. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14468. var colGroups = [{
  14469. xtype: "cols",
  14470. items: []
  14471. }];
  14472. var colGroup = colGroups[0];
  14473. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14474. for (var i = 0; i < fieldGroup.length; i++) {
  14475. var field = fieldGroup[i];
  14476. if (field.field.form_newline === "true") {
  14477. if (colGroup.items.length > 0) {
  14478. colGroup = {
  14479. xtype: "cols",
  14480. items: [field]
  14481. };
  14482. colGroups.push(colGroup);
  14483. }
  14484. }
  14485. else {
  14486. colGroup.items.push(field);
  14487. }
  14488. delete field.field;
  14489. }
  14490. return colGroups;
  14491. };
  14492. ScopeEngine.buildButton = function (controller, buttons) {
  14493. var buttonsVjson = [];
  14494. var _loop_1 = function (i) {
  14495. var item = buttons[i];
  14496. var button = {
  14497. xtype: "button",
  14498. text: item.btn_name,
  14499. iconCls: item.icon
  14500. };
  14501. if (item.hidden === "true" || item.hidden === "false") {
  14502. button.hidden = (item.hidden === "true");
  14503. }
  14504. if (item.listeners) {
  14505. var listeners_1 = {};
  14506. _$2.forOwn(item.listeners, function (v, k) {
  14507. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14508. listeners_1[k] = v;
  14509. }
  14510. else {
  14511. try {
  14512. listeners_1[k] = eval(v);
  14513. }
  14514. catch (e) {
  14515. throw e;
  14516. }
  14517. }
  14518. });
  14519. button.listeners = listeners_1;
  14520. }
  14521. buttonsVjson.push(button);
  14522. };
  14523. for (var i = 0; i < buttons.length; i++) {
  14524. _loop_1(i);
  14525. }
  14526. return buttonsVjson;
  14527. };
  14528. ScopeEngine.buildListeners = function (controller, item) {
  14529. if (!item.hasOwnProperty("listeners")) {
  14530. return;
  14531. }
  14532. _$2.forOwn(item.listeners, function (v, k) {
  14533. if (v && typeof v === "string") {
  14534. if (v.indexOf(".") > -1) {
  14535. var strArr = v.split(".");
  14536. if (strArr.length != 2) {
  14537. console.error(item.listeners, "语法解析错误,请检查!");
  14538. }
  14539. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14540. switch (funcDomain) {
  14541. case exports.FuncDomain.SCOPE:
  14542. controller[k] = findCustFunc(item, k);
  14543. break;
  14544. case exports.FuncDomain.SYSTEM:
  14545. break;
  14546. default:
  14547. throw new Error("错误的函数域定义");
  14548. }
  14549. }
  14550. else {
  14551. var func = eval(v);
  14552. if (typeof func === 'function') {
  14553. controller[k] = func;
  14554. }
  14555. throw new Error("解析自定义函数出错");
  14556. }
  14557. }
  14558. });
  14559. var findCustFunc = function (item, funcName) {
  14560. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14561. throw new Error("没有找到相关的函数定义");
  14562. }
  14563. var func = eval(item[funcName]);
  14564. if (typeof func === 'function') {
  14565. return func;
  14566. }
  14567. throw new Error("解析自定义函数出错");
  14568. };
  14569. };
  14570. /**
  14571. * 只检索 items 的模式,深度遍历 vjson
  14572. */
  14573. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14574. if (Array.isArray(vjson)) {
  14575. for (var i = 0; i < vjson.length; i++) {
  14576. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14577. }
  14578. }
  14579. else {
  14580. _$2.forOwn(vjson, function (v, k) {
  14581. if (k !== "domain") {
  14582. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14583. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14584. }
  14585. }
  14586. else {
  14587. delete vjson.domain;
  14588. _$2.merge(vjson, domainsVjson[v]);
  14589. }
  14590. });
  14591. }
  14592. };
  14593. return ScopeEngine;
  14594. }());
  14595. //# sourceMappingURL=ScopeEngine.js.map
  14596. function initComponent () {
  14597. var ct = Ext.Component.prototype.constructor;
  14598. Ext.Component.override({
  14599. constructor: function (config) {
  14600. var _a, _b;
  14601. if (!isDesignMode(this, config)) {
  14602. var me_1 = this;
  14603. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14604. _$2.each(baseConfigProcessList, function (process) {
  14605. process.call(me_1, me_1, config);
  14606. });
  14607. }
  14608. if (config) {
  14609. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  14610. config.i18nPath = config.$initParent.i18nPath;
  14611. }
  14612. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  14613. var setTitle_1 = config.$initParent.setTitle;
  14614. var handel_1 = config.$initParent;
  14615. config.$initParent.setTitle = function (title) {
  14616. var t = { title: title };
  14617. var WMSTranslate = window["WMSTranslate"];
  14618. if (WMSTranslate) {
  14619. if (typeof window['viewTranslate'] === 'function') {
  14620. window['viewTranslate'](t, title, "title");
  14621. }
  14622. }
  14623. setTitle_1.call(handel_1, t.title);
  14624. }.bind(config.$initParent);
  14625. }
  14626. var WMSTranslate = window["WMSTranslate"];
  14627. if (WMSTranslate) {
  14628. if (typeof window['viewTranslate'] === 'function') {
  14629. window['viewTranslate'](config, config.text, "text");
  14630. window['viewTranslate'](config, config.title, "title");
  14631. window['viewTranslate'](config, config.header, "header");
  14632. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  14633. }
  14634. }
  14635. }
  14636. ct.call(this, config);
  14637. }
  14638. });
  14639. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14640. Ext.picker.Date.override({
  14641. initComponent: function () {
  14642. var me = this;
  14643. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14644. _initComponent.call(me);
  14645. },
  14646. selectToday: function () {
  14647. var me = this, btn = me.todayBtn, handler = me.handler;
  14648. if (btn && !btn.disabled) {
  14649. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14650. me.fireEvent('select', me, me.value);
  14651. if (handler) {
  14652. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14653. }
  14654. me.onSelect();
  14655. }
  14656. return me;
  14657. },
  14658. });
  14659. }
  14660. //# sourceMappingURL=component.js.map
  14661. function initMainTab () {
  14662. Ext.define('Yvan.MainTab', {
  14663. extend: 'Ext.tab.Panel',
  14664. xtype: 'maintab',
  14665. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14666. closeTabText: '关闭',
  14667. closeOthersTabsText: '关闭其他',
  14668. closeAllTabsText: '关闭所有'
  14669. }),
  14670. constructor: function (config) {
  14671. var me = this;
  14672. var newConfig = _$2.defaultsDeep({
  14673. // 强制属性
  14674. }, config);
  14675. this.superclass.constructor.call(me, newConfig);
  14676. },
  14677. initComponent: function () {
  14678. var me = this;
  14679. this.on({
  14680. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14681. _$2.defer(function () {
  14682. me.changeHash(newCard.id);
  14683. window['cp'] = newCard.yvanScope;
  14684. });
  14685. $$2(window).trigger('tabChange', {
  14686. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14687. });
  14688. },
  14689. afterrender: function () {
  14690. _$2.defer(function () {
  14691. me.tryRestoryPage();
  14692. });
  14693. }
  14694. });
  14695. this.superclass.initComponent.call(me);
  14696. },
  14697. tryRestoryPage: function () {
  14698. var me = this;
  14699. var hash = '' + window.location.hash;
  14700. if (hash && hash.indexOf('page=') > 0) {
  14701. if (hash.startsWith('#')) {
  14702. hash = hash.substr(1);
  14703. }
  14704. if (hash) {
  14705. var page = Qs.parse(hash).page;
  14706. if (page) {
  14707. // this.openScope(page)
  14708. me.fireEvent('restorypage', page);
  14709. }
  14710. }
  14711. }
  14712. },
  14713. changeHash: function (id) {
  14714. window.location.hash = Qs.stringify({ page: id });
  14715. },
  14716. /**
  14717. * 添加一个业务模块实例到选项卡
  14718. * @param scopeInstance 业务对象实例
  14719. * @param config ExtJS配置对象
  14720. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14721. */
  14722. addScope: function (scopeInstance, config, panelInitCallback) {
  14723. scopeInstance.topScope = scopeInstance;
  14724. var me = this;
  14725. if (config.path) {
  14726. for (var i = 0; i < this.items.items.length; i++) {
  14727. // 找到当前 tabs 里有没有已经打开过
  14728. var tab = this.items.items[i];
  14729. if (_$2.isEqual(tab.path, config.path)) {
  14730. // 激活
  14731. this.setActiveTab(tab);
  14732. return tab;
  14733. }
  14734. }
  14735. }
  14736. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14737. if (typeof panelInitCallback === 'function') {
  14738. panelInitCallback(newPanel);
  14739. }
  14740. // 添加业务模块
  14741. var newTab = this.add(newPanel);
  14742. this.setActiveTab(newTab);
  14743. newTab.on({
  14744. destroy: function (sender) {
  14745. me.changeHash('');
  14746. delete window['cp'];
  14747. }
  14748. });
  14749. return newTab;
  14750. }
  14751. });
  14752. }
  14753. //# sourceMappingURL=MainTab.js.map
  14754. /**
  14755. * 构建所有组件的公共属性
  14756. * @param config 原始config
  14757. * @param dragType 组件模式
  14758. * 不填,代表不能在设计时被拖拽
  14759. * row-container 是一个rows容器
  14760. * col-container 是一个cols容器
  14761. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14762. * row-item rows中的一行,比如 tree / grid / panel 等等
  14763. */
  14764. function baseConfig(config, dragType) {
  14765. // if (isDesignMode(config, undefined) && dragType) {
  14766. if (typeof config === 'object') {
  14767. var cc = '';
  14768. switch (dragType) {
  14769. case "cols-container":
  14770. cc = 'design_cols_container';
  14771. break;
  14772. case "col-item":
  14773. cc = 'design_col_item';
  14774. break;
  14775. case "rows-container":
  14776. cc = 'design_rows_container';
  14777. break;
  14778. case "row-item":
  14779. cc = 'design_row_item';
  14780. break;
  14781. }
  14782. if (typeof config.cls === 'string') {
  14783. _$2.extend(config, {
  14784. cls: [config.cls, 'yvan_design', cc]
  14785. });
  14786. }
  14787. else if (_$2.isArray(config.cls)) {
  14788. _$2.extend(config, {
  14789. cls: __spread(config.cls, ['yvan_design', cc])
  14790. });
  14791. }
  14792. else {
  14793. _$2.extend(config, {
  14794. cls: ['yvan_design', cc]
  14795. });
  14796. }
  14797. }
  14798. return config;
  14799. }
  14800. //# sourceMappingURL=base.js.map
  14801. function initPanel () {
  14802. /**
  14803. *
  14804. */
  14805. var ct = Ext.panel.Panel.prototype.constructor;
  14806. Ext.panel.Panel.override({
  14807. constructor: function (config) {
  14808. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14809. ct.call(this, newConfig);
  14810. }
  14811. });
  14812. var ss = Ext.form.FieldContainer.prototype;
  14813. Ext.form.FieldContainer.override({
  14814. config: __assign({}, fieldContainer)
  14815. });
  14816. }
  14817. //# sourceMappingURL=panel.js.map
  14818. function initGridColumn () {
  14819. var ct = Ext.grid.column.Column.prototype.constructor;
  14820. Ext.grid.column.Column.override({
  14821. constructor: function (config) {
  14822. var scope = lookupScope(config.$initParent.$initParent);
  14823. var newConfig = _$2.defaults({}, config, column);
  14824. if (typeof newConfig.summaryRenderer === 'string') {
  14825. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14826. if (typeof newConfig.summaryRenderer === 'function') {
  14827. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14828. }
  14829. }
  14830. if (config.formatter === 'datetime') {
  14831. newConfig.fix = ['system.formatDate()'];
  14832. delete newConfig.formatter;
  14833. }
  14834. // 在 grid.constructor 已经转换过了
  14835. // if (typeof newConfig.renderer === 'string') {
  14836. // newConfig.renderer = lookupFn(scope, config.renderer)
  14837. // if (typeof newConfig.renderer === 'function') {
  14838. // newConfig.renderer = newConfig.renderer.bind(scope)
  14839. // }
  14840. // }
  14841. ct.call(this, newConfig);
  14842. }
  14843. });
  14844. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14845. Ext.grid.column.Action.override({
  14846. constructor: function (config) {
  14847. var scope = lookupScope(config.$initParent.$initParent);
  14848. _$2.forEach(config.items, function (item) {
  14849. if (typeof item.handler === 'string') {
  14850. item.handler = lookupFn(scope, item.handler);
  14851. if (typeof item.handler === 'function') {
  14852. item.handler = item.handler.bind(scope);
  14853. }
  14854. }
  14855. });
  14856. ctAction.call(this, config);
  14857. }
  14858. });
  14859. var ck = Ext.grid.column.Check.prototype.constructor;
  14860. Ext.grid.column.Check.override({
  14861. constructor: function (config) {
  14862. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14863. var grid = sender.view.grid.ownerGrid;
  14864. var column = grid.getColumns()[sender.fullColumnIndex];
  14865. var context = {
  14866. event: e,
  14867. column: column,
  14868. field: sender.dataIndex,
  14869. value: checked,
  14870. record: record,
  14871. rowIdx: rowIndex
  14872. };
  14873. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14874. });
  14875. ck.call(this, config);
  14876. }
  14877. });
  14878. // 227573
  14879. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14880. // Ext.define('Yvan.ColumnOverride', {
  14881. // override: 'Ext.grid.column.Column',
  14882. //
  14883. // config: {
  14884. // enableSortOnClick: false,
  14885. // },
  14886. //
  14887. // // /**@Overrides*/
  14888. // onTitleElClick: function (e, t, sortOnClick) {
  14889. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14890. // if (!$(e.target).is('.x-column-header-trigger')) {
  14891. // // 不是点击菜单的情况下,让列自适应宽度
  14892. // this.autoSize()
  14893. // }
  14894. // return onTitleElClick.call(this, e, t, false)
  14895. // }
  14896. // });
  14897. }
  14898. //# sourceMappingURL=gridcolumn.js.map
  14899. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14900. /**
  14901. * 判断目标字符串与关键字是否重叠
  14902. * @param target 目标字符串
  14903. * @param keyword 搜索关键字
  14904. */
  14905. function pinyinMatch(target, keyword) {
  14906. if (typeof target != 'string' || typeof keyword != 'string') {
  14907. return false;
  14908. }
  14909. if (!keyword || !target) {
  14910. return false;
  14911. }
  14912. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14913. keyword = _$2.toLower(keyword);
  14914. var pos1 = _$2.toLower(target).indexOf(keyword);
  14915. if (pos1 >= 0) {
  14916. return true;
  14917. }
  14918. var len = _$2.intersection(keyword.split('')).length;
  14919. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14920. return true;
  14921. }
  14922. return false;
  14923. }
  14924. /**
  14925. * 对某个表达式进行求值
  14926. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14927. *
  14928. * @example
  14929. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14930. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14931. *
  14932. * @param data 数据环境对象
  14933. * @param express 表达式对象
  14934. */
  14935. function calcExpress(data, express) {
  14936. var result = express;
  14937. if (SIMPLE_RE.test(express)) {
  14938. // '{foo}' 简单表达式
  14939. var path = express.substring(1, express.length - 1);
  14940. var ret = _$2.get(data, path);
  14941. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14942. }
  14943. while (true) {
  14944. var mlist = result.match(/{(.*?)}/);
  14945. if (!mlist) {
  14946. break;
  14947. }
  14948. var pathC = mlist[0]; // {query.a}
  14949. var path = mlist[1]; // query.a
  14950. var value = _$2.get(data, path);
  14951. result = result.replaceAll(pathC, value || '');
  14952. }
  14953. return result;
  14954. }
  14955. /**
  14956. * 对个对象进行表达式求值,不用回调
  14957. * @example
  14958. * 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}'] })
  14959. *
  14960. * {
  14961. * a: '{query.a}',
  14962. * b: {
  14963. * b1: '{query.b1}',
  14964. * b2: '{query.b2}',
  14965. * },
  14966. * c: 'aa',
  14967. * d: [
  14968. * '{query.d1}',
  14969. * '{query.d2}'
  14970. * ]
  14971. * }
  14972. *
  14973. * 计算结果为
  14974. * {
  14975. * a: 'aValue',
  14976. * b: {
  14977. * b1: 'b1Value',
  14978. * b2: 'b2Value'
  14979. * },
  14980. * c: 'aa'
  14981. * d: [
  14982. * '1',
  14983. * '2'
  14984. * ]
  14985. * }
  14986. *
  14987. * @param data
  14988. * @param paramObject
  14989. */
  14990. function calcObjectFlat(data, paramObject) {
  14991. var result = _$2.cloneDeep(paramObject);
  14992. if (typeof paramObject === 'string') {
  14993. return calcExpress(data, paramObject);
  14994. }
  14995. var trav = function (param) {
  14996. _$2.forOwn(param, function (value, key) {
  14997. if (_$2.isPlainObject(value)) {
  14998. // 深度递归,对子对象进行求解
  14999. trav(value);
  15000. }
  15001. else if (_$2.isString(value)) {
  15002. // 字符串直接用 calcExpress 表达式求解
  15003. param[key] = calcExpress(data, param[key]);
  15004. }
  15005. else if (_$2.isArray(value)) {
  15006. // 数组求解
  15007. _$2.each(value, function (v, idx) {
  15008. value[idx] = calcExpress(data, v);
  15009. });
  15010. }
  15011. });
  15012. };
  15013. trav(result);
  15014. return result;
  15015. }
  15016. /**
  15017. * 合併 data 到當前的 ViewModel 對象
  15018. */
  15019. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  15020. var newRow = {};
  15021. if (isFlat == false) {
  15022. newRow = data;
  15023. }
  15024. else {
  15025. flatObject(newRow, '', data);
  15026. }
  15027. if (!propertyName) {
  15028. _$2.forOwn(newRow, function (value, key) {
  15029. viewModel.set(key, value);
  15030. });
  15031. }
  15032. else {
  15033. _$2.forOwn(newRow, function (value, key) {
  15034. viewModel.set(propertyName + "." + key, value);
  15035. });
  15036. }
  15037. }
  15038. /**
  15039. * 转换内联结构的行,到平面结构
  15040. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  15041. *
  15042. * @param array
  15043. * @param flatOption
  15044. * @return {[]}
  15045. */
  15046. function flatRow(array) {
  15047. var ret = [];
  15048. _$2.forEach(array, function (row) {
  15049. var newRow = {};
  15050. flatObject(newRow, '', row);
  15051. ret.push(newRow);
  15052. });
  15053. return ret;
  15054. }
  15055. function flatObject(parentObj, parentProp, obj) {
  15056. _$2.forOwn(obj, function (value, key) {
  15057. var fullKey = parentProp ? parentProp + '_' + key : key;
  15058. if (_$2.isArray(value)) {
  15059. parentObj[fullKey] = _$2.map(value, function (row) {
  15060. var newRow = {};
  15061. flatObject(newRow, '', row);
  15062. return newRow;
  15063. });
  15064. }
  15065. else {
  15066. if (typeof value === 'object') {
  15067. flatObject(parentObj, fullKey, value);
  15068. }
  15069. else {
  15070. parentObj[fullKey] = value;
  15071. }
  15072. }
  15073. });
  15074. }
  15075. /**
  15076. * 替换内部结构中,所有 N/A
  15077. */
  15078. function replaceNA(obj) {
  15079. if (obj === 'N/A') {
  15080. return '';
  15081. }
  15082. if (_$2.isArray(obj)) {
  15083. _$2.forEach(obj, function (value, idx) {
  15084. if (value === 'N/A') {
  15085. obj[idx] = '';
  15086. }
  15087. else {
  15088. replaceNA(value);
  15089. }
  15090. });
  15091. }
  15092. else if (_$2.isPlainObject(obj)) {
  15093. _$2.forOwn(obj, function (value, key) {
  15094. if (value === 'N/A') {
  15095. obj[key] = '';
  15096. }
  15097. else {
  15098. replaceNA(value);
  15099. }
  15100. });
  15101. }
  15102. }
  15103. function deepTravJson(obj, resolver) {
  15104. if (_$2.isArray(obj)) {
  15105. _$2.forEach(obj, function (value, idx) {
  15106. if (typeof value === 'string') {
  15107. resolver(obj, value, idx);
  15108. }
  15109. else {
  15110. deepTravJson(value, resolver);
  15111. }
  15112. });
  15113. }
  15114. else if (_$2.isPlainObject(obj)) {
  15115. _$2.forOwn(obj, function (value, key) {
  15116. if (typeof value === 'string') {
  15117. resolver(obj, value, key);
  15118. }
  15119. else {
  15120. deepTravJson(value, resolver);
  15121. }
  15122. });
  15123. }
  15124. }
  15125. /**
  15126. * 根据表达式进入写值
  15127. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15128. * express="test-{query.a}" 写值就会失败
  15129. *
  15130. * @example
  15131. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15132. * 写值成功
  15133. *
  15134. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15135. * 写值失败
  15136. *
  15137. * @param viewModel VM对象
  15138. * @param express 表达式对象
  15139. * @param value 目标值
  15140. */
  15141. function tryWriteByExpress(viewModel, express, value) {
  15142. if (SIMPLE_RE.test(express)) {
  15143. // '{foo}' 简单表达式
  15144. express = express.substring(1, express.length - 1);
  15145. viewModel.set(express, value);
  15146. }
  15147. }
  15148. /**
  15149. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15150. * @example
  15151. * 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]})
  15152. *
  15153. * expressObject:
  15154. * {
  15155. * a: '{query.a}',
  15156. * b: {
  15157. * b1: '{query.b1}',
  15158. * b2: '{query.b2}',
  15159. * },
  15160. * c: 'aa',
  15161. * d: [
  15162. * '{query.a}',
  15163. * '{query.b2}'
  15164. * ]
  15165. * }
  15166. *
  15167. * valueObject:
  15168. * {
  15169. * a: 'aValue',
  15170. * b: {
  15171. * b1: 'b1Value',
  15172. * b2: 'b2Value'
  15173. * },
  15174. * c: 'aa'
  15175. * c: [
  15176. * 'aValue',
  15177. * 'b2Value'
  15178. * ]
  15179. * }
  15180. *
  15181. * 系统会尝试回写
  15182. * viewModel.set('query.a', 'aValue')
  15183. * viewModel.set('query.b1', 'b1Value')
  15184. * viewModel.set('query.b2', 'b2Value')
  15185. *
  15186. * @param expressObject 含表达式的对象
  15187. * @param valueObject 表达式计算完成之后的结果对象
  15188. * @param writeFn 写入的方法 (path, value)=>void
  15189. */
  15190. function tryWriteObject(expressObject, valueObject, writeFn) {
  15191. var trav = function (pathPrefix) {
  15192. var parent = expressObject;
  15193. if (_$2.size(pathPrefix) > 1) {
  15194. parent = _$2.get(parent, pathPrefix.substring(1));
  15195. }
  15196. _$2.forOwn(parent, function (value, key) {
  15197. if (_$2.isPlainObject(value)) {
  15198. // 深度递归,对子对象进行求解
  15199. trav(pathPrefix + "." + key);
  15200. }
  15201. else if (_$2.isString(value)) {
  15202. // 字符串直接用 calcExpress 表达式求解
  15203. if (SIMPLE_RE.test(value)) {
  15204. // If we have '{foo}' alone it is a literal 简单表达式
  15205. var targetPath = value.substring(1, value.length - 1);
  15206. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15207. if (!writeFn) {
  15208. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15209. }
  15210. else {
  15211. writeFn(targetPath, targetValue);
  15212. }
  15213. }
  15214. }
  15215. else if (_$2.isArray(value)) {
  15216. _$2.each(value, function (v, idx) {
  15217. if (SIMPLE_RE.test(v)) {
  15218. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15219. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15220. if (!writeFn) {
  15221. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15222. }
  15223. else {
  15224. writeFn(targetPath, targetValue);
  15225. }
  15226. }
  15227. });
  15228. }
  15229. });
  15230. };
  15231. trav("");
  15232. }
  15233. /**
  15234. * 尝试去掉变量两边括号
  15235. * {a} => a
  15236. * a => a
  15237. */
  15238. function tryVarSimple(value) {
  15239. if (SIMPLE_RE.test(value)) {
  15240. // If we have '{foo}' alone it is a literal 简单表达式
  15241. return value.substring(1, value.length - 1);
  15242. }
  15243. return value;
  15244. }
  15245. /**
  15246. * 对多个表达式进行求值. 异步回调的方式返回
  15247. * {
  15248. * a: 1,
  15249. * b: '{someBind}',
  15250. * c: ['a', 'b', 'c'],
  15251. * d: ['a', 'b', '{someBind}'],
  15252. * e: {
  15253. * y: 1,
  15254. * z: 2
  15255. * },
  15256. * f: {
  15257. * y: 1,
  15258. * z: '{someBind}'
  15259. * }
  15260. * }
  15261. *
  15262. * // Will produce
  15263. * {
  15264. * b: value,
  15265. * d: ['a', 'b', value],
  15266. * f: {
  15267. * y: 1,
  15268. * z: value
  15269. * }
  15270. * }
  15271. * @param viewModel scope.viewModel对象
  15272. * @param paramObject 求值对象
  15273. */
  15274. function calcObject(viewModel, paramObject) {
  15275. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15276. return new Promise(function (resolve) {
  15277. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15278. schedule.destroy();
  15279. // 从 Ext.data.Model 对象转换为 js-object 对象
  15280. ret = toPlainObject(ret);
  15281. resolve(ret);
  15282. }, viewModel, { single: true });
  15283. });
  15284. }
  15285. /**
  15286. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15287. * @param config 组件构造函数传入的 config 配置文件
  15288. */
  15289. function getParentGrid(config) {
  15290. var _a;
  15291. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15292. }
  15293. /**
  15294. * 解析
  15295. * {
  15296. * condition: "{skuId}",
  15297. * errorMsg: "无法编辑",
  15298. * notice: 'msg'
  15299. * }
  15300. */
  15301. function tryEnable(data, enableSetting) {
  15302. if (!enableSetting) {
  15303. // 没有这一段配置,可以编辑
  15304. return true;
  15305. }
  15306. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15307. if (!evalFunction(data, condition)) {
  15308. // 没有达成 condition 条件
  15309. // 计算 msg 消息内容
  15310. var msgContent = calcExpress(data, errorMsg);
  15311. if (msgContent) {
  15312. if (!notice || notice === 'msg') {
  15313. // 进行提示
  15314. msg$1(msgContent);
  15315. }
  15316. }
  15317. return false;
  15318. }
  15319. return true;
  15320. }
  15321. /**
  15322. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15323. * @param sender 目标对象
  15324. * @param config 目标对象的配置(在构造函数之前也可以)
  15325. * @param getDictFn 获取字典的方法
  15326. * @param bizKey 传入字典的参数
  15327. * @param multiValueSeparator 多个字典值的分割符号
  15328. */
  15329. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15330. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15331. // sender 和 config为空的时候获取值、
  15332. if (_$2.isArray(getDictFn)) {
  15333. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15334. var realArray_1 = getDictFn;
  15335. getDictFn = function () {
  15336. return realArray_1;
  15337. };
  15338. }
  15339. if (!sender) {
  15340. return new Promise(function (resolve, reject) {
  15341. getDictFn(bizKey, function (r) {
  15342. resolve({ config: config, r: r });
  15343. });
  15344. });
  15345. }
  15346. if (sender.xtype === 'combotree') {
  15347. getDictFn(bizKey, function (r) {
  15348. if (sender.store) {
  15349. // 异步回传
  15350. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15351. }
  15352. else {
  15353. // 同步回传
  15354. config.store = new Ext.data.TreeStore({ root: r });
  15355. }
  15356. });
  15357. return;
  15358. }
  15359. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15360. getDictFn(bizKey, function (r) {
  15361. var _a, _b;
  15362. if (sender.store) {
  15363. // 异步回传
  15364. sender.setStore(new Ext.data.Store(r));
  15365. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15366. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15367. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15368. if (typeof realValue !== 'undefined') {
  15369. sender.setValue(realValue);
  15370. }
  15371. }
  15372. else {
  15373. // 同步回传
  15374. config.store = new Ext.data.Store(r);
  15375. }
  15376. });
  15377. return;
  15378. }
  15379. else if (sender.xtype === 'gridcolumn') {
  15380. var grid = getParentGrid(config);
  15381. var editor_1 = config.editor, renderer = config.renderer;
  15382. getDictFn(bizKey, function (r) {
  15383. if (sender.store) {
  15384. // 已经渲染出来了, 用方法进行修改
  15385. var editor_2 = sender.getEditor();
  15386. if (editor_2 && editor_2.xtype === 'combo') {
  15387. var valueField_1 = r.field[0];
  15388. var displayField_1 = r.field[1];
  15389. editor_2.valueField = valueField_1;
  15390. editor_2.setDisplayField(displayField_1);
  15391. editor_2.setStore(new Ext.data.Store(r));
  15392. }
  15393. sender.setFilter({
  15394. type: 'list',
  15395. options: _$2.map(r.data, function (r) { return ({
  15396. id: '' + r.id,
  15397. text: r.text,
  15398. }); })
  15399. });
  15400. }
  15401. else {
  15402. // 没有渲染之前,修改 config 即可
  15403. if (editor_1 && editor_1.xtype === 'combo') {
  15404. // 带编辑模式
  15405. editor_1.store = new Ext.data.Store(r);
  15406. }
  15407. config.filter = {
  15408. type: 'list',
  15409. options: _$2.map(r.data, function (r) { return ({
  15410. id: '' + r.id,
  15411. text: r.text,
  15412. }); })
  15413. };
  15414. }
  15415. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15416. var renderer = function (value, metaData) {
  15417. if (metaData === void 0) { metaData = false; }
  15418. if (!value && value != 0) {
  15419. return '';
  15420. }
  15421. var valueField = r.field[metaData === true ? 1 : 0];
  15422. var displayField = r.field[metaData === true ? 0 : 1];
  15423. var separator = multiValueSeparator;
  15424. if (separator) {
  15425. var arr = value.split(separator);
  15426. var displayValue_1 = "";
  15427. var _loop_1 = function (i) {
  15428. var itv = arr[i];
  15429. if (i > 0) {
  15430. displayValue_1 += separator;
  15431. }
  15432. _$2.each(r.data, function (row) {
  15433. // 从 valueField 找到要显示的 displayField
  15434. if (row[valueField] == itv) {
  15435. displayValue_1 += row[displayField];
  15436. return false;
  15437. }
  15438. else {
  15439. if (i >= r.data.length - 1) {
  15440. displayValue_1 += itv;
  15441. }
  15442. }
  15443. });
  15444. };
  15445. for (var i = 0; i < arr.length; i++) {
  15446. _loop_1(i);
  15447. }
  15448. return displayValue_1;
  15449. }
  15450. _$2.each(r.data, function (row) {
  15451. // 从 valueField 找到要显示的 displayField
  15452. if (row[valueField] == value) {
  15453. value = row[displayField];
  15454. return false;
  15455. }
  15456. });
  15457. return value;
  15458. };
  15459. var dictForExcel = {};
  15460. var valueField = r.field[0];
  15461. var displayField = r.field[1];
  15462. _$2.each(r.data, function (row) {
  15463. // 从 valueField 找到要显示的 displayField
  15464. var key = row[valueField];
  15465. if (key != '' && typeof key != "undefined" && key != null) {
  15466. dictForExcel[key] = row[displayField];
  15467. }
  15468. });
  15469. if (sender.rendered) {
  15470. // 已经渲染出来了, 对列进行渲染
  15471. sender.renderer = renderer;
  15472. sender.dictForExcel = dictForExcel;
  15473. sender.getView().refresh();
  15474. }
  15475. else {
  15476. sender.renderer = renderer;
  15477. sender.dictForExcel = dictForExcel;
  15478. config.renderer = renderer;
  15479. config.dictForExcel = dictForExcel;
  15480. }
  15481. });
  15482. return;
  15483. }
  15484. throw new TypeError("无法识别的组件类型");
  15485. }
  15486. /**
  15487. * 调用服务器 Ajax
  15488. */
  15489. function invokeServer$1(url) {
  15490. var args = [];
  15491. for (var _i = 1; _i < arguments.length; _i++) {
  15492. args[_i - 1] = arguments[_i];
  15493. }
  15494. // @ts-ignore
  15495. return ajax.func({
  15496. url: url,
  15497. method: 'invoke',
  15498. args: args
  15499. });
  15500. }
  15501. function clearViewModelValues(viewModel, propertyName) {
  15502. if (!propertyName) {
  15503. var dd_1 = viewModel.getData();
  15504. _$2.forOwn(dd_1, function (value, key) {
  15505. viewModel.set(key, '');
  15506. });
  15507. return;
  15508. }
  15509. var dd = _$2.get(viewModel.getData(), propertyName);
  15510. _$2.forOwn(dd, function (value, key) {
  15511. viewModel.set(propertyName + '.' + key, '');
  15512. });
  15513. }
  15514. function reloadGrid(scope, gridRefName) {
  15515. var _a;
  15516. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15517. }
  15518. /**
  15519. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15520. */
  15521. function toPlainObject(obj) {
  15522. if (obj.isModel) {
  15523. obj = obj.data;
  15524. }
  15525. _$2.forOwn(obj, function (v, k) {
  15526. // Ext.data.Model.constructor
  15527. if (!v) {
  15528. return;
  15529. }
  15530. if (v.isModel) {
  15531. v = v.data;
  15532. }
  15533. if (typeof v === 'object') {
  15534. obj[k] = toPlainObject(v);
  15535. }
  15536. else {
  15537. obj[k] = v;
  15538. }
  15539. });
  15540. return obj;
  15541. }
  15542. function confirm(msg, sender) {
  15543. return new Promise(function (resolve) {
  15544. var _a, _b;
  15545. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15546. var t = { msg: msg };
  15547. var WMSTranslate = window["WMSTranslate"];
  15548. if (WMSTranslate) {
  15549. if (typeof window['viewTranslate'] === 'function') {
  15550. window['viewTranslate'](t, msg, "msg");
  15551. }
  15552. }
  15553. var config = {
  15554. title: '请确认',
  15555. modal: true,
  15556. animateTarget: sender,
  15557. // resizable: false,
  15558. // constrainHeader: true,
  15559. // constrain: true,
  15560. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15561. layout: {
  15562. type: 'hbox',
  15563. pack: 'start',
  15564. align: 'stretch'
  15565. },
  15566. items: [
  15567. {
  15568. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15569. border: false,
  15570. },
  15571. {
  15572. flex: 1,
  15573. border: false,
  15574. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  15575. }
  15576. ],
  15577. buttons: [
  15578. {
  15579. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15580. handler: function () {
  15581. resolve();
  15582. win.close();
  15583. }
  15584. },
  15585. {
  15586. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15587. handler: function () {
  15588. win.close();
  15589. }
  15590. }
  15591. ],
  15592. keyMapEnabled: true,
  15593. keyMap: {
  15594. ENTER: function () {
  15595. resolve();
  15596. win.close();
  15597. }
  15598. }
  15599. };
  15600. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15601. config.constrain = true;
  15602. }
  15603. var win = new Ext.Window(config);
  15604. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15605. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15606. }
  15607. win.show();
  15608. });
  15609. }
  15610. /**
  15611. * 任何符号字符串都替换成下换线
  15612. */
  15613. function normId(value) {
  15614. return _$2.replace(value, /[^\w]/g, '_');
  15615. }
  15616. /**
  15617. *
  15618. * @param sender
  15619. * @param propertyName
  15620. * @param gridRefName
  15621. */
  15622. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15623. var _a, _b;
  15624. var scope = lookupScope(sender);
  15625. clearViewModelValues(scope.viewModel, propertyName);
  15626. if (!gridRefName) {
  15627. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15628. }
  15629. else {
  15630. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15631. }
  15632. }
  15633. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15634. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15635. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15636. var value = _$2.trim(sender.rawValue);
  15637. raiseClick(eOpts.handle);
  15638. }
  15639. }, 150);
  15640. function saveGridRow(grid1) {
  15641. var _a;
  15642. var config = grid1.config;
  15643. var scope = lookupScope(grid1);
  15644. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15645. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15646. // "表格保存"的相关配置
  15647. var dbSaveConfig = {
  15648. columns: [],
  15649. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15650. saveRowValues: saveRowValues,
  15651. path: scope.originalVjson.__custom_path,
  15652. };
  15653. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15654. if (err) {
  15655. // 如果有异常就不保存
  15656. return;
  15657. }
  15658. // 构建"表格保存"的相关配置
  15659. for (var i = 0; i < config.columns.length; i++) {
  15660. var c = config.columns[i];
  15661. var v = {
  15662. dataIndex: c.dataIndex,
  15663. header: c.header,
  15664. dbColumn: c.dbColumn,
  15665. serverCreateValue: c.serverCreateValue,
  15666. dbIsDeleteKey: c.dbIsDeleteKey,
  15667. dbIsUpdateKey: c.dbIsUpdateKey,
  15668. dbUpdateEnable: c.dbUpdateEnable,
  15669. serverValueConvert: c.dbUpdateEnable,
  15670. };
  15671. if (c.editor) {
  15672. v.editor = {
  15673. xtype: c.editor.xtype,
  15674. required: c.editor.required,
  15675. };
  15676. }
  15677. dbSaveConfig.columns.push(v);
  15678. }
  15679. // 进行业务上的逻辑校验
  15680. var hasError = false;
  15681. _$2.forEach(rows, function (row, i) {
  15682. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15683. var c = config.columns[i_1];
  15684. var value = row[c.dataIndex];
  15685. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15686. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15687. hasError = true;
  15688. return false;
  15689. }
  15690. if (c.xtype === 'checkcolumn') {
  15691. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15692. row[c.dataIndex] = c.uncheckedValue;
  15693. }
  15694. if (value === true && typeof c.checkedValue !== 'undefined') {
  15695. row[c.dataIndex] = c.checkedValue;
  15696. }
  15697. }
  15698. }
  15699. });
  15700. if (hasError) {
  15701. return;
  15702. }
  15703. // 设置当前界面为 "保存中..." 状态
  15704. grid1.setLoading(true);
  15705. invokeServer$1('/Dev@batchSave', {
  15706. newRows: newRows,
  15707. modifyRows: modifyRows,
  15708. removeRecords: removeRecords,
  15709. config: dbSaveConfig,
  15710. }).then(function (res) {
  15711. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15712. msg$1(res.msg);
  15713. grid1.reload();
  15714. }).catch(function (e) {
  15715. console.error(e);
  15716. showErrorDialog$1(_$2.toString(e));
  15717. }).finally(function () {
  15718. // 无论正常异常,关闭 "保存中..." 状态
  15719. grid1.setLoading(false);
  15720. });
  15721. }
  15722. function insertGridRow(grid1) {
  15723. var config = grid1.config;
  15724. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15725. var insertRow = {};
  15726. _$2.forEach(config.columns, function (c) {
  15727. var fn = c.createValue;
  15728. if (_$2.startsWith(fn, 'scope.') ||
  15729. _$2.startsWith(fn, 'system.')) {
  15730. var scope = lookupScope(grid1);
  15731. var fn2 = lookupFn(scope, fn, c);
  15732. if (_$2.isFunction(fn2)) {
  15733. var newValue = fn2();
  15734. if (!_$2.isUndefined(newValue)) {
  15735. insertRow[c.dataIndex] = newValue;
  15736. }
  15737. }
  15738. }
  15739. else if (_$2.isString(fn) && fn) {
  15740. insertRow[c.dataIndex] = fn;
  15741. }
  15742. });
  15743. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15744. }
  15745. function commitMe(sender) {
  15746. var window = sender.up('window');
  15747. var scope = lookupScope(sender);
  15748. if (typeof scope['commit'] === 'function') {
  15749. scope['commit']().then(function (res) {
  15750. window.close();
  15751. });
  15752. }
  15753. }
  15754. function removeGridRow(grid1) {
  15755. var _a;
  15756. var config = grid1.config;
  15757. var rows = [];
  15758. if (grid1.selModel.selType === "rowmodel") {
  15759. rows.push(grid1.selection);
  15760. }
  15761. else {
  15762. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15763. rows.push(r);
  15764. });
  15765. }
  15766. if (rows.length > 1) {
  15767. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15768. if (_$2.isUndefined(batchRemoveConfirm)) {
  15769. //不需要提示
  15770. _$2.forEach(rows, function (r) {
  15771. grid1.getStore().remove(r);
  15772. });
  15773. }
  15774. else {
  15775. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15776. confirm(tip).then(function () {
  15777. _$2.forEach(rows, function (r) {
  15778. grid1.getStore().remove(r);
  15779. });
  15780. });
  15781. }
  15782. }
  15783. else if (rows.length === 1) {
  15784. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15785. if (_$2.isUndefined(singleRemoveConfirm)) {
  15786. //不需要提示
  15787. grid1.getStore().remove(rows[0]);
  15788. }
  15789. else {
  15790. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15791. _$2.forEach(config.columns, function (c) {
  15792. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15793. });
  15794. confirm(tip_1).then(function () {
  15795. grid1.getStore().remove(rows[0]);
  15796. });
  15797. }
  15798. }
  15799. else {
  15800. msg$1('请选择要删除的数据!');
  15801. }
  15802. }
  15803. function moveUpGridRow(grid) {
  15804. grid.rowMoveUp();
  15805. }
  15806. function moveDownGridRow(grid) {
  15807. grid.rowMoveDown();
  15808. }
  15809. var SystemEventFu = /** @class */ (function () {
  15810. function SystemEventFu() {
  15811. }
  15812. SystemEventFu.prototype.moveUpGridRow = function () {
  15813. return function (sender) {
  15814. var grid1 = sender.up('yvgrid');
  15815. moveUpGridRow(grid1);
  15816. };
  15817. };
  15818. SystemEventFu.prototype.commitMe = function () {
  15819. return function (sender) {
  15820. commitMe(sender);
  15821. };
  15822. };
  15823. SystemEventFu.prototype.moveDownGridRow = function () {
  15824. return function (sender) {
  15825. var grid1 = sender.up('yvgrid');
  15826. moveDownGridRow(grid1);
  15827. };
  15828. };
  15829. SystemEventFu.prototype.saveGridRow = function () {
  15830. return function (sender) {
  15831. var grid1 = sender.up('yvgrid');
  15832. saveGridRow(grid1);
  15833. };
  15834. };
  15835. SystemEventFu.prototype.insertGridRow = function () {
  15836. return function (sender) {
  15837. var grid1 = sender.up('yvgrid');
  15838. insertGridRow(grid1);
  15839. };
  15840. };
  15841. SystemEventFu.prototype.removeGridRow = function () {
  15842. return function (sender) {
  15843. var grid1 = sender.up('yvgrid');
  15844. removeGridRow(grid1);
  15845. };
  15846. };
  15847. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15848. return function (sender, config) {
  15849. if (!config.listeners) {
  15850. config.listeners = {};
  15851. }
  15852. config.listeners.afterrender = function (sender) {
  15853. var scope = lookupScope(sender);
  15854. // $(sender.el.dom).on('keydown', (e) => {
  15855. // const xtype = Ext.fly(e.target).component.xtype
  15856. // if (xtype === 'textfield' && e.keyCode === 13) {
  15857. // Ext.defer(() => {
  15858. // raiseClick(scope.refs[btnReferenceName])
  15859. // })
  15860. // e.preventDefault()
  15861. // e.stopPropagation()
  15862. // return false
  15863. // }
  15864. // })
  15865. $(sender.el.dom).on('keyup', function (e) {
  15866. var tt = Ext.fly(e.target).component;
  15867. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15868. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15869. ![10, 13, 20, 40].includes(e.keyCode)) {
  15870. return;
  15871. }
  15872. e.preventDefault();
  15873. e.stopPropagation();
  15874. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15875. return;
  15876. });
  15877. };
  15878. };
  15879. };
  15880. SystemEventFu.prototype.confirm = function (text, fn) {
  15881. return function (sender) {
  15882. var scope = lookupScope(sender);
  15883. var msg = calcExpress(scope.viewModel.data, text);
  15884. confirm(msg, sender).then(function () {
  15885. fn.call(scope, sender);
  15886. });
  15887. };
  15888. };
  15889. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15890. return function (sender) {
  15891. var scope = lookupScope(sender);
  15892. var grid = scope.refs[gridRefName];
  15893. if (grid) {
  15894. var records = grid.getSelectionModel().getLastSelected();
  15895. grid.store.remove(records);
  15896. }
  15897. };
  15898. };
  15899. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15900. //可以是 scope.XX / system.XX / string / lookup表达式
  15901. writeTarget) {
  15902. return function (sender) {
  15903. if (!invokeUrl) {
  15904. return;
  15905. }
  15906. var scope = lookupScope(sender);
  15907. scope.setLoading(true);
  15908. var data = scope.viewModel.data;
  15909. if (invokeParam) {
  15910. data = calcObjectFlat(data, invokeParam);
  15911. }
  15912. invokeServer$1(invokeUrl, data).then(function (res) {
  15913. if (res.success) {
  15914. if (typeof writeTarget === "string") {
  15915. _$2.forOwn(res.data, function (v, k) {
  15916. scope.viewModel.set(writeTarget + "." + k, v);
  15917. });
  15918. }
  15919. else if (typeof writeTarget === 'function') {
  15920. writeTarget.call(scope, res.data);
  15921. }
  15922. else if (typeof writeTarget === 'object') {
  15923. var ret = calcObjectFlat(res.data, writeTarget);
  15924. _$2.forOwn(ret, function (v, k) {
  15925. scope.viewModel.set(k, v);
  15926. });
  15927. }
  15928. }
  15929. else {
  15930. showErrorDialog$1(res.msg || '未知错误', sender);
  15931. }
  15932. }).catch(function (e) {
  15933. var _a, _b;
  15934. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15935. showErrorDialog$1(msg || e.toString(), sender);
  15936. }).finally(function () {
  15937. scope.setLoading(false);
  15938. });
  15939. };
  15940. };
  15941. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15942. return function (sender) {
  15943. var scope = lookupScope(sender);
  15944. scope.setLoading(true);
  15945. var data = scope.viewModel.data;
  15946. if (arg0) {
  15947. data = calcObjectFlat(data, arg0);
  15948. }
  15949. invokeServer$1(groovyUrl, data).then(function (res) {
  15950. if (res.success) {
  15951. if (res.msg) {
  15952. msg(res.msg);
  15953. }
  15954. if (typeof successCallback === 'function') {
  15955. successCallback.call(scope, sender, res.data);
  15956. }
  15957. }
  15958. else {
  15959. showErrorDialog$1(res.msg || '未知错误', sender);
  15960. }
  15961. }).catch(function (e) {
  15962. var _a, _b;
  15963. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15964. showErrorDialog$1(msg || e.toString(), sender);
  15965. }).finally(function () {
  15966. scope.setLoading(false);
  15967. });
  15968. };
  15969. };
  15970. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15971. return function (sender) {
  15972. var scope = lookupScope(sender);
  15973. var form = scope.down('form');
  15974. if (form) {
  15975. // 如果下级有表单,就做表单校验
  15976. var valid = form.isValid();
  15977. if (!valid) {
  15978. return;
  15979. }
  15980. }
  15981. scope.setLoading(true);
  15982. var data = scope.viewModel.data;
  15983. if (arg0) {
  15984. data = calcObjectFlat(data, arg0);
  15985. }
  15986. invokeServer$1(groovyUrl, data).then(function (res) {
  15987. if (res.success) {
  15988. if (res.msg) {
  15989. msg(res.msg);
  15990. }
  15991. scope.dialogSuccess(res);
  15992. }
  15993. else {
  15994. showErrorDialog$1(res.msg || '未知错误', sender);
  15995. }
  15996. }).catch(function (e) {
  15997. var _a, _b;
  15998. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15999. showErrorDialog$1(msg || e.toString(), sender);
  16000. }).finally(function () {
  16001. scope.setLoading(false);
  16002. });
  16003. };
  16004. };
  16005. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  16006. return function (sender) {
  16007. var scope = lookupScope(sender);
  16008. if (lookupObject) {
  16009. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  16010. }
  16011. else {
  16012. scope.dialogSuccess();
  16013. }
  16014. };
  16015. };
  16016. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  16017. return function (sender) {
  16018. var scope = lookupScope(sender);
  16019. clearViewModelValues(scope.viewModel, propertyName);
  16020. };
  16021. };
  16022. SystemEventFu.prototype.getGrid = function (url) {
  16023. return function (sender, config) {
  16024. if (config.xtype == "combogridmulti") {
  16025. // @ts-ignore
  16026. require([url], function (grid) {
  16027. _$2.forOwn(grid.default, function (v, k) {
  16028. sender[k] = v;
  16029. sender.config[k] = v;
  16030. if (sender.rendered) {
  16031. // 已经渲染出来了,重新调用 reload 强制刷新
  16032. sender.reload();
  16033. }
  16034. });
  16035. });
  16036. }
  16037. else {
  16038. // @ts-ignore
  16039. require([url], function (grid) {
  16040. sender.grid = grid.default;
  16041. config.grid = grid.default;
  16042. });
  16043. }
  16044. };
  16045. };
  16046. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  16047. return function (sender) {
  16048. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  16049. };
  16050. };
  16051. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  16052. return function (sender) {
  16053. var _a, _b;
  16054. var scope = lookupScope(sender);
  16055. if (!gridRefName) {
  16056. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  16057. }
  16058. else {
  16059. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  16060. }
  16061. };
  16062. };
  16063. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  16064. return function (sender) {
  16065. var scope = lookupScope(sender);
  16066. var data = scope.viewModel.data;
  16067. var param = calcObjectFlat(data, lookupForData);
  16068. // @ts-ignore
  16069. require([url], function (module) {
  16070. var ScopeClass = module.default;
  16071. var scope = new ScopeClass();
  16072. scope.success = successCallback;
  16073. scope.showDialog(sender, {}, { data: param });
  16074. });
  16075. };
  16076. };
  16077. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  16078. return function (sender, queryValue) {
  16079. showWidget(widgetUrl, lookup, sender, queryValue);
  16080. };
  16081. };
  16082. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  16083. return function (sender) {
  16084. clearViewModelByLookup(sender, lookup);
  16085. };
  16086. };
  16087. SystemEventFu.prototype.closeMe = function (callBack) {
  16088. return function (sender) {
  16089. var scope = lookupScope(sender);
  16090. scope.close();
  16091. if (callBack) {
  16092. callBack.call(sender);
  16093. }
  16094. };
  16095. };
  16096. // 未完成
  16097. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  16098. return function (sender) {
  16099. var scope = lookupScope(sender);
  16100. var data = scope.viewModel.data;
  16101. var billSetting = scope.billSetting;
  16102. var param = calcObjectFlat(data, lookupForData);
  16103. return new Promise(function (resolve, reject) {
  16104. var sf = function (scope) {
  16105. scope.success = function (dlgScope, dlgSender, reData) {
  16106. };
  16107. scope.showDialog(sender, {}, { data: param });
  16108. };
  16109. // @ts-ignore
  16110. require([url], function (module) {
  16111. // 业务描述文件
  16112. if (url.endsWith(".bill")) {
  16113. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16114. sf(scope);
  16115. });
  16116. }
  16117. else { //原生yvanui文件
  16118. var ScopeClass = module.default;
  16119. var scope_1 = new ScopeClass();
  16120. sf(scope_1);
  16121. }
  16122. });
  16123. });
  16124. };
  16125. };
  16126. __decorate([
  16127. Lib({
  16128. title: '为某个表格,上移行',
  16129. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16130. }),
  16131. __metadata("design:type", Function),
  16132. __metadata("design:paramtypes", []),
  16133. __metadata("design:returntype", void 0)
  16134. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16135. __decorate([
  16136. Lib({
  16137. title: '为某个表格,上移行',
  16138. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16139. }),
  16140. __metadata("design:type", Function),
  16141. __metadata("design:paramtypes", []),
  16142. __metadata("design:returntype", void 0)
  16143. ], SystemEventFu.prototype, "commitMe", null);
  16144. __decorate([
  16145. Lib({
  16146. title: '为某个表格,下移行',
  16147. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16148. }),
  16149. __metadata("design:type", Function),
  16150. __metadata("design:paramtypes", []),
  16151. __metadata("design:returntype", void 0)
  16152. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16153. __decorate([
  16154. Lib({
  16155. title: '为某个表格,批量保存至数据库',
  16156. author: '罗一帆',
  16157. createAt: '2022-07-19',
  16158. updateAt: '2022-07-19',
  16159. type: 'system',
  16160. category: '表格',
  16161. }),
  16162. __metadata("design:type", Function),
  16163. __metadata("design:paramtypes", []),
  16164. __metadata("design:returntype", void 0)
  16165. ], SystemEventFu.prototype, "saveGridRow", null);
  16166. __decorate([
  16167. Lib({
  16168. title: '为某个表格插入数据行',
  16169. author: '罗一帆',
  16170. createAt: '2022-07-19',
  16171. updateAt: '2022-07-19',
  16172. type: 'system',
  16173. category: '表格',
  16174. }),
  16175. __metadata("design:type", Function),
  16176. __metadata("design:paramtypes", []),
  16177. __metadata("design:returntype", void 0)
  16178. ], SystemEventFu.prototype, "insertGridRow", null);
  16179. __decorate([
  16180. Lib({
  16181. title: '为某个表格删除所选数据行',
  16182. author: '罗一帆',
  16183. createAt: '2022-07-19',
  16184. updateAt: '2022-07-19',
  16185. type: 'system',
  16186. category: '表格',
  16187. }),
  16188. __metadata("design:type", Function),
  16189. __metadata("design:paramtypes", []),
  16190. __metadata("design:returntype", void 0)
  16191. ], SystemEventFu.prototype, "removeGridRow", null);
  16192. __decorate([
  16193. Lib({
  16194. title: '按下回车键之后默认是否按下某个按钮',
  16195. author: '罗一帆',
  16196. createAt: '2021-07-02',
  16197. updateAt: '2021-07-02',
  16198. type: 'system',
  16199. category: '字典',
  16200. }),
  16201. __metadata("design:type", Function),
  16202. __metadata("design:paramtypes", [Object]),
  16203. __metadata("design:returntype", void 0)
  16204. ], SystemEventFu.prototype, "enterToClick", null);
  16205. __decorate([
  16206. Lib({
  16207. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16208. author: '罗一帆',
  16209. createAt: '2021-07-06',
  16210. updateAt: '2021-07-06',
  16211. type: 'system',
  16212. category: '对话框',
  16213. }),
  16214. __param(0, LibParam('对话框的确认文字', 'string')),
  16215. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16216. __metadata("design:type", Function),
  16217. __metadata("design:paramtypes", [Object, Object]),
  16218. __metadata("design:returntype", void 0)
  16219. ], SystemEventFu.prototype, "confirm", null);
  16220. __decorate([
  16221. Lib({
  16222. title: '删除表格当前的选中行(前端删除)',
  16223. author: '罗一帆',
  16224. createAt: '2021-07-08',
  16225. updateAt: '2021-07-08',
  16226. type: 'system',
  16227. category: '表格',
  16228. }),
  16229. __param(0, LibParam('表格引用名', 'refs')),
  16230. __metadata("design:type", Function),
  16231. __metadata("design:paramtypes", [Object]),
  16232. __metadata("design:returntype", void 0)
  16233. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16234. __decorate([
  16235. Lib({
  16236. title: '查询表单,如果 url 为空值,就取消查询',
  16237. author: '罗一帆',
  16238. createAt: '2021-07-06',
  16239. updateAt: '2021-07-06',
  16240. type: 'system',
  16241. category: '表单',
  16242. }),
  16243. __param(0, LibParam('后端服务路径', 'string')),
  16244. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16245. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16246. __metadata("design:type", Function),
  16247. __metadata("design:paramtypes", [String, Object, Object]),
  16248. __metadata("design:returntype", void 0)
  16249. ], SystemEventFu.prototype, "loadForm", null);
  16250. __decorate([
  16251. Lib({
  16252. title: '提交(不做校验、不关闭窗体)',
  16253. author: '罗一帆',
  16254. createAt: '2021-07-02',
  16255. updateAt: '2021-07-02',
  16256. type: 'system',
  16257. category: '表单',
  16258. }),
  16259. __param(0, LibParam('后端服务路径', 'string')),
  16260. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16261. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16262. __metadata("design:type", Function),
  16263. __metadata("design:paramtypes", [String, Object, Object]),
  16264. __metadata("design:returntype", void 0)
  16265. ], SystemEventFu.prototype, "commit", null);
  16266. __decorate([
  16267. Lib({
  16268. title: '提交表单',
  16269. author: '罗一帆',
  16270. createAt: '2021-07-02',
  16271. updateAt: '2021-07-02',
  16272. type: 'system',
  16273. category: '表单',
  16274. }),
  16275. __param(0, LibParam('后端服务路径', 'string')),
  16276. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16277. __metadata("design:type", Function),
  16278. __metadata("design:paramtypes", [String, Object]),
  16279. __metadata("design:returntype", void 0)
  16280. ], SystemEventFu.prototype, "formCommit", null);
  16281. __decorate([
  16282. Lib({
  16283. title: '对话框成功回调',
  16284. author: '罗一帆',
  16285. createAt: '2021-07-02',
  16286. updateAt: '2021-07-02',
  16287. type: 'system',
  16288. category: '对话框',
  16289. }),
  16290. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16291. __metadata("design:type", Function),
  16292. __metadata("design:paramtypes", [Object]),
  16293. __metadata("design:returntype", void 0)
  16294. ], SystemEventFu.prototype, "dialogSuccess", null);
  16295. __decorate([
  16296. Lib({
  16297. title: '清空 viewModel 某个属性',
  16298. author: '罗一帆',
  16299. createAt: '2021-07-02',
  16300. updateAt: '2021-07-02',
  16301. type: 'system',
  16302. category: '表单',
  16303. }),
  16304. __param(0, LibParam('属性路径', 'viewModel', true)),
  16305. __metadata("design:type", Function),
  16306. __metadata("design:paramtypes", [String]),
  16307. __metadata("design:returntype", void 0)
  16308. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16309. __decorate([
  16310. Lib({
  16311. title: '从其他资源获取表格设置',
  16312. author: '罗一帆',
  16313. createAt: '2021-07-02',
  16314. updateAt: '2021-07-02',
  16315. type: 'system',
  16316. category: '表单',
  16317. }),
  16318. __param(0, LibParam('定义文件', 'module')),
  16319. __metadata("design:type", Function),
  16320. __metadata("design:paramtypes", [Object]),
  16321. __metadata("design:returntype", void 0)
  16322. ], SystemEventFu.prototype, "getGrid", null);
  16323. __decorate([
  16324. Lib({
  16325. title: '清空 viewModel 某个属性,并刷新表格',
  16326. author: '罗一帆',
  16327. createAt: '2021-07-02',
  16328. updateAt: '2021-07-02',
  16329. type: 'system',
  16330. category: '表单',
  16331. }),
  16332. __param(0, LibParam('清空的属性', 'viewModel')),
  16333. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16334. __metadata("design:type", Function),
  16335. __metadata("design:paramtypes", [String, String]),
  16336. __metadata("design:returntype", void 0)
  16337. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16338. __decorate([
  16339. Lib({
  16340. title: '刷新表格',
  16341. author: '罗一帆',
  16342. createAt: '2021-07-02',
  16343. updateAt: '2021-07-02',
  16344. type: 'system',
  16345. category: '表单',
  16346. }),
  16347. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16348. __metadata("design:type", Function),
  16349. __metadata("design:paramtypes", [String]),
  16350. __metadata("design:returntype", void 0)
  16351. ], SystemEventFu.prototype, "reloadGrid", 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('业务模块名', 'module')),
  16362. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16363. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16364. __metadata("design:type", Function),
  16365. __metadata("design:paramtypes", [String, Object, Object]),
  16366. __metadata("design:returntype", void 0)
  16367. ], SystemEventFu.prototype, "showDialog", null);
  16368. __decorate([
  16369. Lib({
  16370. title: '弹出查找框(不借助 search)',
  16371. author: '罗一帆',
  16372. createAt: '2021-07-02',
  16373. updateAt: '2021-07-02',
  16374. type: 'system',
  16375. category: '对话框',
  16376. }),
  16377. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16378. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16379. __metadata("design:type", Function),
  16380. __metadata("design:paramtypes", [Object, Object]),
  16381. __metadata("design:returntype", void 0)
  16382. ], SystemEventFu.prototype, "showWidget", null);
  16383. __decorate([
  16384. Lib({
  16385. title: '根据 lookup 清空 viewModel',
  16386. author: '罗一帆',
  16387. createAt: '2021-07-05',
  16388. updateAt: '2021-07-05',
  16389. type: 'system',
  16390. category: '表单',
  16391. }),
  16392. __param(0, LibParam('设值表达式', 'lookup')),
  16393. __metadata("design:type", Function),
  16394. __metadata("design:paramtypes", [Object]),
  16395. __metadata("design:returntype", void 0)
  16396. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16397. __decorate([
  16398. Lib({
  16399. title: '关闭对话框',
  16400. author: '罗一帆',
  16401. createAt: '2021-07-05',
  16402. updateAt: '2021-07-05',
  16403. type: 'system',
  16404. category: '对话框',
  16405. }),
  16406. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16407. __metadata("design:type", Function),
  16408. __metadata("design:paramtypes", [Object]),
  16409. __metadata("design:returntype", void 0)
  16410. ], SystemEventFu.prototype, "closeMe", null);
  16411. __decorate([
  16412. Lib({
  16413. title: '打开对话框并返回数据',
  16414. author: '余亮',
  16415. createAt: '2022-07-07',
  16416. updateAt: '2022-07-07',
  16417. type: 'system',
  16418. category: '对话框',
  16419. }),
  16420. __param(0, LibParam('业务模块名', 'module')),
  16421. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16422. __param(2, LibParam('结果映射关系', 'string', true)),
  16423. __metadata("design:type", Function),
  16424. __metadata("design:paramtypes", [String, Object, Object]),
  16425. __metadata("design:returntype", void 0)
  16426. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16427. return SystemEventFu;
  16428. }());
  16429. /**
  16430. * 清空 viewmodel 里下属的所有属性
  16431. * @param viewModel VM对象
  16432. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16433. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16434. */
  16435. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16436. var data = viewModel.data;
  16437. if (propertyKey) {
  16438. data = _$2.get(data, propertyKey);
  16439. }
  16440. _$2.forOwn(data, function (value, key) {
  16441. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16442. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16443. return;
  16444. }
  16445. viewModel.set(targetKey, '');
  16446. });
  16447. }
  16448. function clearViewModelByLookup(sender, lookup) {
  16449. if (_$2.isPlainObject(lookup)) {
  16450. var parentScope_1 = lookupScope(sender);
  16451. _$2.forOwn(lookup, function (value, key) {
  16452. if (SIMPLE_RE.test(value)) {
  16453. // '{foo}' 简单表达式
  16454. var path = value.substring(1, value.length - 1);
  16455. if (path !== 'queryValue') {
  16456. parentScope_1.viewModel.set(path, '');
  16457. }
  16458. }
  16459. });
  16460. }
  16461. }
  16462. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16463. if (vjson === void 0) { vjson = {}; }
  16464. var parentScope = lookupScope(sender);
  16465. var me = sender;
  16466. // @ts-ignore
  16467. require([widgetUrl], function (widgetScope) {
  16468. var WidgetScopeClass = widgetScope.default;
  16469. widgetScope = new WidgetScopeClass();
  16470. // 传递进 widget.model 的数据
  16471. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16472. widgetScope.parentScope = parentScope;
  16473. widgetScope.searchWidgetSuccess = function (data) {
  16474. if (typeof lookup === 'string') {
  16475. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16476. me.setValue(data[lookup]);
  16477. return;
  16478. }
  16479. /**
  16480. * lookup: {
  16481. * // 扩展到 viewModel 的值做更改
  16482. * WH_CODE: "{queryValue}",
  16483. * WH_NAME: "{query.WH_NAME}",
  16484. * }
  16485. */
  16486. if (_$2.isPlainObject(lookup)) {
  16487. var parentScope_2 = lookupScope(sender);
  16488. tryWriteObject(lookup, data, function (path, value) {
  16489. if (path === 'queryValue') {
  16490. me.setValue(value);
  16491. }
  16492. else {
  16493. parentScope_2.viewModel.set(path, value);
  16494. }
  16495. });
  16496. }
  16497. return true;
  16498. };
  16499. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16500. });
  16501. }
  16502. /**
  16503. * 停止事件的默认行为
  16504. * @param e
  16505. */
  16506. function stopEvent(e) {
  16507. e.preventDefault();
  16508. e.stopPropagation();
  16509. // @ts-ignore
  16510. window.event.cancelBubble = true;
  16511. e.returnValue = false;
  16512. e.cancelBubble = true;
  16513. }
  16514. /**
  16515. * 屏幕中央显示一个黑框提示
  16516. */
  16517. function msg$1(content) {
  16518. msg(content);
  16519. }
  16520. /**
  16521. * 错误对话框的强提醒
  16522. */
  16523. function showErrorDialog$1(msg, sender) {
  16524. showErrorDialog(msg, sender);
  16525. }
  16526. /**
  16527. * 错误对话框的强提醒
  16528. */
  16529. function showInfoDialog(msg, sender) {
  16530. showInfoDialogSimple(msg, sender);
  16531. }
  16532. /**
  16533. * 错误对话框的强提醒
  16534. */
  16535. function prompt$2(message, defaultValue, multiLine) {
  16536. if (defaultValue === void 0) { defaultValue = ""; }
  16537. if (multiLine === void 0) { multiLine = false; }
  16538. return prompt$1(message, defaultValue, multiLine);
  16539. }
  16540. /**
  16541. * 用于计算 express 表达式
  16542. */
  16543. function evalFunction(data, express) {
  16544. var keys = [];
  16545. var values = [];
  16546. _$2.forOwn(data, function (value, key) {
  16547. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16548. if (match) {
  16549. key = key.substring(0, match.index);
  16550. }
  16551. keys.push(key);
  16552. values.push(value);
  16553. });
  16554. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16555. try {
  16556. return func.apply(void 0, __spread(values));
  16557. }
  16558. catch (e) {
  16559. return;
  16560. }
  16561. }
  16562. /**
  16563. * 获取表格编辑的行数据
  16564. */
  16565. function getGridEditRows(grid) {
  16566. return grid.getGridEditRows();
  16567. }
  16568. //# sourceMappingURL=systemLib.js.map
  16569. var SystemLib = /*#__PURE__*/Object.freeze({
  16570. __proto__: null,
  16571. SIMPLE_RE: SIMPLE_RE,
  16572. pinyinMatch: pinyinMatch,
  16573. calcExpress: calcExpress,
  16574. calcObjectFlat: calcObjectFlat,
  16575. mergeViewModel: mergeViewModel,
  16576. flatRow: flatRow,
  16577. replaceNA: replaceNA,
  16578. deepTravJson: deepTravJson,
  16579. tryWriteByExpress: tryWriteByExpress,
  16580. tryWriteObject: tryWriteObject,
  16581. tryVarSimple: tryVarSimple,
  16582. calcObject: calcObject,
  16583. getParentGrid: getParentGrid,
  16584. tryEnable: tryEnable,
  16585. setComboStore: setComboStore,
  16586. invokeServer: invokeServer$1,
  16587. clearViewModelValues: clearViewModelValues,
  16588. reloadGrid: reloadGrid,
  16589. toPlainObject: toPlainObject,
  16590. confirm: confirm,
  16591. normId: normId,
  16592. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16593. saveGridRow: saveGridRow,
  16594. insertGridRow: insertGridRow,
  16595. commitMe: commitMe,
  16596. removeGridRow: removeGridRow,
  16597. moveUpGridRow: moveUpGridRow,
  16598. moveDownGridRow: moveDownGridRow,
  16599. SystemEventFu: SystemEventFu,
  16600. clearViewModel: clearViewModel,
  16601. clearViewModelByLookup: clearViewModelByLookup,
  16602. showWidget: showWidget,
  16603. stopEvent: stopEvent,
  16604. msg: msg$1,
  16605. showErrorDialog: showErrorDialog$1,
  16606. showInfoDialog: showInfoDialog,
  16607. prompt: prompt$2,
  16608. evalFunction: evalFunction,
  16609. getGridEditRows: getGridEditRows
  16610. });
  16611. function initTree () {
  16612. Ext.define('Yvan.Tree', {
  16613. extend: 'Ext.tree.Panel',
  16614. alias: 'widget.yvtree',
  16615. xtype: 'yvtree',
  16616. constructor: function (config) {
  16617. var newConfig = _$2.defaultsDeep({
  16618. // 强制性属性
  16619. }, baseConfig(config, 'row-item'), config, tree);
  16620. _$2.assign(newConfig, {
  16621. tbar: [
  16622. {
  16623. xtype: 'textfield',
  16624. // triggerCls: 'x-form-clear-trigger',
  16625. flex: 1,
  16626. emptyText: '搜索过滤',
  16627. enableKeyEvents: true,
  16628. listeners: {
  16629. change: function (sender) {
  16630. var tree = sender.up("treepanel");
  16631. tree.filterByText(this.getRawValue());
  16632. },
  16633. keyup: function (sender, e) {
  16634. var tree = sender.up("treepanel");
  16635. if (e.ESC === e.getKey()) {
  16636. sender.setValue('');
  16637. tree.filterByText('');
  16638. }
  16639. }
  16640. }
  16641. },
  16642. ],
  16643. });
  16644. if (!newConfig.hideRefresh) {
  16645. newConfig.tbar.push({
  16646. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16647. listeners: {
  16648. click: function (sender) {
  16649. var scope = sender.up("yvtree");
  16650. scope.reload();
  16651. }
  16652. }
  16653. });
  16654. }
  16655. if (!newConfig.hideExpand) {
  16656. newConfig.tbar.push({
  16657. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16658. listeners: {
  16659. click: function (sender) {
  16660. var scope = sender.up("yvtree");
  16661. scope.expandAll();
  16662. }
  16663. }
  16664. });
  16665. }
  16666. if (!newConfig.hideCollapse) {
  16667. newConfig.tbar.push({
  16668. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16669. listeners: {
  16670. click: function (sender) {
  16671. var scope = sender.up("yvtree");
  16672. scope.collapseAll();
  16673. }
  16674. }
  16675. });
  16676. }
  16677. this.superclass.constructor.call(this, newConfig);
  16678. },
  16679. /**
  16680. * 在根节点上增加一个节点,会触发 addNode 事件
  16681. * @param props
  16682. */
  16683. addRoot: function (props) {
  16684. var me = this;
  16685. var tableNode = me.getRootNode();
  16686. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16687. if (_$2.isFunction(props)) {
  16688. props = props.call(this, parent);
  16689. }
  16690. _$2.forOwn(props, function (value, key) {
  16691. fieldNode.set(key, value);
  16692. });
  16693. var node = tableNode.appendChild(fieldNode);
  16694. me.ensureVisible(node);
  16695. me.setSelection(node);
  16696. me.fireEvent('addNode', me, {
  16697. parent: tableNode,
  16698. node: node,
  16699. });
  16700. },
  16701. addLast: function (props) {
  16702. var me = this;
  16703. var sel = me.selModel.getSelection();
  16704. if (!sel || sel.length <= 0) {
  16705. msg('请选择一个要添加的同级节点路径');
  16706. return;
  16707. }
  16708. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16709. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16710. if (_$2.isFunction(props)) {
  16711. props = props.call(this, parent);
  16712. }
  16713. _$2.forOwn(props, function (value, key) {
  16714. fieldNode.set(key, value);
  16715. });
  16716. var node = parent.appendChild(fieldNode);
  16717. me.ensureVisible(node);
  16718. me.setSelection(node);
  16719. me.fireEvent('addNode', me, {
  16720. parent: parent,
  16721. node: node,
  16722. });
  16723. },
  16724. addChildren: function (props) {
  16725. var me = this;
  16726. var sel = me.selModel.getSelection();
  16727. if (!sel || sel.length <= 0) {
  16728. msg('请选择一个要添加子节点的路径');
  16729. return;
  16730. }
  16731. var parent = sel[0];
  16732. if (_$2.isFunction(props)) {
  16733. props = props.call(this, parent);
  16734. }
  16735. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16736. _$2.forOwn(props, function (value, key) {
  16737. fieldNode.set(key, value);
  16738. });
  16739. var node = parent.appendChild(fieldNode);
  16740. parent.expand();
  16741. me.ensureVisible(node);
  16742. me.setSelection(node);
  16743. me.fireEvent('addNode', me, {
  16744. parent: parent,
  16745. node: node,
  16746. });
  16747. },
  16748. initComponent: function () {
  16749. var me = this;
  16750. var config = me.config;
  16751. var scope = lookupScope(this);
  16752. if (!isDesignMode(scope, config)) {
  16753. // 转换 dataSource 属性
  16754. convertDataSource(me, scope, config);
  16755. }
  16756. this.superclass.initComponent.call(this);
  16757. this.on({
  16758. afterrender: function (sender) {
  16759. var me = this;
  16760. var config = this.config;
  16761. var dataSource = config.dataSource;
  16762. if (config.autoLoad) {
  16763. if (config.dataSourceCallbackFn) {
  16764. me.reload();
  16765. }
  16766. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16767. me.reload();
  16768. }
  16769. }
  16770. }
  16771. });
  16772. },
  16773. _setDataReal: function (value) {
  16774. var me = this;
  16775. // me.setStore(new Ext.data.TreeStore({
  16776. // root: {
  16777. // expanded: true,
  16778. // // children: value
  16779. // children: [
  16780. // {
  16781. // id: '1', text: 'A',
  16782. // children: [
  16783. // {id: '1', text: 'A',},
  16784. // {id: '2', text: 'B'},
  16785. // ]
  16786. // },
  16787. // {id: '2', text: 'B'},
  16788. // ]
  16789. // }
  16790. // }))
  16791. me.store.setRoot({
  16792. expanded: true,
  16793. children: value
  16794. });
  16795. // me.store = new Ext.data.TreeStore({
  16796. // root: {
  16797. // expanded: true,
  16798. // // children: value
  16799. // children: [
  16800. // {
  16801. // id: '1', text: 'A',
  16802. // children: [
  16803. // {id: '1', text: 'A',},
  16804. // {id: '2', text: 'B'},
  16805. // ]
  16806. // },
  16807. // {id: '2', text: 'B'},
  16808. // ]
  16809. // }
  16810. // })
  16811. },
  16812. /**
  16813. * 重新载入数据(重新计算参数)
  16814. */
  16815. reload: function (reloadParams) {
  16816. if (reloadParams === void 0) { reloadParams = {}; }
  16817. var me = this;
  16818. var config = me.config;
  16819. if (config.dataSourceCallbackFn) {
  16820. // 函数请求刷新
  16821. var scope_1 = lookupScope(this);
  16822. // me.setLoading(true)
  16823. config.dataSourceCallbackFn.call(scope_1, me, {
  16824. successCallback: function (value) {
  16825. me._setDataReal(value);
  16826. // me.setLoading(false)
  16827. me.fireEvent('dataLoadComplete', me, true, value);
  16828. },
  16829. failCallback: function (error) {
  16830. // me.setLoading(false)
  16831. me.fireEvent('dataLoadComplete', me, false, error);
  16832. }
  16833. });
  16834. return;
  16835. }
  16836. var scope = lookupScope(me);
  16837. var dataSource = config.dataSource;
  16838. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16839. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16840. me.setLoading(true);
  16841. invokeServer$1(dataSource.url, params)
  16842. .then(function (res) {
  16843. me._setDataReal(res.data);
  16844. me.fireEvent('dataLoadComplete', me, res);
  16845. })
  16846. .finally(function () {
  16847. me.setLoading(false);
  16848. });
  16849. }
  16850. },
  16851. filterByText: function (text) {
  16852. this._filterText = text;
  16853. this._filterBy(this, text, 'text');
  16854. },
  16855. _filterBy: _$2.debounce(function (me, text, by) {
  16856. var view = me.getView();
  16857. me.store.clearFilter();
  16858. if (!me._filterText) {
  16859. // 没有筛选内容,还原状态
  16860. var selections = me.getSelection();
  16861. var selectionPaths_1 = [];
  16862. _$2.forEach(me.getSelection(), function (item) {
  16863. selectionPaths_1.push(item.getPath());
  16864. });
  16865. me.collapseAll();
  16866. _$2.forEach(selectionPaths_1, function (path) {
  16867. me.expandPath(path);
  16868. });
  16869. me.setSelection(selections);
  16870. return;
  16871. }
  16872. // 递归查找所有需要可见的节点 id 数组
  16873. var nodesAndParents = [];
  16874. var expandPaths = [];
  16875. me.getRootNode().cascadeBy(function (tree, view) {
  16876. var currNode = this;
  16877. currNode.collapse();
  16878. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16879. // 展开到匹配的路径
  16880. // me.expandPath(currNode.getPath());
  16881. expandPaths.push(currNode.getPath());
  16882. // 沿途父节点全部设定为可见
  16883. while (currNode.parentNode) {
  16884. nodesAndParents.push(currNode.id);
  16885. currNode = currNode.parentNode;
  16886. }
  16887. }
  16888. }, null, [me, view]);
  16889. me.store.filterBy(function (r) {
  16890. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16891. });
  16892. _$2.forEach(expandPaths, function (path) {
  16893. me.expandPath(path);
  16894. });
  16895. }, 1000),
  16896. });
  16897. }
  16898. function convertDataSource(sender, scope, newConfig) {
  16899. if (typeof newConfig.store !== 'undefined') {
  16900. // 有 store 属性的情况下,不做任何事
  16901. return;
  16902. }
  16903. if (typeof newConfig.dataSource === 'undefined') {
  16904. // 没有定义 dataSource 的情况下,不做任何事
  16905. return;
  16906. }
  16907. var dataSource = newConfig.dataSource;
  16908. if (typeof dataSource === 'string') {
  16909. // dataSource 是字符串的情况下,找到成员函数
  16910. dataSource = lookupFn(scope, dataSource);
  16911. }
  16912. if (typeof dataSource === 'function') {
  16913. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16914. newConfig.store = new Ext.data.TreeStore({
  16915. root: {
  16916. expanded: true,
  16917. children: []
  16918. }
  16919. });
  16920. newConfig.dataSourceCallbackFn = dataSource;
  16921. return;
  16922. }
  16923. // throw new TypeError('无法识别的调用方法')
  16924. }
  16925. //# sourceMappingURL=yvtree.js.map
  16926. /**
  16927. * 构建一个 grid 支持的 dataSource
  16928. */
  16929. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16930. if (reloadParams === void 0) { reloadParams = {}; }
  16931. if (isExcelExport === void 0) { isExcelExport = false; }
  16932. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16933. var _a;
  16934. var me = grid;
  16935. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16936. var storeOption = {};
  16937. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16938. if (dataSource.sqlId) {
  16939. dataSource.method = 'invoke';
  16940. dataSource.url = '/Dev@executeSQL';
  16941. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16942. // sqlId 是 @ 开头,代表直接带中文名
  16943. var scope_1 = lookupScope(grid);
  16944. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16945. params.sqlId = dataSource.sqlId.substring(1);
  16946. }
  16947. else {
  16948. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16949. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16950. params.path = path;
  16951. params.sqlId = sqlId;
  16952. }
  16953. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16954. }
  16955. var fields_1 = [];
  16956. _$2.forEach(grid.columns, function (col) {
  16957. var c = {};
  16958. if (col.dataIndex) {
  16959. c.name = col.dataIndex;
  16960. fields_1.push(c);
  16961. }
  16962. if (col.dataType) {
  16963. c.type = col.dataType;
  16964. }
  16965. });
  16966. // 默认支持 gridInvoke
  16967. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16968. //@ts-ignore
  16969. storeOption = {
  16970. fields: fields_1,
  16971. remoteSort: config.remoteSort,
  16972. remoteFilter: config.remoteFilter,
  16973. autoLoad: true,
  16974. pageSize: me.store.pageSize || config.pageSize,
  16975. proxy: {
  16976. type: 'jsonAjax',
  16977. $owner: me,
  16978. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16979. extraParams: extraParams,
  16980. reader: {
  16981. type: 'json',
  16982. rootProperty: 'data',
  16983. totalProperty: 'pagination.total',
  16984. successProperty: 'success',
  16985. messageProperty: 'msg',
  16986. transform: function (data) {
  16987. if (typeof window['ajaxProcess'] === 'function') {
  16988. window['ajaxProcess'](data);
  16989. }
  16990. if (typeof window['apiTranslate'] === 'function') {
  16991. window['apiTranslate'](data, dataSource.url);
  16992. }
  16993. if (typeof grid._transform === 'function') {
  16994. // 系统转换函数
  16995. grid._transform(data.data);
  16996. }
  16997. if (grid.dataTransform) {
  16998. if (typeof grid.dataTransform === 'string') {
  16999. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  17000. }
  17001. return grid.dataTransform.call(scope, grid, data);
  17002. }
  17003. return data;
  17004. }
  17005. }
  17006. },
  17007. listeners: {
  17008. load: function (store, records, successful, operation) {
  17009. var _a, _b, _c;
  17010. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  17011. if (rep.pagination) {
  17012. grid.dbInfo = rep.pagination.dbInfo;
  17013. grid.exportDataSql = rep.pagination.exportDataSql;
  17014. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  17015. }
  17016. 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;
  17017. if (isExcelExport) {
  17018. if (typeof excelExportCallBack === 'function') {
  17019. excelExportCallBack(rep);
  17020. }
  17021. else if (excelExportCallBack) {
  17022. console.error("导出回调方法错误!");
  17023. }
  17024. me.fireEvent('excelDataLoadComplete', me, successful, records);
  17025. }
  17026. else {
  17027. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  17028. // 自动选中第一行
  17029. var data = grid.getStore().data;
  17030. if (data.length > 0) {
  17031. grid.setSelection(data.items[0]);
  17032. }
  17033. }
  17034. me.fireEvent('dataLoadComplete', me, successful, records);
  17035. }
  17036. }
  17037. }
  17038. };
  17039. }
  17040. else if (exports.apiConvert) {
  17041. // 外部扩展的 apiConvert
  17042. //@ts-ignore
  17043. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams);
  17044. }
  17045. else {
  17046. throw new TypeError("不支持的 API 请求方式");
  17047. }
  17048. if (isExcelExport) {
  17049. var excelStore = new Ext.data.Store(storeOption);
  17050. excelStore.load();
  17051. }
  17052. else {
  17053. if (me.groupField) {
  17054. console.log('groupField', storeOption.groupField);
  17055. storeOption.groupField = me.groupField;
  17056. }
  17057. me.setStore(new Ext.data.Store(storeOption));
  17058. }
  17059. }
  17060. function initStores () {
  17061. Ext.define('Yvan.JsonAjaxProxy', {
  17062. extend: 'Ext.data.proxy.Ajax',
  17063. alias: 'proxy.jsonAjax',
  17064. actionMethods: {
  17065. create: "POST",
  17066. read: "POST",
  17067. update: "POST",
  17068. destroy: "POST"
  17069. },
  17070. timeout: storeAjax.timeout,
  17071. buildRequest: function (operation) {
  17072. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  17073. var me = this;
  17074. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  17075. var scope = lookupScope($owner);
  17076. var gridParam = me.getParams(operation);
  17077. var customParam = {};
  17078. // 提取 srot 元素
  17079. if (gridParam.sort) {
  17080. var sort = JSON.parse(gridParam.sort);
  17081. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  17082. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  17083. customParam.sortModel = [];
  17084. _$2.forEach(sort, function (s) {
  17085. customParam.sortModel.push({
  17086. colId: s.property,
  17087. sort: _$2.toLower(s.direction)
  17088. });
  17089. });
  17090. delete gridParam.sort;
  17091. }
  17092. // 提取筛选元素
  17093. if (gridParam.filter) {
  17094. var filter = JSON.parse(gridParam.filter);
  17095. console.log('gridParam.filter', gridParam.filter);
  17096. // "[{"operator":"like","value":"1","property":"id"}]"
  17097. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  17098. customParam.filterModel = {};
  17099. _$2.forEach(filter, function (s) {
  17100. var newFilterItem = {};
  17101. if (s.operator === 'like') {
  17102. newFilterItem.filterType = 'text';
  17103. newFilterItem.type = 'contains';
  17104. newFilterItem.filter = s.value;
  17105. }
  17106. else {
  17107. // 无法识别的筛选类型
  17108. newFilterItem.filterType = 'dict';
  17109. newFilterItem.type = 'in';
  17110. newFilterItem.filter = s.value;
  17111. }
  17112. customParam.filterModel[s.property] = newFilterItem;
  17113. });
  17114. delete gridParam.filter;
  17115. }
  17116. // 被 grid.constructor 作为方法存在
  17117. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17118. var params = _$2.defaultsDeep(gridParam, extraParams);
  17119. // var request = this.superclass.buildRequest.apply(this, arguments);
  17120. var request = new Ext.data.Request({
  17121. params: {},
  17122. action: operation.getAction(),
  17123. records: operation.getRecords(),
  17124. url: me.buildUrl(),
  17125. jsonData: __assign({ args: [
  17126. params
  17127. ] }, customParam),
  17128. proxy: me
  17129. });
  17130. operation.setRequest(request);
  17131. return request;
  17132. },
  17133. afterRequest: function (req, res) {
  17134. // Extend.afterExtRequest(req, res)
  17135. }
  17136. });
  17137. Ext.define('Ext.ux.data.MyReader', {
  17138. extend: 'Ext.data.reader.Json',
  17139. xtype: 'yvgridreader',
  17140. useSimpleAccessors: false,
  17141. });
  17142. }
  17143. //# sourceMappingURL=stores.js.map
  17144. function initBehaviorEdit(config) {
  17145. var _a, _b, _c;
  17146. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17147. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17148. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17149. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17150. if (dbTableName) {
  17151. // 生成增删查改
  17152. var tbar = [
  17153. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17154. click: 'system.saveGridRow()'
  17155. }, bind: {
  17156. disabled: '{!' + config.reference + '.ischanged}'
  17157. } }, saveButtonConfig),
  17158. '-',
  17159. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17160. click: 'system.insertGridRow()'
  17161. } }, addButtonConfig),
  17162. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17163. click: 'system.removeGridRow()'
  17164. } }, deleteButtonConfig),
  17165. ];
  17166. if (_$2.isArray(config.tbar)) {
  17167. config.tbar = __spread(tbar, [
  17168. '-'
  17169. ], config.tbar);
  17170. }
  17171. else if (_$2.isPlainObject(config.tbar)) {
  17172. config.tbar = {
  17173. border: false,
  17174. layout: {
  17175. type: 'vbox',
  17176. align: 'stretch'
  17177. },
  17178. items: [
  17179. {
  17180. xtype: 'toolbar',
  17181. border: false,
  17182. items: tbar
  17183. },
  17184. config.tbar,
  17185. ]
  17186. };
  17187. }
  17188. else if (_$2.isUndefined(config.tbar)) {
  17189. config.tbar = tbar;
  17190. }
  17191. else {
  17192. console.error("can't build tbar property!", config.tbar);
  17193. }
  17194. }
  17195. }
  17196. //# sourceMappingURL=grid_behavior.js.map
  17197. function initGridDialog(config) {
  17198. var detailDialog = _$2.get(config, 'detailDialog');
  17199. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17200. if (_$2.isPlainObject(detailDialog)) {
  17201. var tbar = [
  17202. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17203. click: 'system.showGridRowDetail()',
  17204. }, bind: {
  17205. disabled: '{!' + config.reference + '.selection}'
  17206. } }, detailButtonConfig)
  17207. ];
  17208. if (_$2.isArray(config.tbar)) {
  17209. config.tbar = __spread(config.tbar, [
  17210. '-'
  17211. ], tbar);
  17212. }
  17213. else if (_$2.isPlainObject(config.tbar)) {
  17214. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17215. config.tbar.items = __spread(config.tbar.items);
  17216. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17217. if (!toolbar) {
  17218. config.tbar.items = __spread(config.tbar.items, [
  17219. {
  17220. xtype: 'toolbar',
  17221. border: false,
  17222. items: tbar
  17223. },
  17224. ]);
  17225. }
  17226. else {
  17227. toolbar.items = __spread(toolbar.items, [
  17228. '-'
  17229. ], tbar);
  17230. }
  17231. }
  17232. else {
  17233. config.tbar = {
  17234. border: false,
  17235. layout: {
  17236. type: 'vbox',
  17237. align: 'stretch'
  17238. },
  17239. items: [
  17240. {
  17241. xtype: 'toolbar',
  17242. border: false,
  17243. items: tbar
  17244. },
  17245. config.tbar,
  17246. ]
  17247. };
  17248. }
  17249. }
  17250. else if (_$2.isUndefined(config.tbar)) {
  17251. config.tbar = tbar;
  17252. }
  17253. else {
  17254. console.error("can't build tbar property!", config.tbar);
  17255. }
  17256. }
  17257. }
  17258. var SystemEventFu$1 = /** @class */ (function () {
  17259. function SystemEventFu() {
  17260. }
  17261. SystemEventFu.prototype.showGridRowDetail = function () {
  17262. return function (sender) {
  17263. var grid1 = sender.up('yvgrid');
  17264. showGridRowDetail(grid1);
  17265. };
  17266. };
  17267. __decorate([
  17268. Lib({
  17269. title: '为某个表格所选数据行, 显示其对话框',
  17270. author: '罗一帆',
  17271. createAt: '2022-07-27',
  17272. updateAt: '2022-07-27',
  17273. type: 'system',
  17274. category: '表格',
  17275. }),
  17276. __metadata("design:type", Function),
  17277. __metadata("design:paramtypes", []),
  17278. __metadata("design:returntype", void 0)
  17279. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17280. return SystemEventFu;
  17281. }());
  17282. function showGridRowDetail(grid1, isEdit) {
  17283. if (isEdit === void 0) { isEdit = true; }
  17284. var _a, _b, _c;
  17285. if (!grid1.selection) {
  17286. msg$1('请选中要展示的数据行!');
  17287. return;
  17288. }
  17289. var record = grid1.selection;
  17290. if (_$2.isArray(record)) {
  17291. record = record[0];
  17292. }
  17293. if (!record) {
  17294. msg$1('请选中要展示的数据行!');
  17295. return;
  17296. }
  17297. var config = grid1._originVJson;
  17298. var detailDialog = config.detailDialog;
  17299. var vjson = {};
  17300. var parentScope = lookupScope(grid1);
  17301. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17302. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17303. _$2.defaultsDeep(vjson, {
  17304. // 强制属性
  17305. layout: 'fit',
  17306. __custom_path: __custom_path,
  17307. __custom_version: __custom_version,
  17308. fbar: __spread([
  17309. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17310. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17311. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17312. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17313. }, detailDialog, {
  17314. // 默认属性
  17315. width: 800,
  17316. height: 450,
  17317. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17318. });
  17319. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17320. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17321. vjson.items.push(tabpanel);
  17322. if (tabpanel) {
  17323. // 有多个选项卡,按每个选项卡进行过滤
  17324. _$2.forEach(tabpanel.items, function (tab) {
  17325. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17326. if (tabColumns.length > 0) {
  17327. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17328. _$2.extend(tab, tabVjson);
  17329. }
  17330. });
  17331. }
  17332. }
  17333. else {
  17334. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17335. }
  17336. var model = {
  17337. data: {
  17338. _edit: isEdit,
  17339. _editType: isEdit ? '编辑' : '添加',
  17340. }
  17341. };
  17342. _$2.forOwn(record.data, function (value, key) {
  17343. if (key === 'id') {
  17344. // 忽略 ID 属性
  17345. return;
  17346. }
  17347. if (_$2.startsWith(key, '_')) {
  17348. // 忽略 _ 开头的所有属性
  17349. return;
  17350. }
  17351. model.data[key] = value;
  17352. });
  17353. console.log(vjson);
  17354. var scope = new Scope({ vjson: vjson, model: model, });
  17355. //@ts-ignore
  17356. scope.commit = function () {
  17357. return new Promise(function (resolve) {
  17358. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17359. if (_$2.startsWith(key, '_')) {
  17360. // _origin 等属性可以被忽略
  17361. return;
  17362. }
  17363. if (key === 'id') {
  17364. // id 属性被忽略
  17365. return;
  17366. }
  17367. record.set(key, value);
  17368. });
  17369. resolve();
  17370. });
  17371. };
  17372. scope.showDialog(grid1, {}, {});
  17373. }
  17374. function buildForm(columns, tabpanel, detailDialog) {
  17375. var vjson = __assign({ border: false, layout: {
  17376. type: 'vbox',
  17377. pack: 'start',
  17378. align: 'stretch'
  17379. }, defaults: {
  17380. border: false,
  17381. anchor: '100%',
  17382. margin: '5',
  17383. }, scrollable: true, items: [] }, detailDialog.form);
  17384. var emptyFieldset = [];
  17385. var fieldsetList = [];
  17386. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17387. _$2.forEach(columns, function (c) {
  17388. var fieldset = _$2.get(c, 'form.fieldset');
  17389. if (fieldset) {
  17390. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17391. if (idx < 0) {
  17392. fieldsetList.push({
  17393. fieldset: fieldset,
  17394. columns: [c]
  17395. });
  17396. }
  17397. else {
  17398. fieldsetList[idx].columns.push(c);
  17399. }
  17400. }
  17401. else {
  17402. emptyFieldset.push(c);
  17403. }
  17404. });
  17405. _$2.forEach(fieldsetList, function (fs) {
  17406. var fieldSetVjson = {
  17407. xtype: 'fieldset',
  17408. title: fs.fieldset,
  17409. items: []
  17410. };
  17411. buildFieldItems(fieldSetVjson.items, fs.columns);
  17412. vjson.items.push(fieldSetVjson);
  17413. });
  17414. buildFieldItems(vjson.items, emptyFieldset);
  17415. return vjson;
  17416. }
  17417. // 构建字段组
  17418. function buildFieldItems(items, columns) {
  17419. var _a, _b, _c, _d, _e;
  17420. var row = {
  17421. xtype: 'cols',
  17422. items: []
  17423. };
  17424. for (var i = 0; i < columns.length; i++) {
  17425. var column = columns[i];
  17426. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17427. delete row.xtype;
  17428. row.layout = column.form.rowlayout;
  17429. }
  17430. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17431. row.items.push({ border: false, flex: column.form.prefix });
  17432. }
  17433. var fieldVjson = buildField(column, row.items.length);
  17434. if (!fieldVjson) {
  17435. continue;
  17436. }
  17437. row.items.push(fieldVjson);
  17438. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17439. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17440. }
  17441. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17442. items.push(row);
  17443. row = {
  17444. xtype: 'cols',
  17445. items: []
  17446. };
  17447. }
  17448. }
  17449. if (row.items.length > 0) {
  17450. items.push(row);
  17451. }
  17452. }
  17453. // 构建字段
  17454. function buildField(column, colIdx) {
  17455. var ret;
  17456. if (column.xtype === 'checkcolumn') {
  17457. ret = _$2.defaultsDeep({
  17458. xtype: 'checkbox',
  17459. uncheckedValue: column.uncheckedValue,
  17460. checkedValue: column.checkedValue,
  17461. boxLabel: column.header,
  17462. bind: {
  17463. value: '{' + column.dataIndex + '}'
  17464. }
  17465. }, column.form);
  17466. if (colIdx == 0) {
  17467. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17468. ret.margin = '0 0 0 85';
  17469. }
  17470. }
  17471. else {
  17472. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17473. fieldLabel: column.header,
  17474. bind: {
  17475. value: '{' + column.dataIndex + '}'
  17476. },
  17477. });
  17478. }
  17479. if (!ret.xtype) {
  17480. return;
  17481. }
  17482. if (!ret.dict && ret.xtype === 'combo') {
  17483. ret.dict = column.dict;
  17484. }
  17485. // 删除辅助属性
  17486. delete ret.order;
  17487. delete ret.wrap;
  17488. return ret;
  17489. }
  17490. //# sourceMappingURL=grid_dialog.js.map
  17491. var model$c = {
  17492. data: {}
  17493. };
  17494. //# sourceMappingURL=GridColumnCustom.model.js.map
  17495. var vjson$c = {
  17496. title: '自定义表格属性',
  17497. layout: 'fit',
  17498. width: 980,
  17499. height: 500,
  17500. fbar: [
  17501. {
  17502. xtype: "button",
  17503. text: "保存",
  17504. iconCls: 'x-fa fa-save',
  17505. listeners: {
  17506. click: 'scope.commit',
  17507. }
  17508. },
  17509. {
  17510. xtype: "button",
  17511. text: "关闭",
  17512. iconCls: 'x-fa fa-times',
  17513. listeners: {
  17514. click: 'system.closeMe()',
  17515. }
  17516. },
  17517. ],
  17518. items: [
  17519. {
  17520. region: 'center',
  17521. xtype: 'tabpanel',
  17522. items: [
  17523. {
  17524. title: '基本信息', reference: 'basic',
  17525. layout: {
  17526. type: 'vbox',
  17527. pack: 'start',
  17528. align: 'stretch'
  17529. },
  17530. defaults: {
  17531. border: false,
  17532. anchor: '100%',
  17533. margin: '5',
  17534. },
  17535. scrollable: true,
  17536. items: [
  17537. {
  17538. xtype: 'cols',
  17539. items: [
  17540. {
  17541. fieldLabel: '路径',
  17542. bind: { value: '{__custom_path}' },
  17543. xtype: 'textfield',
  17544. flex: 2,
  17545. },
  17546. {
  17547. fieldLabel: '版本',
  17548. bind: { value: '{__custom_version}' },
  17549. xtype: 'textfield',
  17550. },
  17551. ]
  17552. },
  17553. {
  17554. xtype: 'cols',
  17555. items: [
  17556. {
  17557. fieldLabel: '配置点',
  17558. bind: { value: '{__custom_point}' },
  17559. xtype: 'textfield',
  17560. },
  17561. {
  17562. fieldLabel: 'reference',
  17563. bind: { value: '{reference}' },
  17564. xtype: 'textfield',
  17565. },
  17566. {
  17567. fieldLabel: '编辑模式',
  17568. bind: { value: '{_mode}' },
  17569. xtype: 'combo',
  17570. dict: 'GRID_MODE',
  17571. },
  17572. ]
  17573. },
  17574. {
  17575. layout: 'hbox',
  17576. defaults: {
  17577. margin: '0 0 0 15',
  17578. },
  17579. items: [
  17580. {
  17581. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17582. bind: {
  17583. value: "{hideFootbar}"
  17584. }
  17585. },
  17586. {
  17587. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17588. bind: {
  17589. value: "{hideRefresh}"
  17590. }
  17591. },
  17592. {
  17593. boxLabel: '隐藏导出', xtype: 'checkbox',
  17594. bind: {
  17595. value: "{hideExport}"
  17596. }
  17597. },
  17598. {
  17599. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17600. bind: {
  17601. value: "{hideAutoSize}"
  17602. }
  17603. },
  17604. {
  17605. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17606. bind: {
  17607. value: "{hideClearFilter}"
  17608. }
  17609. },
  17610. {
  17611. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17612. bind: {
  17613. value: "{hideSaveGridUIConfig}"
  17614. }
  17615. },
  17616. {
  17617. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17618. bind: {
  17619. value: "{hideClearGridUIConfig}"
  17620. }
  17621. },
  17622. ]
  17623. },
  17624. {
  17625. layout: 'hbox',
  17626. defaults: {
  17627. margin: '0 0 0 15',
  17628. },
  17629. items: [
  17630. {
  17631. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17632. bind: { value: '{autoLoad}' },
  17633. margin: '0 0 0 85',
  17634. },
  17635. {
  17636. boxLabel: '分页模式', xtype: 'checkbox',
  17637. bind: { value: '{pagination}' },
  17638. },
  17639. {
  17640. boxLabel: '显示行序号', xtype: 'checkbox',
  17641. bind: { value: '{show_rownum}' },
  17642. },
  17643. {
  17644. boxLabel: '后端排序', xtype: 'checkbox',
  17645. bind: {
  17646. value: "{remoteSort}"
  17647. }
  17648. },
  17649. {
  17650. boxLabel: '后端过滤', xtype: 'checkbox',
  17651. bind: {
  17652. value: "{remoteFilter}"
  17653. }
  17654. },
  17655. {
  17656. boxLabel: '隐藏', xtype: 'checkbox',
  17657. bind: {
  17658. value: "{hidden}"
  17659. }
  17660. },
  17661. ]
  17662. },
  17663. {
  17664. layout: 'hbox',
  17665. defaults: {
  17666. margin: '0 0 0 15',
  17667. },
  17668. items: [
  17669. {
  17670. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17671. bind: {
  17672. value: "{enableColumnHide}"
  17673. }
  17674. },
  17675. {
  17676. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17677. bind: {
  17678. value: "{enableColumnMove}"
  17679. }
  17680. },
  17681. {
  17682. boxLabel: '自定义筛选', xtype: 'checkbox',
  17683. bind: {
  17684. value: "{gridfilters}"
  17685. }
  17686. },
  17687. {
  17688. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17689. bind: {
  17690. value: "{enableColumnResize}"
  17691. }
  17692. },
  17693. {
  17694. boxLabel: '点击列头排序', xtype: 'checkbox',
  17695. bind: {
  17696. value: "{sortOnClick}"
  17697. }
  17698. },
  17699. ]
  17700. },
  17701. {
  17702. xtype: 'cols',
  17703. items: [
  17704. {
  17705. fieldLabel: 'dbTableName',
  17706. labelWidth: 110,
  17707. bind: { value: '{behavior.dbTableName}' },
  17708. xtype: 'textfield',
  17709. },
  17710. {
  17711. fieldLabel: 'theid',
  17712. bind: { value: '{theid}' },
  17713. xtype: 'textfield',
  17714. },
  17715. {
  17716. fieldLabel: '添加行聚焦',
  17717. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17718. xtype: 'textfield',
  17719. },
  17720. ]
  17721. },
  17722. {
  17723. xtype: 'cols',
  17724. items: [
  17725. {
  17726. fieldLabel: '批量删除提示',
  17727. labelWidth: 110,
  17728. bind: { value: '{behavior.batchRemoveConfirm}' },
  17729. xtype: 'textfield',
  17730. },
  17731. {
  17732. fieldLabel: '删除提示',
  17733. bind: { value: '{behavior.singleRemoveConfirm}' },
  17734. xtype: 'textfield',
  17735. },
  17736. {
  17737. fieldLabel: '触发刷新',
  17738. labelWidth: 110,
  17739. bind: { value: '{behavior.selectToReload}' },
  17740. xtype: 'textfield',
  17741. },
  17742. ]
  17743. },
  17744. ]
  17745. },
  17746. {
  17747. title: '字段', reference: 'grid1',
  17748. xtype: 'yvgrid',
  17749. pagination: false,
  17750. _mode: 'edit',
  17751. listeners: {
  17752. buttonclick: 'scope.grid1Buttonclick',
  17753. },
  17754. hideFootbar: true,
  17755. tbar: [
  17756. {
  17757. xtype: 'button',
  17758. text: '添加',
  17759. iconCls: 'x-fa fa-plus-circle',
  17760. listeners: {
  17761. click: 'scope.addField'
  17762. }
  17763. },
  17764. {
  17765. xtype: 'button',
  17766. text: '删除',
  17767. iconCls: 'x-fa fa-minus-circle',
  17768. listeners: {
  17769. click: 'scope.removeField'
  17770. }
  17771. },
  17772. '-',
  17773. {
  17774. xtype: 'button',
  17775. text: '自动分析',
  17776. iconCls: 'x-fa fa-code-fork',
  17777. listeners: {
  17778. click: 'scope.calcField'
  17779. }
  17780. },
  17781. {
  17782. xtype: 'button',
  17783. text: '上移',
  17784. iconCls: 'x-fa fa-arrow-up',
  17785. listeners: {
  17786. click: 'scope.moveUp'
  17787. }
  17788. },
  17789. {
  17790. xtype: 'button',
  17791. text: '下移',
  17792. iconCls: 'x-fa fa-arrow-down',
  17793. listeners: {
  17794. click: 'scope.moveDown'
  17795. }
  17796. },
  17797. ],
  17798. store: {},
  17799. columns: [
  17800. {
  17801. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17802. editor: { xtype: 'textfield' }
  17803. },
  17804. {
  17805. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17806. editor: { xtype: 'textfield' }
  17807. },
  17808. {
  17809. dataIndex: 'header', header: '中文', width: 140,
  17810. editor: { xtype: 'textfield' }
  17811. },
  17812. {
  17813. dataIndex: 'dict', header: '字典', width: 110,
  17814. editor: { xtype: 'combogrid' }
  17815. },
  17816. {
  17817. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17818. editor: { xtype: 'combogrid' }, hidden: true,
  17819. },
  17820. {
  17821. dataIndex: 'width', header: '宽度', width: 80,
  17822. editor: { xtype: 'numberfield' }, hidden: true,
  17823. },
  17824. {
  17825. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17826. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17827. },
  17828. {
  17829. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17830. editor: { xtype: 'textfield' },
  17831. },
  17832. {
  17833. dataIndex: 'createValue', text: '客户端新创建值',
  17834. editor: { xtype: 'textfield' },
  17835. },
  17836. {
  17837. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17838. resizable: false, sortable: false, menuDisabled: true,
  17839. checkedValue: true, uncheckedValue: false,
  17840. },
  17841. {
  17842. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17843. resizable: false, sortable: false, menuDisabled: true,
  17844. checkedValue: true, uncheckedValue: false,
  17845. },
  17846. {
  17847. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17848. resizable: false, sortable: false, menuDisabled: true,
  17849. checkedValue: true, uncheckedValue: false,
  17850. },
  17851. {
  17852. dataIndex: 'formatter', header: '格式化', width: 110,
  17853. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17854. },
  17855. {
  17856. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17857. resizable: false, sortable: false, menuDisabled: true,
  17858. checkedValue: true, uncheckedValue: false, hidden: true,
  17859. },
  17860. {
  17861. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17862. resizable: false, sortable: false, menuDisabled: true,
  17863. hidden: true,
  17864. },
  17865. {
  17866. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17867. resizable: false, sortable: false, menuDisabled: true,
  17868. checkedValue: true, uncheckedValue: false, hidden: true,
  17869. },
  17870. {
  17871. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17872. resizable: false, sortable: false, menuDisabled: true,
  17873. },
  17874. {
  17875. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17876. resizable: false, sortable: false, menuDisabled: true,
  17877. checkedValue: true, uncheckedValue: false, hidden: true,
  17878. },
  17879. {
  17880. dataIndex: 'form_order', text: '对话框序号',
  17881. editor: { xtype: 'numberfield' },
  17882. },
  17883. {
  17884. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17885. resizable: false, sortable: false, menuDisabled: true,
  17886. checkedValue: true, uncheckedValue: false,
  17887. },
  17888. {
  17889. dataIndex: 'form_xtype', text: '对话框编辑器',
  17890. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17891. },
  17892. {
  17893. dataIndex: 'form_fieldset', text: '对话框字段组',
  17894. editor: { xtype: 'textfield' }, hidden: true,
  17895. },
  17896. {
  17897. dataIndex: 'form_tab', text: '对话框选项卡',
  17898. editor: { xtype: 'textfield' }, hidden: true,
  17899. },
  17900. {
  17901. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17902. resizable: false, sortable: false, menuDisabled: true,
  17903. checkedValue: true, uncheckedValue: false, hidden: true,
  17904. },
  17905. ],
  17906. },
  17907. {
  17908. title: 'SQL和查询条件', reference: 'sql',
  17909. layout: 'border',
  17910. border: false,
  17911. items: [
  17912. {
  17913. region: 'north',
  17914. height: 200,
  17915. border: false,
  17916. split: true,
  17917. xtype: 'yvgrid',
  17918. reference: 'gridCondition',
  17919. pagination: false,
  17920. hideFootbar: true,
  17921. _mode: 'edit',
  17922. listeners: {
  17923. buttonclick: 'scope.conditionButtonclick',
  17924. },
  17925. store: {},
  17926. tbar: {
  17927. xtype: 'toolbar',
  17928. border: false,
  17929. items: [
  17930. {
  17931. xtype: 'button',
  17932. text: '添加条件',
  17933. iconCls: 'x-fa fa-plus-circle',
  17934. listeners: {
  17935. click: 'scope.addCondition'
  17936. }
  17937. },
  17938. {
  17939. xtype: 'button',
  17940. text: '删除条件',
  17941. iconCls: 'x-fa fa-minus-circle',
  17942. listeners: {
  17943. click: 'scope.removeCondition'
  17944. }
  17945. },
  17946. '-',
  17947. {
  17948. xtype: 'button',
  17949. text: '自动分析条件变量',
  17950. iconCls: 'x-fa fa-code-fork',
  17951. listeners: {
  17952. click: 'scope.calcCondition'
  17953. }
  17954. },
  17955. {
  17956. xtype: 'button',
  17957. text: '上移',
  17958. iconCls: 'x-fa fa-arrow-up',
  17959. listeners: {
  17960. click: 'scope.moveUpCondition'
  17961. }
  17962. },
  17963. {
  17964. xtype: 'button',
  17965. text: '下移',
  17966. iconCls: 'x-fa fa-arrow-down',
  17967. listeners: {
  17968. click: 'scope.moveDownCondition'
  17969. }
  17970. },
  17971. ]
  17972. },
  17973. columns: [
  17974. {
  17975. text: '条件变量',
  17976. dataIndex: 'param_name',
  17977. width: 140,
  17978. sortable: false,
  17979. menuDisabled: true,
  17980. editor: {
  17981. selectOnFocus: true
  17982. },
  17983. },
  17984. {
  17985. text: '中文标题',
  17986. dataIndex: 'fieldLabel',
  17987. width: 120,
  17988. sortable: false,
  17989. menuDisabled: true,
  17990. editor: {
  17991. selectOnFocus: true
  17992. },
  17993. },
  17994. {
  17995. text: '编辑类型',
  17996. dataIndex: 'xtype',
  17997. width: 80,
  17998. sortable: false,
  17999. menuDisabled: true,
  18000. editor: {
  18001. xtype: 'combo',
  18002. typeAhead: true,
  18003. triggerAction: 'all',
  18004. selectOnFocus: true,
  18005. store: [
  18006. ['textfield', 'textfield'],
  18007. ['combo', 'combo'],
  18008. ['datefield', 'datefield'],
  18009. ['datetimefield', 'datetimefield'],
  18010. ['numberfield', 'numberfield'],
  18011. ['multiplesearch', 'multiplesearch'],
  18012. ]
  18013. }
  18014. },
  18015. {
  18016. text: '权重',
  18017. dataIndex: 'conditionFieldFlex',
  18018. align: 'right',
  18019. width: 60,
  18020. sortable: false,
  18021. menuDisabled: true,
  18022. editor: {
  18023. xtype: 'numberfield',
  18024. selectOnFocus: false,
  18025. minValue: 0,
  18026. maxValue: 10
  18027. },
  18028. },
  18029. {
  18030. text: '字典',
  18031. dataIndex: 'conditionFieldDict',
  18032. width: 160,
  18033. sortable: false,
  18034. menuDisabled: true,
  18035. editor: {
  18036. selectOnFocus: false
  18037. },
  18038. },
  18039. {
  18040. xtype: 'checkcolumn',
  18041. dataIndex: "conditionFieldWrap", header: "换行",
  18042. width: 65,
  18043. sortable: false,
  18044. menuDisabled: true,
  18045. },
  18046. {
  18047. text: '扩展参数',
  18048. dataIndex: 'conditionFieldExtend',
  18049. sortable: false,
  18050. menuDisabled: true,
  18051. editor: {
  18052. selectOnFocus: false
  18053. },
  18054. },
  18055. ]
  18056. },
  18057. {
  18058. region: 'center',
  18059. xtype: 'sqleditor',
  18060. layout: 'fit',
  18061. reference: 'sqlEditor',
  18062. split: true,
  18063. },
  18064. ]
  18065. },
  18066. {
  18067. title: '详情对话框',
  18068. layout: {
  18069. type: 'vbox',
  18070. pack: 'start',
  18071. align: 'stretch'
  18072. },
  18073. defaults: {
  18074. border: false,
  18075. anchor: '100%',
  18076. margin: '5',
  18077. },
  18078. scrollable: true,
  18079. items: [
  18080. {
  18081. xtype: 'cols',
  18082. items: [
  18083. {
  18084. fieldLabel: '对话框标题',
  18085. bind: { value: '{detailDialog.title}' },
  18086. xtype: 'textfield',
  18087. flex: 2,
  18088. },
  18089. {
  18090. fieldLabel: '宽度',
  18091. bind: { value: '{detailDialog.width}' },
  18092. xtype: 'numberfield',
  18093. },
  18094. {
  18095. fieldLabel: '高度',
  18096. bind: { value: '{detailDialog.height}' },
  18097. xtype: 'numberfield',
  18098. },
  18099. ]
  18100. },
  18101. ]
  18102. },
  18103. {
  18104. title: '界面源码',
  18105. xtype: 'jseditor',
  18106. reference: 'jseditor'
  18107. }
  18108. ]
  18109. }
  18110. ]
  18111. };
  18112. //# sourceMappingURL=GridColumnCustom.view.js.map
  18113. var GridColumnCustom = /** @class */ (function (_super) {
  18114. __extends(GridColumnCustom, _super);
  18115. function GridColumnCustom() {
  18116. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18117. }
  18118. GridColumnCustom.prototype.commit = function () {
  18119. };
  18120. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18121. };
  18122. GridColumnCustom.prototype.conditionButtonclick = function () {
  18123. };
  18124. GridColumnCustom.prototype.addField = function () {
  18125. };
  18126. GridColumnCustom.prototype.removeField = function () {
  18127. };
  18128. GridColumnCustom.prototype.calcField = function () {
  18129. };
  18130. GridColumnCustom.prototype.moveUp = function () {
  18131. };
  18132. GridColumnCustom.prototype.moveDown = function () {
  18133. };
  18134. GridColumnCustom.prototype.addCondition = function () {
  18135. };
  18136. GridColumnCustom.prototype.removeCondition = function () {
  18137. };
  18138. GridColumnCustom.prototype.calcCondition = function () {
  18139. };
  18140. GridColumnCustom.prototype.moveUpCondition = function () {
  18141. };
  18142. GridColumnCustom.prototype.moveDownCondition = function () {
  18143. };
  18144. return GridColumnCustom;
  18145. }(Scope));
  18146. //# sourceMappingURL=GridColumnCustom.js.map
  18147. function initGridCode(grid, newConfig, buttons) {
  18148. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18149. buttons.push({
  18150. xtype: 'button',
  18151. tooltip: '定义表格属性',
  18152. iconCls: 'x-fa fa-codepen',
  18153. handler: function (btn) {
  18154. var customWindow = new GridColumnCustom();
  18155. customWindow.showDialog(btn, {}, {});
  18156. }
  18157. });
  18158. buttons.push({
  18159. xtype: 'button',
  18160. tooltip: '定义表格数据源',
  18161. iconCls: 'x-fa fa-database',
  18162. handler: function () {
  18163. // showCustomGridDataSource(grid)
  18164. }
  18165. });
  18166. }
  18167. }
  18168. //# sourceMappingURL=grid_code.js.map
  18169. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18170. var hexToString = function (hex) {
  18171. var arr = hex.split("");
  18172. var out = "";
  18173. for (var i = 0; i < arr.length / 2; i++) {
  18174. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18175. // @ts-ignore
  18176. var charValue = String.fromCharCode(tmp);
  18177. out += charValue;
  18178. }
  18179. return out;
  18180. };
  18181. var defaultGrid = grid;
  18182. function initGrid () {
  18183. Ext.define('Yvan.Grid', {
  18184. extend: 'Ext.grid.Panel',
  18185. xtype: 'yvgrid',
  18186. __suspendReload: false,
  18187. _originVJson: {},
  18188. constructor: function (config) {
  18189. var _this = this;
  18190. var _a, _b, _c, _d, _e, _f;
  18191. var me = this;
  18192. var dataSource = config.dataSource;
  18193. 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);
  18194. me._originVJson = config;
  18195. if (!isDesignMode(scope, config)) {
  18196. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18197. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18198. var cacheData = this.getColumnConfigCache();
  18199. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18200. var newColumns = [];
  18201. for (var j = 0; j < cacheData.length; j++) {
  18202. var itData = cacheData[j];
  18203. for (var i = 0; i < config.columns.length; i++) {
  18204. var column = config.columns[i];
  18205. if (itData.dataIndex === column.dataIndex) {
  18206. if (itData.width) {
  18207. column.width = itData.width;
  18208. }
  18209. column.hidden = itData.hidden;
  18210. column.locked = itData.locked;
  18211. newColumns.push(column);
  18212. break;
  18213. }
  18214. }
  18215. }
  18216. config.columns = newColumns;
  18217. }
  18218. }
  18219. }
  18220. var newConfig = _$2.defaultsDeep({
  18221. // 强制性属性 bug.
  18222. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18223. // enableLocking: false,
  18224. // syncRowHeight: false,
  18225. }, baseConfig(config, 'row-item'), config, grid);
  18226. // 在面板上的组件
  18227. // const scope = newConfig.$initParent?.yvanScope ||
  18228. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18229. // config.$vmParent?.yvanScope ||
  18230. // newConfig.$vmParent?._parent?.yvanScope;
  18231. var buttons = [];
  18232. var getRowClass = newConfig.getRowClass;
  18233. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18234. _$2.startsWith(getRowClass, "system."))) {
  18235. var fn = lookupFn(scope, getRowClass);
  18236. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18237. }
  18238. if (!newConfig.hideExport) {
  18239. buttons.push({
  18240. xtype: 'button',
  18241. tooltip: '导出Excel',
  18242. iconCls: 'x-fa fa-download',
  18243. listeners: {
  18244. click: this.exportExcel
  18245. },
  18246. });
  18247. }
  18248. if (!newConfig.hideAutoSize) {
  18249. buttons.push({
  18250. xtype: 'button',
  18251. iconCls: 'x-fa fa-text-width',
  18252. tooltip: '自适应宽度',
  18253. listeners: {
  18254. click: this.autoSizeColumns
  18255. }
  18256. });
  18257. }
  18258. if (!newConfig.hideClearFilter) {
  18259. buttons.push({
  18260. xtype: 'button',
  18261. tooltip: '清空筛选',
  18262. iconCls: 'x-fa fa-filter',
  18263. handler: this.clearFilter
  18264. });
  18265. }
  18266. if (!newConfig.hideSaveGridUIConfig) {
  18267. buttons.push({
  18268. xtype: 'button',
  18269. tooltip: '保存布局',
  18270. iconCls: 'x-fa fa-cogs',
  18271. handler: this.saveGridUIConfig
  18272. });
  18273. }
  18274. if (!newConfig.hideClearGridUIConfig) {
  18275. buttons.push({
  18276. xtype: 'button',
  18277. tooltip: '还原布局',
  18278. iconCls: 'x-fa fa-reply-all',
  18279. handler: this.clearGridUIConfig
  18280. });
  18281. }
  18282. initGridCode(me, newConfig, buttons);
  18283. if (!newConfig.hideFootbar) {
  18284. if (newConfig.pagination) {
  18285. newConfig.bbar = new Ext.PagingToolbar({
  18286. // pageSize: newConfig.pageSize, 这个值是无效的
  18287. displayInfo: true,
  18288. store: this.store,
  18289. emptyMsg: '没有记录',
  18290. cls: 'grid-bbar',
  18291. items: __spread([
  18292. {
  18293. xtype: 'combobox',
  18294. tooltip: '分页',
  18295. queryMode: 'local',
  18296. editable: false,
  18297. allowBlank: true,
  18298. labelAlign: 'right',
  18299. width: 90,
  18300. // labelWidth: 30,
  18301. listConfig: {
  18302. minWidth: null
  18303. },
  18304. value: 50,
  18305. valueField: undefined,
  18306. displayField: undefined,
  18307. hideClear: true,
  18308. store: newConfig.pageSizeOption,
  18309. listeners: {
  18310. change: function (sender, nv, ov) {
  18311. _this.store.pageSize = nv;
  18312. _this.store.loadPage(1);
  18313. }
  18314. }
  18315. }
  18316. ], buttons),
  18317. doRefresh: function () {
  18318. me.reload();
  18319. }
  18320. });
  18321. }
  18322. else {
  18323. newConfig.bbar = {
  18324. xtype: 'toolbar', overflowHandler: 'menu',
  18325. cls: 'grid-bbar',
  18326. items: __spread([
  18327. {
  18328. xtype: 'button',
  18329. tooltip: '刷新',
  18330. iconCls: 'x-fa fa-refresh',
  18331. handler: function () {
  18332. _this.reload();
  18333. }
  18334. },
  18335. '-'
  18336. ], buttons)
  18337. };
  18338. if (newConfig.hideRefresh) {
  18339. newConfig.bbar.items.splice(0, 1);
  18340. }
  18341. }
  18342. }
  18343. if (_$2.isArray(newConfig.condition)) {
  18344. // 带查询条件
  18345. var conditionRows_1 = [];
  18346. var newRow_1 = false;
  18347. var currentRow_1 = { xtype: 'cols', items: [], };
  18348. conditionRows_1.push(currentRow_1);
  18349. _$2.forEach(newConfig.condition, function (item) {
  18350. var _a;
  18351. if (newRow_1) {
  18352. currentRow_1 = { xtype: 'cols', items: [], };
  18353. conditionRows_1.push(currentRow_1);
  18354. }
  18355. var vj = _$2.cloneDeep(item);
  18356. if (vj.xtype) {
  18357. if (item.xtype === 'combo' && item.dict) {
  18358. vj.fix = ['system.getDict("' + item.dict + '")'];
  18359. }
  18360. if (item.xtype === 'datetimefield') {
  18361. _$2.defer(function () {
  18362. //@ts-ignore
  18363. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18364. });
  18365. }
  18366. else if (item.xtype === 'datefield') {
  18367. _$2.defer(function () {
  18368. //@ts-ignore
  18369. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18370. });
  18371. }
  18372. else {
  18373. scope.viewModel.set(item.param_name, '');
  18374. }
  18375. }
  18376. else {
  18377. // 没有组件类型,是个空占位符
  18378. vj.border = false;
  18379. }
  18380. if (item.param_name) {
  18381. vj.bind = {
  18382. value: '{' + item.param_name + '}'
  18383. };
  18384. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18385. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18386. }
  18387. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18388. currentRow_1.items.push(vj);
  18389. });
  18390. newConfig.tbar = {
  18391. xtype: 'form',
  18392. border: false,
  18393. items: conditionRows_1,
  18394. defaults: {
  18395. margin: '8 0 8 0'
  18396. },
  18397. };
  18398. console.log('newConfig', newConfig);
  18399. }
  18400. _$2.each(newConfig.columns, function (c) {
  18401. var renderer = c.renderer, formatter = c.formatter;
  18402. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18403. _$2.startsWith(renderer, "system."))) {
  18404. if (newConfig.$initParent) {
  18405. if (scope) {
  18406. var rendererFn = lookupFn(scope, renderer);
  18407. c.renderer = rendererFn.bind(scope);
  18408. }
  18409. }
  18410. }
  18411. if (c.dict) {
  18412. c.fix = ['system.getDict("' + c.dict + '")'];
  18413. if (c.editor && c.editor.xtype === 'combo') {
  18414. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18415. c.editor.typeAhead = true;
  18416. c.editor.triggerAction = 'all';
  18417. c.editor.selectOnFocus = false;
  18418. c.editor.listConfig = {
  18419. minWidth: 200
  18420. };
  18421. }
  18422. }
  18423. if (formatter === 'button') {
  18424. c.tdCls = 'td-btn';
  18425. if (!c.listeners) {
  18426. c.listeners = {};
  18427. }
  18428. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18429. if ($(event.target).is('input')) {
  18430. me.fireEvent('buttonclick', me, this, record);
  18431. }
  18432. };
  18433. }
  18434. else if (formatter === 'percentRenderer') {
  18435. c.tdCls = 'td-percent';
  18436. }
  18437. });
  18438. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18439. // 强制为编辑模式
  18440. newConfig.selModel = {
  18441. type: 'spreadsheet',
  18442. columnSelect: true,
  18443. pruneRemoved: false,
  18444. extensible: 'y'
  18445. };
  18446. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18447. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18448. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18449. }
  18450. else {
  18451. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18452. }
  18453. }
  18454. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18455. // 强制为勾选模式
  18456. newConfig.selModel = {
  18457. type: 'checkboxmodel',
  18458. mode: 'MULTI',
  18459. };
  18460. }
  18461. else if (newConfig._mode === 'checkonly') {
  18462. newConfig.selModel = {
  18463. type: 'checkboxmodel',
  18464. mode: 'MULTI',
  18465. checkOnly: true,
  18466. };
  18467. }
  18468. else if (newConfig._mode === 'select') {
  18469. // 强制为选择模式
  18470. newConfig.selModel = {
  18471. selType: 'rowmodel',
  18472. mode: 'SINGLE',
  18473. };
  18474. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18475. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18476. }
  18477. }
  18478. initBehaviorEdit(newConfig);
  18479. initGridDialog(newConfig);
  18480. this.superclass.constructor.call(this, newConfig);
  18481. this.store.pageSize = newConfig.pageSize;
  18482. },
  18483. setData: function (value) {
  18484. var me = this;
  18485. me._setDataReal(value);
  18486. },
  18487. /**
  18488. * 添加行,并进入编辑状态
  18489. * @param record 新行的属性集
  18490. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18491. */
  18492. appendEditRow: function (record, editRowCol) {
  18493. var records = this.getStore().add(record);
  18494. var recNew = records[0];
  18495. this.setSelection(records);
  18496. if (typeof editRowCol === 'string' && editRowCol) {
  18497. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18498. }
  18499. if (typeof editRowCol === 'number') {
  18500. var ce = this.findPlugin('cellediting');
  18501. this.editingPlugin = ce;
  18502. ce.startEdit(recNew, editRowCol);
  18503. }
  18504. },
  18505. beginEdit: function (record, editRowCol) {
  18506. if (typeof record === 'number') {
  18507. record = this.store.data.getAt(record);
  18508. }
  18509. if (record.isEntity === true) {
  18510. this.setSelection([record]);
  18511. if (typeof editRowCol === 'string' && editRowCol) {
  18512. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18513. }
  18514. if (typeof editRowCol === 'number') {
  18515. var ce = this.findPlugin('cellediting');
  18516. this.editingPlugin = ce;
  18517. ce.startEdit(record, editRowCol);
  18518. }
  18519. }
  18520. },
  18521. /**
  18522. * 移除行
  18523. * @param record 如果记录传空,就是当前选中的行
  18524. */
  18525. removeEditRow: function (record) {
  18526. if (!record) {
  18527. record = this.selection;
  18528. }
  18529. if (!record) {
  18530. msg('请选中要删除的行');
  18531. return;
  18532. }
  18533. this.getStore().remove(record);
  18534. },
  18535. /**
  18536. * 获取全部原始数据
  18537. */
  18538. getDataRows: function () {
  18539. return this.getStore().data.items.map(function (r) { return r.data; });
  18540. },
  18541. /**
  18542. * 获取全部原始数据, 不带 id/ 不带 origin
  18543. */
  18544. getDataRowsOnlyData: function () {
  18545. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18546. delete r.id;
  18547. delete r._origin;
  18548. return r;
  18549. });
  18550. },
  18551. rowMoveUp: function () {
  18552. var grid = this;
  18553. if (!grid.selection) {
  18554. msg('无法对多行进行移动');
  18555. return;
  18556. }
  18557. var record = grid.selection;
  18558. if (_$2.isArray(record)) {
  18559. record = record[0];
  18560. }
  18561. if (!record) {
  18562. msg('无法对多行进行移动');
  18563. return;
  18564. }
  18565. // const records = grid.selModel.getSelection()
  18566. // if (records.length !== 1) {
  18567. // msg('无法对多行进行移动')
  18568. // return
  18569. // }
  18570. //
  18571. // const [record] = records
  18572. var index = grid.store.indexOf(record);
  18573. if (index > 0) {
  18574. grid.store.removeAt(index);
  18575. grid.store.insert(index - 1, record);
  18576. grid.getView().refresh();
  18577. grid.selModel.select([record]);
  18578. }
  18579. },
  18580. rowMoveDown: function () {
  18581. var grid = this;
  18582. // const records = grid.selModel.getSelection()
  18583. // if (records.length !== 1) {
  18584. // msg('无法对多行进行移动')
  18585. // return
  18586. // }
  18587. if (!grid.selection) {
  18588. msg('无法对多行进行移动');
  18589. return;
  18590. }
  18591. var record = grid.selection;
  18592. if (_$2.isArray(record)) {
  18593. record = record[0];
  18594. }
  18595. if (!record) {
  18596. msg('无法对多行进行移动');
  18597. return;
  18598. }
  18599. var index = grid.store.indexOf(record);
  18600. if (index < grid.store.getCount() - 1) {
  18601. grid.store.removeAt(index);
  18602. grid.store.insert(index + 1, record);
  18603. grid.getView().refresh();
  18604. grid.selModel.select([record]);
  18605. }
  18606. },
  18607. getEditRecord: function () {
  18608. var _a, _b;
  18609. var me = this;
  18610. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18611. 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;
  18612. var record;
  18613. if (typeof rowIdx === 'undefined') {
  18614. record = me.getSelectionModel().getLastSelected();
  18615. }
  18616. else {
  18617. record = me.store.getAt(rowIdx);
  18618. }
  18619. return record;
  18620. },
  18621. getEditRow: function () {
  18622. var _a;
  18623. var me = this;
  18624. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18625. },
  18626. setEditRow: function (rowValues) {
  18627. var me = this;
  18628. var record = me.getEditRecord();
  18629. if (record) {
  18630. _$2.forOwn(rowValues, function (v, k) {
  18631. record.set(k, v);
  18632. });
  18633. }
  18634. },
  18635. _transform: function (data) {
  18636. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18637. _$2.forEach(data, function (row) {
  18638. row._origin = _$2.clone(row);
  18639. });
  18640. },
  18641. _setDataReal: function (value) {
  18642. var me = this;
  18643. this._transform(value);
  18644. var storeOpt = {
  18645. fields: getFileds(this),
  18646. data: value,
  18647. };
  18648. if (this.groupField) {
  18649. storeOpt.groupField = this.groupField;
  18650. }
  18651. var store = new Ext.data.Store(storeOpt);
  18652. me.setStore(store);
  18653. },
  18654. setStore: function (store) {
  18655. var me = this;
  18656. if (_$2.isArray(store)) {
  18657. var value = store;
  18658. this._transform(value);
  18659. var storeOpt = {
  18660. fields: getFileds(this),
  18661. data: value,
  18662. };
  18663. if (this.groupField) {
  18664. storeOpt.groupField = this.groupField;
  18665. }
  18666. store = new Ext.data.Store(storeOpt);
  18667. }
  18668. me.superclass.setStore.call(this, store);
  18669. var reference = this.reference;
  18670. if (reference) {
  18671. var scope = lookupScope(this);
  18672. scope.viewModel.set(reference + '.ischanged', false);
  18673. scope.viewModel.set(reference + '.theid', null);
  18674. scope.viewModel.set(reference + '.theid2', null);
  18675. scope.viewModel.set(reference + '.theid3', null);
  18676. }
  18677. if (store) {
  18678. store.on({
  18679. add: function (store, records, index, eOpts) {
  18680. me._raiseChange(store, 'add');
  18681. },
  18682. remove: function (store, records, index, isMove, eOpts) {
  18683. me._raiseChange(store, 'remove');
  18684. },
  18685. datachanged: function (sender, opt) {
  18686. me._raiseChange(store, 'datachanged');
  18687. }
  18688. });
  18689. }
  18690. },
  18691. _raiseChange: function (store, type) {
  18692. var _a, _b;
  18693. var reference = this.reference;
  18694. if (reference && store) {
  18695. var ischanged = false;
  18696. if (store.getModifiedRecords().length > 0 ||
  18697. store.getNewRecords().length > 0 ||
  18698. store.getRemovedRecords().length > 0) {
  18699. ischanged = true;
  18700. }
  18701. else {
  18702. ischanged = false;
  18703. }
  18704. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18705. }
  18706. },
  18707. /**
  18708. * 轻量级刷新
  18709. */
  18710. refreshData: function () {
  18711. var store = this.getStore();
  18712. if (store) {
  18713. store.reload();
  18714. }
  18715. },
  18716. /**
  18717. * 为表格强制设置焦点
  18718. * @param seq 顺序号
  18719. */
  18720. focusRow: function (seq) {
  18721. this.setSelection(this.store.getAt(seq));
  18722. this.getView().focusRow(seq);
  18723. },
  18724. /**
  18725. * 重新载入数据(重新计算参数)
  18726. */
  18727. reload: function (reloadParams) {
  18728. if (reloadParams === void 0) { reloadParams = {}; }
  18729. var me = this;
  18730. var config = me.config;
  18731. if (config.dataSourceCallbackFn) {
  18732. // 函数请求刷新
  18733. var scope_1 = lookupScope(this);
  18734. _$2.defer(function () {
  18735. me.setLoading(true);
  18736. });
  18737. config.dataSourceCallbackFn.call(scope_1, me, {
  18738. successCallback: function (value) {
  18739. me._setDataReal(value);
  18740. _$2.defer(function () {
  18741. me.setLoading(false);
  18742. });
  18743. // 自动选中第一行
  18744. var data = me.getStore().data;
  18745. if (data.length > 0) {
  18746. me.setSelection(data.items[0]);
  18747. }
  18748. me.fireEvent('dataLoadComplete', me, true, value);
  18749. },
  18750. failCallback: function (error) {
  18751. _$2.defer(function () {
  18752. me.setLoading(false);
  18753. });
  18754. me.fireEvent('dataLoadComplete', me, false, error);
  18755. }
  18756. });
  18757. return;
  18758. }
  18759. // if (this.store) {
  18760. // this.store.reload({aaaa: 1, bbbb: 2})
  18761. // }
  18762. var dataSource = config.dataSource;
  18763. var scope = lookupScope(me);
  18764. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18765. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18766. }
  18767. },
  18768. exportCurrentExcelClick: function () {
  18769. var _a;
  18770. var me = this;
  18771. var config = me.config;
  18772. var scope = lookupScope(me);
  18773. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18774. if (excelFileName.endsWith(".xlsx")) {
  18775. excelFileName = excelFileName.split(".xlsx")[0];
  18776. }
  18777. excelFileName += ".xlsx";
  18778. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18779. var excelData = me.makeExcelData(rowsAll);
  18780. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18781. },
  18782. exportExcelClick: function (excelExportParams) {
  18783. var me = this;
  18784. var config = me.config;
  18785. excelExportParams.isExcelExport = true;
  18786. var scope = lookupScope(me);
  18787. var dataSource = config.dataSource;
  18788. scope.setLoading(true);
  18789. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18790. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18791. var _a, _b, _c, _d;
  18792. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  18793. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18794. 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;
  18795. me.exportExcelCurrentPage = page;
  18796. me.exportExcelPageSize = size;
  18797. me.exportExcelTotal = total;
  18798. if (excelFileName.endsWith(".xlsx")) {
  18799. excelFileName = excelFileName.split(".xlsx")[0];
  18800. }
  18801. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18802. excelFileName += ".xlsx";
  18803. var excelData = me.makeExcelData(responseData.data);
  18804. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18805. if (page < total / size) {
  18806. page++;
  18807. me.exportExcelCurrentPage = page;
  18808. }
  18809. scope.setLoading(false);
  18810. });
  18811. },
  18812. exportBigExcelClick: function () {
  18813. var _a;
  18814. var me = this;
  18815. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18816. showErrorDialog('当前表格不支持大批量导出');
  18817. return;
  18818. }
  18819. var config = me.config;
  18820. var scope = lookupScope(me);
  18821. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18822. var head = [];
  18823. var dict = {};
  18824. _$2.forEach(me.columns, function (column) {
  18825. if (column.isHidden())
  18826. return;
  18827. if (!column.dataIndex)
  18828. return;
  18829. if (!column.text)
  18830. return;
  18831. head.push({ field: column.dataIndex, name: column.text });
  18832. if (column.dictForExcel) {
  18833. dict[column.dataIndex] = column.dictForExcel;
  18834. }
  18835. });
  18836. // 判断是否需要解密
  18837. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18838. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18839. me.dbInfo.password = hexToString(me.dbInfo.password);
  18840. me.dbInfo.username = hexToString(me.dbInfo.username);
  18841. }
  18842. scope.setLoading(true);
  18843. Ext.Ajax.request({
  18844. timeout: 15000,
  18845. url: window["EXPORT_DATA_HOST"],
  18846. method: "POST",
  18847. jsonData: {
  18848. file: excelFileName,
  18849. dbInfo: me.dbInfo,
  18850. exportDataSql: me.exportDataSql,
  18851. exportDataSqlParams: me.exportDataSqlParams,
  18852. head: head,
  18853. dict: dict,
  18854. },
  18855. }).then(function () {
  18856. scope.setLoading(false);
  18857. msg('请求成功');
  18858. }).catch(function () {
  18859. scope.setLoading(false);
  18860. showErrorDialog('请求失败,请确认是否已安装客户端');
  18861. });
  18862. },
  18863. makeExcelData: function (jsonData) {
  18864. var me = this;
  18865. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18866. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18867. return;
  18868. }
  18869. var data = [];
  18870. // 获取表格的列定义
  18871. var headerTextArr = [];
  18872. var headers = [];
  18873. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18874. var header = me.headerCt.getGridColumns()[i];
  18875. if (!header.isHidden()) {
  18876. var textStr = _$2.trim(header.text);
  18877. var dataIndexStr = _$2.trim(header.dataIndex);
  18878. if (dataIndexStr) {
  18879. if (textStr === '') {
  18880. headerTextArr.push(dataIndexStr);
  18881. }
  18882. else {
  18883. headerTextArr.push(textStr);
  18884. }
  18885. headers.push(header);
  18886. }
  18887. }
  18888. }
  18889. if (headers.length === 0) {
  18890. return;
  18891. }
  18892. data.push(headerTextArr);
  18893. for (var i = 0; i < jsonData.length; i++) {
  18894. var dataRow = jsonData[i];
  18895. var row = [];
  18896. for (var j = 0; j < headers.length; j++) {
  18897. var key = headers[j].dataIndex;
  18898. var value = dataRow[key];
  18899. if (!value && value !== 0) {
  18900. value = '';
  18901. }
  18902. var oValue = value;
  18903. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18904. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18905. try {
  18906. value = headers[j].renderer(value);
  18907. if (!value && value !== 0) {
  18908. value = oValue;
  18909. }
  18910. }
  18911. catch (e) {
  18912. value = oValue;
  18913. }
  18914. }
  18915. row.push(value);
  18916. }
  18917. data.push(row);
  18918. }
  18919. return data;
  18920. },
  18921. initComponent: function () {
  18922. var _this = this;
  18923. var _a;
  18924. var me = this;
  18925. var config = me.config;
  18926. var scope = lookupScope(this);
  18927. if (isDesignMode(scope, config)) {
  18928. this.superclass.initComponent.call(this);
  18929. return;
  18930. }
  18931. // 转换 dataSource 属性
  18932. convertDataSource$1(me, scope, config);
  18933. this.on({
  18934. afterrender: function (sender) {
  18935. var me = this;
  18936. var config = this.config;
  18937. var dataSource = config.dataSource;
  18938. if (config.autoLoad) {
  18939. if (config.dataSourceCallbackFn) {
  18940. me.reload();
  18941. }
  18942. else if (_$2.isPlainObject(dataSource)) {
  18943. me.reload();
  18944. }
  18945. }
  18946. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18947. var vm = this.lookupViewModel();
  18948. this.contextMenu = this.add(new Ext.menu.Menu({
  18949. viewModel: vm,
  18950. items: _$2.map(config.tbar, function (item) {
  18951. var menuItem = __assign({}, item);
  18952. if (menuItem.xtype === 'button') {
  18953. delete menuItem.xtype;
  18954. }
  18955. return menuItem;
  18956. })
  18957. }));
  18958. }
  18959. else if (_$2.isPlainObject(config.contextMenu)) {
  18960. this.contextMenu = this.add(config.contextMenu);
  18961. }
  18962. var $dom = $(sender.el.dom);
  18963. $dom.on('keydown', function (e) {
  18964. me.fireEvent('keydown', me, e);
  18965. }).on('keyup', function (e) {
  18966. me.fireEvent('keyup', me, e);
  18967. });
  18968. // 默认显示提示
  18969. if (this.cellTip) {
  18970. this.tip = Ext.create('Ext.tip.ToolTip', {
  18971. target: this.el,
  18972. delegate: '.x-grid-cell-inner',
  18973. trackMouse: true,
  18974. ancor: 'top',
  18975. style: 'background-color: #0D6EFD;',
  18976. listeners: {
  18977. beforeshow: function (tip) {
  18978. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18979. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18980. return false;
  18981. }
  18982. tip.update(tipText);
  18983. }
  18984. }
  18985. });
  18986. }
  18987. },
  18988. itemcontextmenu: function (view, rec, node, index, e) {
  18989. if (this.contextMenu) {
  18990. e.stopEvent();
  18991. this.contextMenu.show().setLocalXY(e.getXY());
  18992. return false;
  18993. }
  18994. },
  18995. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  18996. // this.setColumnConfigCache()
  18997. // },
  18998. // columnhide(sender, column, eOpts) {
  18999. // this.setColumnConfigCache()
  19000. // },
  19001. // columnshow(sender, column, eOpts) {
  19002. // this.setColumnConfigCache()
  19003. // },
  19004. // columnresize(sender, column, width, eOpts) {
  19005. // this.setColumnConfigCache()
  19006. // },
  19007. destory: function () {
  19008. },
  19009. selectionchange: function (sender, param) {
  19010. var record = undefined;
  19011. if (_$2.isArray(param)) {
  19012. record = param[0];
  19013. }
  19014. else if (_$2.isObject(param)) {
  19015. record = _$2.get(param, 'endCell.record');
  19016. }
  19017. itemselectFun(this, sender, record);
  19018. },
  19019. itemclick: function (sender, record) {
  19020. itemselectFun(this, sender, record);
  19021. },
  19022. show: function (sender) {
  19023. if (sender.__suspendReload) {
  19024. sender.__suspendReload = false;
  19025. sender.reload();
  19026. }
  19027. }
  19028. });
  19029. _$2.defer(function () {
  19030. var ce = _this.findPlugin('cellediting');
  19031. ce.on({
  19032. beforeedit: function (editor, context, eOpts) {
  19033. me.fireEvent('editbefore', me, editor, context, eOpts);
  19034. },
  19035. canceledit: function (editor, context, eOpts) {
  19036. me.fireEvent('editcancel', me, editor, context, eOpts);
  19037. },
  19038. edit: function (editor, context, eOpts) {
  19039. me.fireEvent('editfinish', me, editor, context, eOpts);
  19040. },
  19041. validateedit: function (editor, context, eOpts) {
  19042. me.fireEvent('editvalidate', me, editor, context, eOpts);
  19043. },
  19044. });
  19045. });
  19046. var itemselectFun = _$2.debounce(function (me, sender, record) {
  19047. var reference = me.reference;
  19048. var scope = lookupScope(me);
  19049. var theid = _$2.get(config, 'behavior.theid');
  19050. if (theid && reference) {
  19051. if (!record) {
  19052. scope.viewModel.set(reference + '.theid', null);
  19053. }
  19054. else {
  19055. scope.viewModel.set(reference + '.theid', record.get(theid));
  19056. }
  19057. }
  19058. var theid2 = _$2.get(config, 'behavior.theid2');
  19059. if (theid2 && reference) {
  19060. if (!record) {
  19061. scope.viewModel.set(reference + '.theid2', null);
  19062. }
  19063. else {
  19064. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  19065. }
  19066. }
  19067. var theid3 = _$2.get(config, 'behavior.theid3');
  19068. if (theid3 && reference) {
  19069. if (!record) {
  19070. scope.viewModel.set(reference + '.theid3', null);
  19071. }
  19072. else {
  19073. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  19074. }
  19075. }
  19076. me.fireEvent('itemselect', sender, record);
  19077. }, 50);
  19078. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  19079. // 为 stores.proxy.buildRequest 做准备
  19080. this.store.proxy.$owner = this;
  19081. }
  19082. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  19083. if (selectToReload) {
  19084. // 点击后触发某个目标表格刷新
  19085. this.on({
  19086. itemselect: function (sender) {
  19087. if (_$2.isArray(selectToReload)) {
  19088. _$2.forEach(selectToReload, function (ref) {
  19089. if (ref) {
  19090. var ctlTarget = scope.refs[ref];
  19091. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19092. if (ctlTarget.isVisible()) {
  19093. ctlTarget.reload();
  19094. }
  19095. else {
  19096. ctlTarget.__suspendReload = true;
  19097. }
  19098. }
  19099. }
  19100. });
  19101. }
  19102. else if (_$2.isString(selectToReload)) {
  19103. var ctlTarget = scope.refs[selectToReload];
  19104. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19105. ctlTarget.reload();
  19106. }
  19107. }
  19108. }
  19109. });
  19110. }
  19111. this.superclass.initComponent.call(this);
  19112. },
  19113. // 生成列自定义的缓存key
  19114. makeColumnConfigCacheKey: function (config) {
  19115. var _a, _b, _c, _d, _e, _f;
  19116. 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);
  19117. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19118. if (config.reference) {
  19119. key += config.reference;
  19120. }
  19121. else {
  19122. var subKey = "";
  19123. for (var i = 0; i < config.columns.length; i++) {
  19124. var column = config.columns[i];
  19125. if (column.dataIndex) {
  19126. subKey += column.dataIndex;
  19127. }
  19128. }
  19129. key += subKey;
  19130. }
  19131. return key;
  19132. },
  19133. getColumnConfigCache: function () {
  19134. var key = this.columnConfigCacheKey;
  19135. var dataStr = localStorage.getItem(key);
  19136. if (dataStr) {
  19137. return JSON.parse(dataStr);
  19138. }
  19139. return "";
  19140. },
  19141. setColumnConfigCache: function () {
  19142. var key = this.columnConfigCacheKey;
  19143. var cacheData = [];
  19144. var columns = this.headerCt.getGridColumns();
  19145. var index = 0;
  19146. for (var i = 0; i < columns.length; i++) {
  19147. var column = columns[i];
  19148. if (column.dataIndex) {
  19149. cacheData.push({
  19150. dataIndex: column.dataIndex,
  19151. width: column.width,
  19152. hidden: column.hidden,
  19153. locked: column.locked,
  19154. index: index
  19155. });
  19156. index++;
  19157. }
  19158. }
  19159. localStorage.setItem(key, JSON.stringify(cacheData));
  19160. },
  19161. autoSizeColumns: function (sender) {
  19162. var grid = sender ? sender.up('grid') : this;
  19163. // const columns = grid.columns;
  19164. // for (let i = 0; i < columns.length; i++) {
  19165. // const column = columns[i];
  19166. // grid.getView().autoSizeColumn(column);
  19167. // column.setWidth(column.getWidth() + 5);
  19168. // }
  19169. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19170. grid.headerCt.getGridColumns()[i].autoSize(i);
  19171. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19172. }
  19173. },
  19174. clearFilter: function (sender) {
  19175. var grid = sender.up('grid');
  19176. grid.filters.clearFilters();
  19177. grid.getStore().sorters.removeAll();
  19178. // grid.getStore().reload()
  19179. },
  19180. saveGridUIConfig: function (sender) {
  19181. var grid = sender.up('grid');
  19182. grid.setColumnConfigCache();
  19183. msg('保存设置成功!');
  19184. },
  19185. clearGridUIConfig: function (sender) {
  19186. var grid = sender.up('grid');
  19187. var key = grid.columnConfigCacheKey;
  19188. localStorage.setItem(key, "");
  19189. msg('清空设置成功,重新打开后生效!');
  19190. },
  19191. setLoading: function (value) {
  19192. if (value) {
  19193. this.mask('读取中');
  19194. }
  19195. else {
  19196. this.unmask();
  19197. }
  19198. },
  19199. exportExcel: function (sender) {
  19200. var rect = sender.btnEl.dom.getBoundingClientRect();
  19201. var scope = lookupScope(this);
  19202. var grid = sender.up('grid');
  19203. var treeMenu = new Ext.menu.Menu({
  19204. xtype: 'menu',
  19205. floated: false,
  19206. width: 300,
  19207. docked: 'left',
  19208. items: [
  19209. {
  19210. text: '大批量导出 (需要客户端支持!)',
  19211. iconCls: 'x-fa fa-download',
  19212. listeners: {
  19213. click: function (sender, value) {
  19214. // @ts-ignore
  19215. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19216. .then(function (res) {
  19217. grid.exportBigExcelClick();
  19218. });
  19219. }
  19220. }
  19221. },
  19222. '-',
  19223. {
  19224. text: '导出当前数据',
  19225. iconCls: 'x-fa fa-download',
  19226. listeners: {
  19227. click: function (sender, value) {
  19228. grid.exportCurrentExcelClick();
  19229. }
  19230. }
  19231. },
  19232. {
  19233. xtype: "textfield",
  19234. fieldLabel: '当前导出页',
  19235. maskRe: /[0-9]/,
  19236. value: grid.exportExcelCurrentPage,
  19237. listeners: {
  19238. render: function (sender) {
  19239. grid.exportExcelCurrentPageCmp = sender;
  19240. },
  19241. change: function (sender, value) {
  19242. var v = parseInt(value);
  19243. if (isNaN(v) || v === 0) {
  19244. window['system'].msg("页码不能为0");
  19245. v = 1;
  19246. sender.setValue(v);
  19247. }
  19248. var size = parseInt(grid.exportExcelPageSize);
  19249. var total = parseInt(grid.exportExcelTotal);
  19250. if (v > total / size) {
  19251. v = parseInt(total / size + "");
  19252. }
  19253. grid.exportExcelCurrentPage = v + "";
  19254. }
  19255. }
  19256. },
  19257. {
  19258. xtype: "textfield",
  19259. fieldLabel: '导出页大小',
  19260. maskRe: /[0-9]/,
  19261. value: grid.exportExcelPageSize,
  19262. listeners: {
  19263. render: function (sender) {
  19264. grid.exportExcelPageSizeCmp = sender;
  19265. },
  19266. change: function (sender, value) {
  19267. var v = parseInt(value);
  19268. if (isNaN(v) || v === 0) {
  19269. window['system'].msg("导出页大小不能为0");
  19270. v = defaultGrid.exportExcelPageSize;
  19271. sender.setValue(v);
  19272. }
  19273. if (v > 10000) {
  19274. window['system'].msg("导出页大小不能大于10000");
  19275. v = 10000;
  19276. sender.setValue(v);
  19277. }
  19278. var page = parseInt(grid.exportExcelCurrentPage);
  19279. var total = parseInt(grid.exportExcelTotal);
  19280. if (page > total / v) {
  19281. page = parseInt(total / v + "") + 1;
  19282. grid.exportExcelCurrentPageCmp.setValue(page);
  19283. }
  19284. grid.exportExcelPageSize = v + "";
  19285. }
  19286. }
  19287. },
  19288. {
  19289. xtype: "textfield",
  19290. fieldLabel: '总条数',
  19291. value: grid.exportExcelTotal,
  19292. readOnly: true
  19293. },
  19294. {
  19295. text: '导出',
  19296. iconCls: 'x-fa fa-download',
  19297. listeners: {
  19298. click: function (sender, value) {
  19299. grid.exportExcelClick({
  19300. exportExcelPageSize: grid.exportExcelPageSize,
  19301. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19302. });
  19303. }
  19304. }
  19305. },
  19306. ]
  19307. });
  19308. treeMenu.showAt(rect.left, rect.top - 120);
  19309. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19310. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19311. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19312. // }
  19313. },
  19314. /**
  19315. * 获取表格编辑的行数据
  19316. */
  19317. getGridEditRows: function () {
  19318. var grid = this;
  19319. var store = grid.getStore();
  19320. var rows = [];
  19321. var modifyRows = [];
  19322. var newRows = [];
  19323. var err = "";
  19324. var records = store.getModifiedRecords();
  19325. var newRecords = store.getNewRecords();
  19326. var removeRecords = [];
  19327. _$2.forEach(store.getRemovedRecords(), function (row) {
  19328. removeRecords.push(row.data);
  19329. });
  19330. _$2.forEach(records, function (record) {
  19331. var colums = grid.columns;
  19332. var errFunc = undefined;
  19333. _$2.forEach(colums, function (col) {
  19334. var name = col.dataIndex;
  19335. var value = record.data[name];
  19336. var colIndex = col.getIndex(); //获得列号
  19337. var rowIndex = store.indexOfId(record.id); //获得行号
  19338. var editor = col.getEditor(); //使用的编辑器
  19339. var tmpErrFunc = function () {
  19340. var text = col.text || col.name;
  19341. msg(text + ' 校验失败, 请确保输入的数据正确');
  19342. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19343. };
  19344. if (editor && !editor.allowBlank && isEmpty(value)) {
  19345. errFunc = tmpErrFunc;
  19346. return false;
  19347. }
  19348. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19349. errFunc = tmpErrFunc;
  19350. return false;
  19351. }
  19352. });
  19353. if (typeof errFunc === 'function') {
  19354. err = "1";
  19355. _$2.remove(rows, function (n) {
  19356. return true;
  19357. });
  19358. //@ts-ignore
  19359. errFunc();
  19360. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19361. return false;
  19362. }
  19363. else {
  19364. if (_$2.findIndex(newRecords, function (item) {
  19365. return item === record;
  19366. }) >= 0) {
  19367. newRows.push(record.data);
  19368. }
  19369. else {
  19370. modifyRows.push(record.data);
  19371. }
  19372. rows.push(record.data);
  19373. }
  19374. });
  19375. return {
  19376. rows: rows,
  19377. newRows: newRows,
  19378. modifyRows: modifyRows,
  19379. removeRecords: removeRecords,
  19380. err: err
  19381. };
  19382. }
  19383. // reload() {
  19384. // dataSourceReload(this)
  19385. // },
  19386. });
  19387. }
  19388. /**
  19389. * 获取 columns 中所有的 dataIndex
  19390. */
  19391. function getFileds(newConfig) {
  19392. var fields = [];
  19393. _$2.forEach(newConfig.columns, function (c) {
  19394. if (c.dataIndex) {
  19395. fields.push(c.dataIndex);
  19396. }
  19397. });
  19398. return fields;
  19399. }
  19400. function convertDataSource$1(sender, scope, newConfig) {
  19401. if (typeof newConfig.store !== 'undefined') {
  19402. // 有 store 属性的情况下,不做任何事
  19403. return;
  19404. }
  19405. if (typeof newConfig.dataSource === 'undefined') {
  19406. // 没有定义 dataSource 的情况下,不做任何事
  19407. return;
  19408. }
  19409. if (_$2.isArray(newConfig.data)) {
  19410. // 有 data 属性赋值的情况下
  19411. newConfig.store = {
  19412. fields: getFileds(newConfig),
  19413. data: newConfig.data
  19414. };
  19415. delete newConfig.data;
  19416. return;
  19417. }
  19418. var dataSource = newConfig.dataSource;
  19419. if (typeof dataSource === 'string') {
  19420. // dataSource 是字符串的情况下,找到成员函数
  19421. dataSource = lookupFn(scope, dataSource);
  19422. }
  19423. if (typeof dataSource === 'function') {
  19424. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19425. newConfig.store = new Ext.data.Store({
  19426. fields: getFileds(newConfig),
  19427. // data: [],
  19428. autoLoad: true,
  19429. proxy: {
  19430. type: 'memory',
  19431. data: [],
  19432. }
  19433. });
  19434. newConfig.dataSourceCallbackFn = dataSource;
  19435. return;
  19436. }
  19437. // throw new TypeError('无法识别的调用方法')
  19438. }
  19439. //# sourceMappingURL=grid.js.map
  19440. function initTextfield () {
  19441. var cc = Ext.form.field.Text.prototype.constructor;
  19442. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19443. Ext.form.field.Text.override({
  19444. constructor: function (config) {
  19445. var newConfig = _$2.defaultsDeep({
  19446. // 强制属性
  19447. triggers: {
  19448. clear: {
  19449. weight: -1,
  19450. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19451. hidden: true,
  19452. handler: 'onClearClick',
  19453. },
  19454. }
  19455. }, baseConfig(config, 'col-item'), config, text);
  19456. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19457. newConfig.enableKeyEvents = true;
  19458. }
  19459. cc.call(this, newConfig);
  19460. },
  19461. /**
  19462. * 清空所有值
  19463. */
  19464. onClearClick: function (sender, e) {
  19465. var me = this;
  19466. me.setValue('');
  19467. },
  19468. /**
  19469. * 尝试获取下一个要获取焦点的控件
  19470. */
  19471. _raiseNextFocus: function (sender) {
  19472. var config = sender.config;
  19473. var scope = lookupScope(sender);
  19474. if (typeof config.nextFocus === 'function') {
  19475. config.nextFocus(sender);
  19476. }
  19477. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19478. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19479. var fn = lookupFn(scope, config.nextFocus);
  19480. if (typeof fn === 'function') {
  19481. var nextCtlReference = fn(sender);
  19482. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19483. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19484. if (ctl) {
  19485. if (typeof ctl.focus2 === 'function') {
  19486. ctl.focus2();
  19487. }
  19488. else {
  19489. ctl.focus();
  19490. }
  19491. }
  19492. }
  19493. }
  19494. }
  19495. else {
  19496. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19497. if (ctl) {
  19498. if (typeof ctl.focus2 === 'function') {
  19499. ctl.focus2();
  19500. }
  19501. else {
  19502. ctl.focus();
  19503. }
  19504. }
  19505. }
  19506. }
  19507. },
  19508. initComponent: function () {
  19509. /**
  19510. * 改变必填项之前加星号
  19511. */
  19512. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19513. // this.beforeLabelTextTpl = [
  19514. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19515. // ];
  19516. this.afterLabelTextTpl = [
  19517. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19518. ];
  19519. }
  19520. var me = this;
  19521. this.on({
  19522. change: function (sender, newVal) {
  19523. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19524. if (hideTrigger || disabled || readOnly || hideClear) {
  19525. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19526. return;
  19527. }
  19528. var value = newVal;
  19529. if (value) {
  19530. me.getTrigger('clear').show();
  19531. me.updateLayout();
  19532. }
  19533. else {
  19534. me.getTrigger('clear').hide();
  19535. me.updateLayout();
  19536. }
  19537. },
  19538. afterrender: function (sender) {
  19539. var _this = this;
  19540. var _a;
  19541. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19542. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19543. $$2(sender.inputEl.dom).on('click', function (e) {
  19544. sender.fireEvent('click', _this, e);
  19545. });
  19546. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19547. var _a, _b, _c, _d;
  19548. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19549. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19550. if (sender.isExpanded === true) {
  19551. // 弹开下拉框的基础上,不干预上下选择
  19552. return;
  19553. }
  19554. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19555. var grid = sender.ownerCt.up('grid');
  19556. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19557. if (editingPlugin) {
  19558. 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;
  19559. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19560. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19561. // editingPlugin
  19562. var targetRecord = void 0;
  19563. if (e.code === 'ArrowDown') {
  19564. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19565. }
  19566. else {
  19567. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19568. }
  19569. if (targetRecord) {
  19570. grid.setSelection([targetRecord]);
  19571. editingPlugin.startEdit(targetRecord, column);
  19572. }
  19573. e.stopPropagation();
  19574. e.preventDefault();
  19575. }
  19576. }
  19577. }
  19578. }
  19579. });
  19580. }
  19581. var config = sender.config;
  19582. if (config.ff && config.ff > 0) {
  19583. setTimeout(function () {
  19584. if (typeof sender.focus2 === 'function') {
  19585. sender.focus2();
  19586. }
  19587. else {
  19588. sender.focus();
  19589. }
  19590. }, config.ff);
  19591. }
  19592. }
  19593. });
  19594. var config = this.config;
  19595. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19596. this.on({
  19597. keyup: function (sender, e) {
  19598. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19599. sender._raiseNextFocus(sender);
  19600. }
  19601. }
  19602. });
  19603. }
  19604. var that = this;
  19605. this.on({
  19606. keyup: function (sender, e, eOpts) {
  19607. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19608. return;
  19609. }
  19610. that.keydown_fun_item(sender, e, eOpts);
  19611. }
  19612. });
  19613. initComponent.call(this);
  19614. },
  19615. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19616. var that = sender;
  19617. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19618. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19619. var value = _$2.trim(sender.rawValue);
  19620. var r = that.fireEvent('scancode', that, value, event);
  19621. if (r === 'OK') {
  19622. // 停止事件的默认处理程序,停止事件的冒泡
  19623. // event.stopEvent();
  19624. event.preventDefault();
  19625. event.stopPropagation();
  19626. }
  19627. }
  19628. }, 100)
  19629. });
  19630. }
  19631. //# sourceMappingURL=textfield.js.map
  19632. function initTbFill () {
  19633. /**
  19634. *
  19635. */
  19636. var ct = Ext.toolbar.Fill.prototype.constructor;
  19637. Ext.toolbar.Fill.override({
  19638. constructor: function (config) {
  19639. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19640. ct.call(this, newConfig);
  19641. }
  19642. });
  19643. }
  19644. //# sourceMappingURL=tbfill.js.map
  19645. function initTbSeparator () {
  19646. /**
  19647. *
  19648. */
  19649. var ct = Ext.toolbar.Separator.prototype.constructor;
  19650. Ext.toolbar.Separator.override({
  19651. constructor: function (config) {
  19652. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19653. ct.call(this, newConfig);
  19654. }
  19655. });
  19656. }
  19657. //# sourceMappingURL=tbseparator.js.map
  19658. function initToolbar () {
  19659. /**
  19660. *
  19661. */
  19662. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19663. Ext.toolbar.Toolbar.override({
  19664. constructor: function (config) {
  19665. var newConfig = _$2.defaultsDeep({
  19666. // 强制性属性
  19667. }, baseConfig(config, 'cols-container'), config, toolbar);
  19668. ct.call(this, newConfig);
  19669. }
  19670. });
  19671. initTbFill();
  19672. initTbSeparator();
  19673. }
  19674. //# sourceMappingURL=toolbar.js.map
  19675. function initSplitter () {
  19676. var ct = Ext.resizer.Splitter.prototype.constructor;
  19677. Ext.resizer.Splitter.override({
  19678. constructor: function (config) {
  19679. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19680. ct.call(this, newConfig);
  19681. }
  19682. });
  19683. }
  19684. //# sourceMappingURL=splitter.js.map
  19685. /**
  19686. * 通用 dataSource 解析,
  19687. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19688. */
  19689. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19690. var config = ctl.config;
  19691. return new Promise(function (resolve, reject) {
  19692. if (!config.dataSource) {
  19693. // 没有设置数据源,直接置空
  19694. return Promise.resolve();
  19695. }
  19696. var option = {
  19697. extraParam: extraParam,
  19698. _successCb: _successCb,
  19699. successCallback: function (value) {
  19700. if (typeof successCallback === "function") {
  19701. successCallback(value);
  19702. }
  19703. else {
  19704. ctl.setData(value);
  19705. }
  19706. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19707. ctl.setLoading(false);
  19708. resolve(value);
  19709. },
  19710. failCallback: function (error) {
  19711. if (typeof failCallback === "function") {
  19712. failCallback(error);
  19713. }
  19714. ctl.fireEvent('dataLoadComplete', ctl, false);
  19715. ctl.setLoading(false);
  19716. reject(error);
  19717. }
  19718. };
  19719. // 请求前要求确认一下
  19720. var isCanceled = false;
  19721. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19722. isCanceled = true;
  19723. } }, option));
  19724. if (!isCanceled) {
  19725. // 请求没有被取消
  19726. // 调用异步接口返回 Promise
  19727. return _innerReload(ctl, option);
  19728. }
  19729. return reject();
  19730. });
  19731. }
  19732. function _innerReload(ctl, option) {
  19733. var config = ctl.config;
  19734. ctl.setLoading(true);
  19735. var scope = lookupScope(ctl);
  19736. var dataSource = config.dataSource;
  19737. if (typeof dataSource == 'string') {
  19738. dataSource = lookupFn(scope, config.dataSource);
  19739. }
  19740. if (typeof dataSource === 'function') {
  19741. // @ts-ignore
  19742. dataSource.call(scope, ctl, option);
  19743. return;
  19744. }
  19745. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19746. if (!ajax.func) {
  19747. console.error("没有配置 ajax");
  19748. return;
  19749. }
  19750. var params_1 = {};
  19751. var sortModel = null;
  19752. var filterModel = null;
  19753. if (option.extraParam && option.extraParam.filterModel) {
  19754. filterModel = option.extraParam.filterModel;
  19755. }
  19756. if (option.extraParam && option.extraParam.sortModel) {
  19757. sortModel = option.extraParam.sortModel;
  19758. }
  19759. _$2.forOwn(option.extraParam, function (v, key) {
  19760. if (key != "filterModel" && key != "sortModel") {
  19761. if (typeof v === 'function') {
  19762. params_1[key] = v();
  19763. }
  19764. else {
  19765. params_1[key] = v;
  19766. }
  19767. }
  19768. });
  19769. var ds = dataSource;
  19770. _$2.forOwn(ds.params, function (v, key) {
  19771. if (typeof v === 'function') {
  19772. params_1[key] = v();
  19773. }
  19774. else {
  19775. params_1[key] = v;
  19776. }
  19777. });
  19778. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19779. // @ts-ignore
  19780. ajax.func({
  19781. method: dataSource.method,
  19782. url: ds.url,
  19783. data: params_1,
  19784. filterModel: filterModel,
  19785. sortModel: sortModel,
  19786. }).then(function (res) {
  19787. if (res.success) {
  19788. option.successCallback(res.data);
  19789. }
  19790. else {
  19791. option.failCallback(res.msg);
  19792. }
  19793. }).catch(function (e) {
  19794. option.failCallback(e);
  19795. });
  19796. }
  19797. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19798. var ds_1 = ctl.dataSource;
  19799. // @ts-ignore
  19800. Extend.ajax.func({
  19801. url: ds_1.sqlId,
  19802. data: params_1,
  19803. db: ds_1.db,
  19804. method: 'sql',
  19805. filterModel: filterModel,
  19806. sortModel: sortModel,
  19807. }).then(function (res) {
  19808. if (res.success) {
  19809. option.successCallback(res.data);
  19810. }
  19811. else {
  19812. option.failCallback(res.msg);
  19813. }
  19814. }).catch(function (e) {
  19815. option.failCallback(e);
  19816. }).finally(function () {
  19817. ctl.loading = false;
  19818. });
  19819. return;
  19820. }
  19821. else {
  19822. console.error("非法的 dataSource", ctl.dataSource);
  19823. debugger;
  19824. throw new Error("非法的 dataSource");
  19825. }
  19826. }
  19827. }
  19828. //# sourceMappingURL=DataSourceHelper.js.map
  19829. function initCombo () {
  19830. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19831. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19832. Ext.form.field.ComboBox.override({
  19833. constructor: function (config) {
  19834. var newConfig = _$2.defaultsDeep({
  19835. // 强制性属性
  19836. }, baseConfig(config, 'col-item'), config, combo);
  19837. if (typeof config.dict === 'string') {
  19838. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19839. }
  19840. else if (typeof newConfig.store == 'undefined') {
  19841. if (_$2.isArray(newConfig.data)) {
  19842. // ExtJS 无法直接接受数组模式
  19843. newConfig.store = {
  19844. fields: [newConfig.valueField, newConfig.displayField],
  19845. data: newConfig.data
  19846. };
  19847. delete newConfig.data;
  19848. }
  19849. else if (typeof newConfig.data !== 'object') {
  19850. newConfig.store = {
  19851. fields: [newConfig.valueField, newConfig.displayField],
  19852. data: []
  19853. };
  19854. delete newConfig.data;
  19855. }
  19856. }
  19857. cc.call(this, newConfig);
  19858. },
  19859. setDict: function (bizKey) {
  19860. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19861. this.dict = bizKey;
  19862. },
  19863. getDict: function () {
  19864. return this.dict;
  19865. },
  19866. setData: function (value) {
  19867. if (!value) {
  19868. return;
  19869. }
  19870. var config = value.config;
  19871. if (!this.store) {
  19872. this.store = new Ext.data.Store({
  19873. fields: [config.valueField, config.displayField],
  19874. data: value
  19875. });
  19876. }
  19877. else {
  19878. this.store.getProxy().setData(value);
  19879. this.store.load();
  19880. }
  19881. },
  19882. setLoading: function (value) {
  19883. if (value) {
  19884. if (!this.loadMask) {
  19885. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19886. }
  19887. }
  19888. else {
  19889. if (this.loadMask) {
  19890. this.loadMask.destroy();
  19891. delete this.loadMask;
  19892. }
  19893. }
  19894. },
  19895. reload: function () {
  19896. dataSourceReload(this);
  19897. },
  19898. initComponent: function () {
  19899. var that = this;
  19900. var toggle = function (e) {
  19901. var readOnly = that.readOnly, disabled = that.disabled;
  19902. if (readOnly || disabled) {
  19903. return;
  19904. }
  19905. if ($(e.target).is('.x-form-trigger')) {
  19906. return;
  19907. }
  19908. // 点击后下拉
  19909. if (that.isExpanded) {
  19910. that.collapse();
  19911. }
  19912. else {
  19913. that.expand();
  19914. that.doQuery(that.allQuery, true);
  19915. }
  19916. };
  19917. this.on({
  19918. afterrender: function (sender) {
  19919. var config = this.config;
  19920. if (config.dataSource && config.autoLoad) {
  19921. dataSourceReload(this);
  19922. }
  19923. // 点击后下拉
  19924. $(this.el.dom).on('click', toggle.bind(this));
  19925. },
  19926. focusenter: function (sender, event, opt) {
  19927. var _a;
  19928. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19929. // 表格内编辑框,获取焦点后自动弹开
  19930. toggle.call(this, event);
  19931. }
  19932. },
  19933. destory: function () {
  19934. $(this.el.dom).off('click', toggle.bind(this));
  19935. },
  19936. beforequery: function (context) {
  19937. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19938. // console.log('beforequery', query)
  19939. if (!forceAll && query) {
  19940. combo.store.clearFilter();
  19941. combo.store.filterBy(function (record, id) {
  19942. var text = record.get(combo.displayField);
  19943. // 用拼音筛选的方式
  19944. return keywordFilter(query, text, id);
  19945. });
  19946. combo.expand();
  19947. return false;
  19948. }
  19949. combo.store.clearFilter();
  19950. combo.expand();
  19951. return false;
  19952. },
  19953. });
  19954. initComponent.call(this);
  19955. },
  19956. focus2: function () {
  19957. this.focus();
  19958. var that = this;
  19959. _$2.defer(function () {
  19960. if (that.isExpanded) {
  19961. that.collapse();
  19962. }
  19963. else {
  19964. that.expand();
  19965. that.doQuery(that.allQuery, true);
  19966. }
  19967. });
  19968. }
  19969. });
  19970. }
  19971. //# sourceMappingURL=combo.js.map
  19972. /**
  19973. xtype: 'tagfield',
  19974. displayField: 'show',
  19975. valueField: 'id',
  19976. queryMode: 'local',
  19977. filterPickList: true,
  19978. store: {
  19979. fields: ['id', 'show'],
  19980. data: [
  19981. {id: 0, show: 'Battlestar Galactica'},
  19982. {id: 1, show: 'Doctor Who'},
  19983. {id: 2, show: 'Farscape'},
  19984. {id: 3, show: 'Firefly'},
  19985. {id: 4, show: 'Star Trek'},
  19986. {id: 5, show: 'Star Wars: Christmas Special'}
  19987. ]
  19988. }
  19989. */
  19990. function initTag () {
  19991. var cc = Ext.form.field.Tag.prototype.constructor;
  19992. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19993. Ext.form.field.Tag.override({
  19994. constructor: function (config) {
  19995. var newConfig = _$2.defaultsDeep({
  19996. // 强制性属性
  19997. }, baseConfig(config, 'col-item'), config, tagfield);
  19998. if (typeof config.dict === 'string') {
  19999. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  20000. }
  20001. else if (typeof newConfig.store == 'undefined') {
  20002. if (_$2.isArray(newConfig.data)) {
  20003. // ExtJS 无法直接接受数组模式
  20004. newConfig.store = {
  20005. fields: [newConfig.valueField, newConfig.displayField],
  20006. data: newConfig.data
  20007. };
  20008. delete newConfig.data;
  20009. }
  20010. else if (typeof newConfig.data !== 'object') {
  20011. newConfig.store = {
  20012. fields: [newConfig.valueField, newConfig.displayField],
  20013. data: []
  20014. };
  20015. delete newConfig.data;
  20016. }
  20017. }
  20018. cc.call(this, newConfig);
  20019. },
  20020. setDict: function (bizKey) {
  20021. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20022. this.dict = bizKey;
  20023. },
  20024. getDict: function () {
  20025. return this.dict;
  20026. },
  20027. setData: function (value) {
  20028. if (!value) {
  20029. return;
  20030. }
  20031. var config = value.config;
  20032. if (!this.store) {
  20033. this.store = new Ext.data.Store({
  20034. fields: [config.valueField, config.displayField],
  20035. data: value
  20036. });
  20037. }
  20038. else {
  20039. this.store.getProxy().setData(value);
  20040. this.store.load();
  20041. }
  20042. },
  20043. setLoading: function (value) {
  20044. if (value) {
  20045. if (!this.loadMask) {
  20046. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20047. }
  20048. }
  20049. else {
  20050. if (this.loadMask) {
  20051. this.loadMask.destroy();
  20052. delete this.loadMask;
  20053. }
  20054. }
  20055. },
  20056. reload: function () {
  20057. dataSourceReload(this);
  20058. },
  20059. initComponent: function () {
  20060. var that = this;
  20061. var toggle = function (e) {
  20062. var readOnly = that.readOnly, disabled = that.disabled;
  20063. if (readOnly || disabled) {
  20064. return;
  20065. }
  20066. if ($(e.target).is('.x-form-trigger')) {
  20067. return;
  20068. }
  20069. // 点击后下拉
  20070. if (that.isExpanded) {
  20071. that.collapse();
  20072. }
  20073. else {
  20074. that.expand();
  20075. that.doQuery(that.allQuery, true);
  20076. }
  20077. };
  20078. this.on({
  20079. afterrender: function (sender) {
  20080. var config = this.config;
  20081. if (config.dataSource && config.autoLoad) {
  20082. dataSourceReload(this);
  20083. }
  20084. // 点击后下拉
  20085. $(this.el.dom).on('click', toggle.bind(this));
  20086. },
  20087. focusenter: function (sender, event, opt) {
  20088. var _a;
  20089. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20090. // 表格内编辑框,获取焦点后自动弹开
  20091. toggle.call(this, event);
  20092. }
  20093. },
  20094. destory: function () {
  20095. $(this.el.dom).off('click', toggle.bind(this));
  20096. },
  20097. });
  20098. initComponent.call(this);
  20099. },
  20100. focus2: function () {
  20101. this.focus();
  20102. var that = this;
  20103. _$2.defer(function () {
  20104. if (that.isExpanded) {
  20105. that.collapse();
  20106. }
  20107. else {
  20108. that.expand();
  20109. that.doQuery(that.allQuery, true);
  20110. }
  20111. });
  20112. }
  20113. });
  20114. }
  20115. //# sourceMappingURL=tagfield.js.map
  20116. function initComboGridMulti () {
  20117. Ext.define('Yvan.LocalComboGrid', {
  20118. extend: 'Ext.form.field.Picker',
  20119. // extend: 'Yvan.PickerAlignCenter',
  20120. xtype: 'combogridmulti',
  20121. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20122. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20123. editable: false,
  20124. initComponent: function () {
  20125. this.on({
  20126. afterrender: function () {
  20127. var config = this.config;
  20128. if (config.dataSource && config.autoLoad) {
  20129. dataSourceReload(this);
  20130. }
  20131. },
  20132. });
  20133. this.superclass.initComponent.apply(this, arguments);
  20134. },
  20135. setStore: function (store) {
  20136. this.store = store;
  20137. var me = this;
  20138. if (me.store) {
  20139. if (me.picker) {
  20140. me.picker.setStore(store);
  20141. if (me.isExpanded) {
  20142. me.collapse();
  20143. delete me.picker;
  20144. me.expand();
  20145. }
  20146. }
  20147. this.onLoad();
  20148. me.mon(me.store, {
  20149. scope: me,
  20150. load: me.onLoad,
  20151. update: me.onUpdate
  20152. });
  20153. }
  20154. },
  20155. reload: function () {
  20156. dataSourceReload(this);
  20157. },
  20158. setData: function (value) {
  20159. var me = this;
  20160. var config = me.config;
  20161. if (!value) {
  20162. return;
  20163. }
  20164. if (!this.store) {
  20165. this.store = new Ext.data.Store({
  20166. fields: [config.valueField, config.displayField],
  20167. data: value
  20168. });
  20169. }
  20170. else {
  20171. this.store.getProxy().setData(value);
  20172. this.store.load();
  20173. }
  20174. this.onLoad();
  20175. },
  20176. createPicker: function () {
  20177. var me = this;
  20178. 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: {
  20179. scope: me,
  20180. selectionchange: me.onSelectionChange,
  20181. itemkeydown: me.onPickerKeyDown
  20182. } })), view = picker.getView();
  20183. if (Ext.isIE9 && Ext.isStrict) {
  20184. view.on({
  20185. scope: me,
  20186. highlightitem: me.repaintPickerView,
  20187. unhighlightitem: me.repaintPickerView,
  20188. afteritemexpand: me.repaintPickerView,
  20189. afteritemcollapse: me.repaintPickerView
  20190. });
  20191. }
  20192. return picker;
  20193. },
  20194. repaintPickerView: function () {
  20195. var style = this.picker.getView().getEl().dom.style;
  20196. style.display = style.display;
  20197. },
  20198. onSelectionChange: function (view, record, node, rowIndex, e) {
  20199. this.selectItem(view, record);
  20200. },
  20201. onPickerKeyDown: function (treeView, record, item, index, e) {
  20202. var key = e.getKey();
  20203. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20204. this.selectItem(treeView, record);
  20205. }
  20206. },
  20207. selectItem: function (sender, record) {
  20208. var me = this;
  20209. var ids = [];
  20210. _$2.forEach(me.picker.getSelection(), function (record) {
  20211. ids.push(record.get(me.valueField));
  20212. });
  20213. me.fireEvent('select', me, record);
  20214. me.setValue(ids.join(me.splitChar));
  20215. // me.collapse();
  20216. },
  20217. onExpand: function () {
  20218. var me = this;
  20219. var picker = this.picker;
  20220. var value = this.value;
  20221. if (!me.store) {
  20222. msg('正在初始化数据,请稍后');
  20223. me.collapse();
  20224. return;
  20225. }
  20226. var vs = _$2.split(value, me.splitChar);
  20227. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20228. picker.setSelection(records);
  20229. },
  20230. setValue: function (value) {
  20231. var me = this;
  20232. console.log('setValue', value);
  20233. me.value = value;
  20234. if (!me.store || me.store.loading) {
  20235. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20236. return me.mixins.field.setValue.call(me, value);
  20237. // return me;
  20238. }
  20239. var vs = _$2.split(value, me.splitChar);
  20240. var displayValues = [];
  20241. _$2.forEach(vs, function (v) {
  20242. var _a;
  20243. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20244. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20245. if (dv) {
  20246. displayValues.push(dv);
  20247. }
  20248. else {
  20249. displayValues.push(v);
  20250. }
  20251. });
  20252. // set the raw value to the record's display field if a record was found
  20253. me.setRawValue(displayValues.join(me.splitChar));
  20254. return me.mixins.field.setValue.call(me, value);
  20255. },
  20256. getSubmitValue: function () {
  20257. return this.value;
  20258. },
  20259. getValue: function () {
  20260. return this.value;
  20261. },
  20262. onLoad: function () {
  20263. var value = this.value;
  20264. if (value) {
  20265. this.setValue(value);
  20266. }
  20267. },
  20268. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20269. var display = this.displayField;
  20270. var me = this;
  20271. if (type === 'edit' && modifiedFieldNames &&
  20272. Ext.Array.contains(modifiedFieldNames, display) &&
  20273. this.value === rec.getId()) {
  20274. me.mixins.field.setValue.call(me, this.value);
  20275. this.setRawValue(rec.get(display));
  20276. }
  20277. }
  20278. });
  20279. }
  20280. //# sourceMappingURL=combogridmulti.js.map
  20281. function initSearch () {
  20282. Ext.define('Yvan.Search', {
  20283. extend: 'Ext.form.field.Text',
  20284. alias: 'widget.searchfield',
  20285. xtype: 'searchfield',
  20286. constructor: function (config) {
  20287. var self = this;
  20288. var newConfig = _$2.defaultsDeep({
  20289. // 强制性属性
  20290. triggers: {
  20291. clear: {
  20292. weight: 0,
  20293. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20294. hidden: true,
  20295. handler: 'onClearClick',
  20296. },
  20297. search: {
  20298. weight: 1,
  20299. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20300. handler: 'onSearchClick'
  20301. },
  20302. },
  20303. listeners: {
  20304. blur: function (sender, e) {
  20305. this.revertOnblur();
  20306. },
  20307. specialkey: function (sender, e) {
  20308. var _a;
  20309. var me = this;
  20310. if (e.getKey() === e.ENTER) {
  20311. me.onSearchClick(sender, {}, e);
  20312. return;
  20313. }
  20314. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20315. },
  20316. afterrender: function (sender, e) {
  20317. var _a;
  20318. this.replaceRawInputEvent();
  20319. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20320. }
  20321. },
  20322. }, baseConfig(config, 'col-item'), config, search);
  20323. this.superclass.constructor.call(self, newConfig);
  20324. },
  20325. revertOnblur: function () {
  20326. this.setRawValue(this.lastValue);
  20327. },
  20328. onSearchClick: function (sender, vv, e) {
  20329. var me = this;
  20330. var config = me.config;
  20331. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20332. if (e) {
  20333. e.preventDefault();
  20334. e.stopPropagation();
  20335. }
  20336. this.fireEvent('search', sender, e);
  20337. if (!widget) {
  20338. return;
  20339. }
  20340. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20341. },
  20342. replaceRawInputEvent: function () {
  20343. var me = this;
  20344. var $dom = $(me.inputEl.dom);
  20345. $dom.on('input', function (e) {
  20346. stopEvent(e);
  20347. // console.log('has input', e)
  20348. });
  20349. $dom.on('keyup', function (e) {
  20350. if (e.key === "Enter") {
  20351. me.onSearchClick(me, {}, e);
  20352. return;
  20353. }
  20354. stopEvent(e);
  20355. });
  20356. $dom.on('change', function (e) {
  20357. stopEvent(e);
  20358. });
  20359. },
  20360. onChange: function (newVal, oldVal) {
  20361. var me = this;
  20362. var value = newVal;
  20363. if (value) {
  20364. me.getTrigger('clear').show();
  20365. me.updateLayout();
  20366. }
  20367. else {
  20368. me.getTrigger('clear').hide();
  20369. me.updateLayout();
  20370. }
  20371. },
  20372. /**
  20373. * 清空所有值
  20374. */
  20375. onClearClick: function (sender, e) {
  20376. var me = this;
  20377. var config = me.config;
  20378. var lookup = config.lookup;
  20379. me.setValue('');
  20380. clearViewModelByLookup(sender, lookup);
  20381. }
  20382. });
  20383. }
  20384. //# sourceMappingURL=search.js.map
  20385. function initMultipleSearch () {
  20386. Ext.define('Yvan.MultipleSearch', {
  20387. extend: 'Ext.form.field.Text',
  20388. xtype: 'multiplesearch',
  20389. bindTargert: '',
  20390. constructor: function (config) {
  20391. var _a, _b, _c, _d;
  20392. var self = this;
  20393. var newConfig = _$2.defaultsDeep({
  20394. // 强制性属性
  20395. triggers: {
  20396. clear: {
  20397. weight: 0,
  20398. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20399. hidden: true,
  20400. handler: 'onClearClick',
  20401. }
  20402. },
  20403. transformRawValue: function (o) {
  20404. return o;
  20405. },
  20406. listeners: {
  20407. specialkey: function (sender, e) {
  20408. var me = this;
  20409. if (e.getKey() === e.ENTER) {
  20410. me.fireEvent('search', me, e);
  20411. }
  20412. },
  20413. afterrender: function (sender, e) {
  20414. var _a;
  20415. this.replaceRawInputEvent();
  20416. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20417. }
  20418. },
  20419. }, baseConfig(config, 'col-item'), config, search);
  20420. this.superclass.constructor.call(self, newConfig);
  20421. 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 : '';
  20422. vv = _$2.replace(vv, "{", "");
  20423. vv = _$2.replace(vv, "}", "");
  20424. this.bindTargert = vv;
  20425. this.bindTargert = _$2.trim(this.bindTargert);
  20426. },
  20427. setBindValue: function (arrValue) {
  20428. if (this.bindTargert) {
  20429. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20430. }
  20431. },
  20432. replaceRawInputEvent: function () {
  20433. var me = this;
  20434. var $dom = $(me.inputEl.dom);
  20435. $dom.on('input', function (e) {
  20436. var _a, _b, _c, _d, _e, _f;
  20437. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20438. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20439. if (!a.endsWith(",") && a.length > 0) {
  20440. e.currentTarget.value = a + ",";
  20441. }
  20442. else {
  20443. e.currentTarget.value = a;
  20444. }
  20445. }
  20446. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20447. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20448. _$2.remove(arr, function (it) {
  20449. return !it;
  20450. });
  20451. me.setBindValue(arr);
  20452. stopEvent(e);
  20453. });
  20454. $dom.on('keyup', function (e) {
  20455. me.fireEvent('keyup', me, e);
  20456. // invokeMethod(me.config.listeners?.keyup, me, e)
  20457. stopEvent(e);
  20458. });
  20459. $dom.on('keydown', function (e) {
  20460. me.fireEvent('keydown', me, e);
  20461. // invokeMethod(me.config.listeners?.keydown, me, e)
  20462. //stopEvent(e)
  20463. });
  20464. $dom.on('change', function (e) {
  20465. stopEvent(e);
  20466. });
  20467. $dom.on('paste', function (e) {
  20468. var _a;
  20469. // @ts-ignore
  20470. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20471. var text = clipdata.getData("text/plain");
  20472. var spliter = ',';
  20473. text = text.replaceAll("\r", "");
  20474. text = text.replaceAll("\n", spliter);
  20475. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20476. var arr = text.split(spliter);
  20477. if (arr && Array.isArray(arr)) {
  20478. for (var i = 0; i < arr.length; i++) {
  20479. arr[i] = _$2.trim(arr[i]);
  20480. }
  20481. }
  20482. _$2.remove(arr, function (it) {
  20483. return !it;
  20484. });
  20485. me.setBindValue(arr);
  20486. stopEvent(e);
  20487. });
  20488. },
  20489. onChange: function (newVal, oldVal) {
  20490. var me = this;
  20491. var value = newVal;
  20492. if (value) {
  20493. me.getTrigger('clear').show();
  20494. me.updateLayout();
  20495. }
  20496. else {
  20497. me.getTrigger('clear').hide();
  20498. me.updateLayout();
  20499. }
  20500. },
  20501. /**
  20502. * 清空所有值
  20503. */
  20504. onClearClick: function (sender, e) {
  20505. var me = this;
  20506. var config = me.config;
  20507. var lookup = config.lookup;
  20508. me.setValue('');
  20509. clearViewModelByLookup(sender, lookup);
  20510. }
  20511. });
  20512. }
  20513. //# sourceMappingURL=multiplesearch.js.map
  20514. function initDate () {
  20515. var cc = Ext.form.field.Date.prototype.constructor;
  20516. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20517. Ext.form.field.Date.override({
  20518. format: 'Y-m-d',
  20519. altFormats: 'Y-m-d',
  20520. constructor: function (config) {
  20521. var newConfig = _$2.defaultsDeep({
  20522. // 强制属性
  20523. }, baseConfig(config, 'col-item'), config, date);
  20524. cc.call(this, newConfig);
  20525. },
  20526. getValue: function () {
  20527. var ov = getValue.call(this);
  20528. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20529. // console.log('cc:', nv, ov)
  20530. return nv;
  20531. },
  20532. // focus2() {
  20533. // const that = this
  20534. // if (that.isExpanded) {
  20535. // that.collapse()
  20536. //
  20537. // } else {
  20538. // that.expand();
  20539. // }
  20540. // _.defer(() => {
  20541. // that.focus()
  20542. // })
  20543. // },
  20544. initComponent: function () {
  20545. this.on({
  20546. afterrender: function () {
  20547. var config = this.config;
  20548. // 日期框,不要默认弹出
  20549. // $(this.el.dom).on('click', toggle.bind(this))
  20550. },
  20551. destory: function () {
  20552. // 日期框,不要默认弹出
  20553. // $(this.el.dom).off('click', toggle.bind(this))
  20554. },
  20555. change: {
  20556. fn: function (sender) {
  20557. if (sender.format === 'Y-m-d') {
  20558. // 年月日格式
  20559. var value = sender.getRawValue();
  20560. if (/^\d{8}$/.test(value)) {
  20561. // 8位数字,自动转换为 YYYY-MM-DD
  20562. var newValue = [
  20563. value.substr(0, 4),
  20564. value.substr(4, 2),
  20565. value.substr(6, 2)
  20566. ].join('-');
  20567. sender.setValue(newValue);
  20568. }
  20569. }
  20570. },
  20571. }
  20572. // focus: {
  20573. // // 获得焦点后自动下拉
  20574. // fn(sender) {
  20575. // sender.expand();
  20576. // this.doQuery(this.allQuery, true);
  20577. // },
  20578. // },
  20579. });
  20580. initComponent.call(this);
  20581. },
  20582. createInitialDate: function (value) {
  20583. var minValue = this.minValue, maxValue = this.maxValue;
  20584. value = value || syncDate(new Date());
  20585. if (minValue && minValue > value) {
  20586. value = minValue;
  20587. }
  20588. else if (maxValue && maxValue < value) {
  20589. value = maxValue;
  20590. }
  20591. return value;
  20592. },
  20593. });
  20594. }
  20595. //# sourceMappingURL=datefield.js.map
  20596. function initDateTimePicker () {
  20597. Ext.define('Yvan.DateTimePicker', {
  20598. extend: 'Ext.picker.Date',
  20599. alias: 'datetimepicker',
  20600. alternateClassName: 'Ext.DateTimePicker',
  20601. renderTpl: [
  20602. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20603. '<div class="{baseCls}-header">',
  20604. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20605. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20606. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20607. '</div>',
  20608. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20609. '<thead>',
  20610. '<tr role="row">',
  20611. '<tpl for="dayNames">',
  20612. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20613. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20614. '</th>',
  20615. '</tpl>',
  20616. '</tr>',
  20617. '</thead>',
  20618. '<tbody>',
  20619. '<tr role="row">',
  20620. '<tpl for="days">',
  20621. '{#:this.isEndOfWeek}',
  20622. '<td role="gridcell">',
  20623. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20624. '</td>',
  20625. '</tpl>',
  20626. '</tr>',
  20627. '</tbody>',
  20628. '</table>',
  20629. '<tpl if="showToday">',
  20630. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20631. '</tpl>',
  20632. // These elements are used with Assistive Technologies such as screen readers
  20633. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20634. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20635. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20636. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20637. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20638. '</div>',
  20639. {
  20640. firstInitial: function (value) {
  20641. return Ext.picker.Date.prototype.getDayInitial(value);
  20642. },
  20643. isEndOfWeek: function (value) {
  20644. // convert from 1 based index to 0 based
  20645. // by decrementing value once.
  20646. value--;
  20647. // eslint-disable-next-line vars-on-top
  20648. var end = value % 7 === 0 && value !== 0;
  20649. return end ? '</tr><tr role="row">' : '';
  20650. },
  20651. renderTodayBtn: function (values, out) {
  20652. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20653. },
  20654. renderMonthBtn: function (values, out) {
  20655. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20656. }
  20657. }
  20658. ],
  20659. beforeRender: function () {
  20660. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20661. this.superclass.beforeRender.call(this);
  20662. function handleInput(extHandle, $input) {
  20663. var $dom = $(extHandle.el.dom);
  20664. // const $up = $dom.find('.x-form-spinner-up')
  20665. // const $down = $dom.find('.x-form-spinner-down')
  20666. // debugger
  20667. // $up.on('mousedown', () => {
  20668. // debugger
  20669. // });
  20670. // $up.on('click', () => {
  20671. // debugger
  20672. // });
  20673. extHandle.on('click', function (sender) {
  20674. var hideBak = me.hide;
  20675. me.hide = Ext.emptyFn;
  20676. extHandle.focus();
  20677. me.hide = hideBak;
  20678. });
  20679. var changeValue = function (delta) {
  20680. if (_$2.trim(extHandle.getValue()) === '') {
  20681. extHandle.setValue(extHandle.minValue);
  20682. }
  20683. else {
  20684. var v = parseInt('' + extHandle.getValue());
  20685. if (v + delta > extHandle.maxValue) {
  20686. extHandle.setValue(extHandle.minValue);
  20687. }
  20688. else if (v + delta < extHandle.minValue) {
  20689. extHandle.setValue(extHandle.maxValue);
  20690. }
  20691. else {
  20692. extHandle.setValue(v + delta);
  20693. }
  20694. }
  20695. };
  20696. $input.on('mousewheel', function (e) {
  20697. e.stopPropagation();
  20698. var event = e.originalEvent;
  20699. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20700. // if (event.wheelDelta) {
  20701. // delta = event.wheelDelta / 120;
  20702. // } else if (event.detail) {
  20703. // delta = -event.detail / 3;
  20704. // }
  20705. var zoomSize = Math.ceil(eventDelta / 120);
  20706. changeValue(zoomSize);
  20707. // console.log('delta', delta)
  20708. // $input.focus()
  20709. });
  20710. }
  20711. me.input1 = Ext.create('Ext.form.field.Number', {
  20712. minValue: 0,
  20713. maxValue: 23,
  20714. flex: 1,
  20715. enableKeyEvents: true,
  20716. fieldLabel: '时',
  20717. labelWidth: 20,
  20718. hideLabel: true,
  20719. spinDownEnabled: false,
  20720. spinUpEnabled: false,
  20721. style: {
  20722. marginLeft: '5px',
  20723. },
  20724. listeners: {
  20725. afterrender: function (sender) {
  20726. var $input = $(sender.inputEl.dom);
  20727. handleInput(me.input1, $input);
  20728. },
  20729. change: function (sender, e) {
  20730. if (me.getValue()) {
  20731. me.value.setHours(sender.getValue());
  20732. }
  20733. },
  20734. }
  20735. });
  20736. me.input2 = Ext.create('Ext.form.field.Number', {
  20737. minValue: 0,
  20738. maxValue: 59,
  20739. flex: 1,
  20740. enableKeyEvents: true,
  20741. fieldLabel: ' ',
  20742. hideLabel: false,
  20743. labelWidth: 8,
  20744. spinDownEnabled: false,
  20745. spinUpEnabled: false,
  20746. listeners: {
  20747. afterrender: function (sender) {
  20748. var $input = $(sender.inputEl.dom);
  20749. handleInput(me.input2, $input);
  20750. },
  20751. change: function (sender, e) {
  20752. if (me.getValue()) {
  20753. me.value.setMinutes(sender.getValue());
  20754. }
  20755. },
  20756. }
  20757. });
  20758. me.input3 = Ext.create('Ext.form.field.Number', {
  20759. minValue: 0,
  20760. maxValue: 59,
  20761. flex: 1,
  20762. enableKeyEvents: true,
  20763. fieldLabel: ' ',
  20764. hideLabel: false,
  20765. labelWidth: 8,
  20766. spinDownEnabled: false,
  20767. spinUpEnabled: false,
  20768. style: {
  20769. marginRight: '5px',
  20770. },
  20771. listeners: {
  20772. afterrender: function (sender) {
  20773. var $input = $(sender.inputEl.dom);
  20774. handleInput(me.input3, $input);
  20775. },
  20776. change: function (sender, e) {
  20777. if (me.getValue()) {
  20778. me.value.setSeconds(sender.getValue());
  20779. }
  20780. },
  20781. }
  20782. });
  20783. me.confirmBtn = new Ext.button.Button({
  20784. text: '确认',
  20785. handler: me.confirmClick,
  20786. scope: me
  20787. });
  20788. me.tdBtn = new Ext.button.Button({
  20789. text: '现在',
  20790. handler: me.selectToday,
  20791. scope: me
  20792. });
  20793. me.todayBtn = Ext.create('Ext.container.Container', {
  20794. layout: 'anchor', border: false,
  20795. defaults: {
  20796. border: false, anchor: '100%',
  20797. margin: '0 0 5 0',
  20798. },
  20799. items: [
  20800. {
  20801. layout: 'hbox',
  20802. items: [
  20803. me.input1,
  20804. me.input2,
  20805. me.input3,
  20806. ]
  20807. },
  20808. {
  20809. layout: 'hbox',
  20810. items: [
  20811. me.confirmBtn,
  20812. me.tdBtn,
  20813. ]
  20814. }
  20815. ]
  20816. });
  20817. },
  20818. // finishRenderChildren() {
  20819. // var me = this;
  20820. //
  20821. // this.superclass.finishRenderChildren.call(this);
  20822. // //*
  20823. // me.input1.finishRender();
  20824. // me.input2.finishRender();
  20825. // me.input3.finishRender();
  20826. // //
  20827. // me.tdBtn.finishRender();
  20828. // me.confirmBtn.finishRender();
  20829. // },
  20830. setValue: function (value) {
  20831. //this.value = Ext.Date.clearTime(value, true);
  20832. this.value = value;
  20833. this.input1.setValue(this.value.getHours());
  20834. this.input2.setValue(this.value.getMinutes());
  20835. this.input3.setValue(this.value.getSeconds());
  20836. return this.update(this.value);
  20837. },
  20838. selectDate: function (value) {
  20839. if (this.showTime) {
  20840. value.setHours(this.input1.getValue());
  20841. value.setMinutes(this.input2.getValue());
  20842. value.setSeconds(this.input3.getValue());
  20843. }
  20844. this.value = value;
  20845. return this.update(this.value);
  20846. },
  20847. setDisabledStatus: function (disabled) {
  20848. var me = this;
  20849. debugger;
  20850. // me.callParent();
  20851. if (me.showTime) {
  20852. me.confirmBtn.setDisabled(disabled);
  20853. }
  20854. if (me.isShowFooter()) {
  20855. me.footerContainer.setDisabled(disabled);
  20856. }
  20857. },
  20858. handleDateClick: function (e, t) {
  20859. var me = this, handler = me.handler;
  20860. // e.stopEvent();
  20861. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20862. me.doCancelFocus = me.focusOnSelect === false;
  20863. me.selectDate(new Date(t.dateValue));
  20864. delete me.doCancelFocus;
  20865. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20866. if (me.showTime) {
  20867. return;
  20868. }
  20869. me.fireEvent('select', me, me.value);
  20870. if (handler) {
  20871. handler.call(me.scope || me, me, me.value);
  20872. }
  20873. me.onSelect();
  20874. }
  20875. },
  20876. selectToday: function () {
  20877. var me = this, btn = me.todayBtn, handler = me.handler;
  20878. if (btn && !btn.disabled) {
  20879. me.value = syncDate(new Date());
  20880. me.update(me.value);
  20881. me.fireEvent('select', me, me.value);
  20882. if (handler) {
  20883. handler.call(me.scope || me, me, me.value);
  20884. }
  20885. me.onSelect();
  20886. me.hide();
  20887. }
  20888. return me;
  20889. },
  20890. confirmClick: function () {
  20891. var me = this, btn = me.confirmBtn, handler = me.handler;
  20892. if (btn && !btn.disabled) {
  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. selectedUpdate: function (date) {
  20903. var me = this,
  20904. //t = date.getTime(),
  20905. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20906. cells.removeCls(cls);
  20907. for (c = 0; c < cLen; c++) {
  20908. cell = Ext.fly(cellItems[c]);
  20909. if (cell.dom.firstChild.dateValue == t) {
  20910. me.fireEvent('highlightitem', me, cell);
  20911. cell.addCls(cls);
  20912. if (me.isVisible() && !me.doCancelFocus) {
  20913. Ext.fly(cell.dom.firstChild).focus(50);
  20914. }
  20915. break;
  20916. }
  20917. }
  20918. },
  20919. // private, inherit docs
  20920. beforeDestroy: function () {
  20921. var me = this;
  20922. if (me.rendered) {
  20923. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20924. }
  20925. me.superclass.beforeDestroy.call(this);
  20926. }
  20927. });
  20928. }
  20929. //# sourceMappingURL=datetimepicker.js.map
  20930. function initDateTime () {
  20931. Ext.define('Yvan.DateTimeField', {
  20932. extend: 'Ext.form.field.Date',
  20933. xtype: 'datetimefield',
  20934. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20935. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20936. showTime: true,
  20937. format: "Y-m-d H:i:s",
  20938. constructor: function (config) {
  20939. var newConfig = _$2.defaultsDeep({
  20940. // 强制属性
  20941. }, baseConfig(config, 'col-item'), config, date);
  20942. this.superclass.constructor.call(this, newConfig);
  20943. },
  20944. initComponent: function () {
  20945. this.superclass.initComponent.call(this);
  20946. var setInitValue = function () {
  20947. var value = this.getRawValue();
  20948. if (!value) {
  20949. // 没填内容的时候,自动设置当前时间
  20950. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20951. }
  20952. };
  20953. this.on({
  20954. afterrender: function () {
  20955. var config = this.config;
  20956. // 日期框,不要默认弹出
  20957. $(this.el.dom).on('click', setInitValue.bind(this));
  20958. },
  20959. destory: function () {
  20960. // 日期框,不要默认弹出
  20961. $(this.el.dom).off('click', setInitValue.bind(this));
  20962. },
  20963. change: {
  20964. fn: function (sender) {
  20965. if (sender.format === "Y-m-d H:i:s") {
  20966. // 年月日格式
  20967. var value = sender.getRawValue();
  20968. if (/^\d{14}$/.test(value)) {
  20969. // 8位数字,自动转换为 YYYY-MM-DD
  20970. var newValue = [
  20971. value.substr(0, 4),
  20972. '-',
  20973. value.substr(4, 2),
  20974. '-',
  20975. value.substr(6, 2),
  20976. ' ',
  20977. value.substr(8, 2),
  20978. ':',
  20979. value.substr(10, 2),
  20980. ':',
  20981. value.substr(12, 2)
  20982. ].join('');
  20983. sender.setValue(newValue);
  20984. }
  20985. }
  20986. },
  20987. }
  20988. });
  20989. },
  20990. getValue: function () {
  20991. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  20992. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  20993. // console.log('cc:', nv, ov)
  20994. return nv;
  20995. },
  20996. onExpand: function () {
  20997. var strValue = this.getValue();
  20998. var value;
  20999. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  21000. 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)));
  21001. }
  21002. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  21003. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  21004. }
  21005. else {
  21006. value = syncDate(new Date());
  21007. }
  21008. this.picker.setValue(value);
  21009. },
  21010. createPicker: function () {
  21011. var me = this, format = Ext.String.format;
  21012. //@ts-ignore
  21013. return new Yvan.DateTimePicker({
  21014. pickerField: me,
  21015. ownerCt: me.ownerCt,
  21016. renderTo: document.body,
  21017. floating: true,
  21018. hidden: true,
  21019. focusOnShow: true,
  21020. minDate: me.minValue,
  21021. maxDate: me.maxValue,
  21022. disabledDatesRE: me.disabledDatesRE,
  21023. disabledDatesText: me.disabledDatesText,
  21024. disabledDays: me.disabledDays,
  21025. disabledDaysText: me.disabledDaysText,
  21026. format: me.format,
  21027. showToday: me.showToday,
  21028. showTime: me.showTime,
  21029. startDay: me.startDay,
  21030. minText: format(me.minText, me.formatDate(me.minValue)),
  21031. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  21032. listeners: {
  21033. scope: me,
  21034. select: me.onSelect
  21035. },
  21036. keyNavConfig: {
  21037. esc: function () {
  21038. me.collapse();
  21039. }
  21040. }
  21041. });
  21042. },
  21043. });
  21044. }
  21045. //# sourceMappingURL=datetimefield.js.map
  21046. function initNumber () {
  21047. var cc = Ext.form.field.Number.prototype.constructor;
  21048. var initComponent = Ext.form.field.Number.prototype.initComponent;
  21049. Ext.form.field.Number.override({
  21050. constructor: function (config) {
  21051. var newConfig = _$2.defaultsDeep({
  21052. // 强制属性
  21053. }, baseConfig(config, 'col-item'), config, numberfield);
  21054. cc.call(this, newConfig);
  21055. },
  21056. initComponent: function () {
  21057. this.on({
  21058. afterrender: function (sender) {
  21059. var _this = this;
  21060. var _a;
  21061. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  21062. sender.inputEl.dom.setAttribute('spellcheck', "false");
  21063. $$2(sender.inputEl.dom).on('click', function (e) {
  21064. sender.fireEvent('click', _this, e);
  21065. });
  21066. }
  21067. }
  21068. });
  21069. initComponent.call(this);
  21070. },
  21071. });
  21072. }
  21073. //# sourceMappingURL=numberfield.js.map
  21074. function initCheckbox () {
  21075. var cc = Ext.form.field.Checkbox.prototype.constructor;
  21076. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  21077. Ext.form.field.Checkbox.override({
  21078. constructor: function (config) {
  21079. var newConfig = _$2.defaultsDeep({
  21080. // 强制属性
  21081. }, baseConfig(config, 'col-item'), config, checkbox);
  21082. cc.call(this, newConfig);
  21083. },
  21084. getValue: function () {
  21085. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21086. var ov = getValue.call(this);
  21087. // const ov = this.getRawValue()
  21088. return (ov ? checkedValue : uncheckedValue);
  21089. },
  21090. setValue: function (nv) {
  21091. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21092. var value;
  21093. if (nv === checkedValue) {
  21094. value = true;
  21095. }
  21096. else if (nv === uncheckedValue) {
  21097. value = false;
  21098. }
  21099. else {
  21100. value = !!nv;
  21101. }
  21102. // me.setRawValue(value)
  21103. // me.checked = value
  21104. // return me.mixins.field.setValue.call(me, value);
  21105. setValue.call(this, value);
  21106. },
  21107. updateCheckedCls: function (checked) {
  21108. var me = this;
  21109. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  21110. checked = checked != null ? checked : me.getValue();
  21111. if (checked === uncheckedValue) {
  21112. checked = false;
  21113. }
  21114. else if (checked === checkedValue) {
  21115. checked = true;
  21116. }
  21117. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21118. },
  21119. initComponent: function () {
  21120. initComponent.call(this);
  21121. },
  21122. });
  21123. }
  21124. //# sourceMappingURL=checkbox.js.map
  21125. function initCheckboxGroup () {
  21126. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21127. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21128. Ext.form.CheckboxGroup.override({
  21129. constructor: function (config) {
  21130. var newConfig = _$2.defaultsDeep({
  21131. // 强制属性
  21132. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21133. cc.call(this, newConfig);
  21134. },
  21135. initComponent: function () {
  21136. initComponent.call(this);
  21137. },
  21138. });
  21139. }
  21140. //# sourceMappingURL=checkboxgroup.js.map
  21141. function initRadio () {
  21142. var cc = Ext.form.field.Radio.prototype.constructor;
  21143. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21144. Ext.form.field.Radio.override({
  21145. constructor: function (config) {
  21146. var newConfig = _$2.defaultsDeep({
  21147. // 强制属性
  21148. }, baseConfig(config, 'col-item'), config, radio);
  21149. cc.call(this, newConfig);
  21150. },
  21151. initComponent: function () {
  21152. initComponent.call(this);
  21153. },
  21154. });
  21155. }
  21156. //# sourceMappingURL=radio.js.map
  21157. function initRadioGroup () {
  21158. var cc = Ext.form.RadioGroup.prototype.constructor;
  21159. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21160. Ext.form.RadioGroup.override({
  21161. constructor: function (config) {
  21162. var newConfig = _$2.defaultsDeep({
  21163. // 强制属性
  21164. }, baseConfig(config, 'col-item'), config, radiogroup);
  21165. cc.call(this, newConfig);
  21166. },
  21167. initComponent: function () {
  21168. initComponent.call(this);
  21169. },
  21170. });
  21171. }
  21172. //# sourceMappingURL=radiogroup.js.map
  21173. function initFieldset () {
  21174. /**
  21175. *
  21176. */
  21177. var ct = Ext.form.FieldSet.prototype.constructor;
  21178. Ext.form.FieldSet.override({
  21179. constructor: function (config) {
  21180. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21181. ct.call(this, newConfig);
  21182. }
  21183. });
  21184. }
  21185. //# sourceMappingURL=fieldset.js.map
  21186. function initCombotree () {
  21187. Ext.define('Yvan.ComboTree', {
  21188. extend: 'Ext.form.field.Picker',
  21189. xtype: 'combotree',
  21190. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21191. config: {
  21192. store: null,
  21193. displayField: null,
  21194. columns: null,
  21195. selectOnTab: true,
  21196. maxPickerHeight: 300,
  21197. minPickerHeight: 100,
  21198. minPickerWidth: 350,
  21199. rootVisible: true,
  21200. },
  21201. editable: false,
  21202. setStore: function (store) {
  21203. this.store = store;
  21204. var me = this;
  21205. if (me.store) {
  21206. if (me.picker) {
  21207. me.picker.setStore(store);
  21208. if (me.isExpanded) {
  21209. me.collapse();
  21210. delete me.picker;
  21211. me.expand();
  21212. }
  21213. }
  21214. this.onLoad();
  21215. me.mon(me.store, {
  21216. scope: me,
  21217. load: me.onLoad,
  21218. update: me.onUpdate
  21219. });
  21220. }
  21221. },
  21222. createPicker: function () {
  21223. var me = this;
  21224. var picker = new Ext.tree.Panel({
  21225. border: false,
  21226. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21227. shrinkWrapDock: 2,
  21228. store: me.store,
  21229. floating: true,
  21230. rootVisible: me.rootVisible,
  21231. displayField: me.displayField,
  21232. columns: me.columns,
  21233. minHeight: me.minPickerHeight,
  21234. maxHeight: me.maxPickerHeight,
  21235. minWidth: me.minPickerWidth,
  21236. manageHeight: false,
  21237. shadow: false,
  21238. scrollable: true,
  21239. // modal: true,
  21240. // constrain: true,
  21241. // constrainTo: topScope._handle.el.dom,
  21242. // renderTo: topScope._handle.el.dom,
  21243. // alignTarget: topScope._handle,
  21244. listeners: {
  21245. scope: me,
  21246. itemclick: me.onItemClick,
  21247. itemkeydown: me.onPickerKeyDown
  21248. }
  21249. }), view = picker.getView();
  21250. if (Ext.isIE9 && Ext.isStrict) {
  21251. view.on({
  21252. scope: me,
  21253. highlightitem: me.repaintPickerView,
  21254. unhighlightitem: me.repaintPickerView,
  21255. afteritemexpand: me.repaintPickerView,
  21256. afteritemcollapse: me.repaintPickerView
  21257. });
  21258. }
  21259. return picker;
  21260. },
  21261. repaintPickerView: function () {
  21262. var style = this.picker.getView().getEl().dom.style;
  21263. style.display = style.display;
  21264. },
  21265. onItemClick: function (view, record, node, rowIndex, e) {
  21266. this.selectItem(view, record);
  21267. },
  21268. onPickerKeyDown: function (treeView, record, item, index, e) {
  21269. var key = e.getKey();
  21270. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21271. this.selectItem(treeView, record);
  21272. }
  21273. },
  21274. selectItem: function (sender, record) {
  21275. var me = this;
  21276. me.setValue(record.getId());
  21277. me.fireEvent('select', me, record);
  21278. me.collapse();
  21279. },
  21280. onExpand: function () {
  21281. var picker = this.picker;
  21282. var store = picker.store;
  21283. var value = this.value;
  21284. var node;
  21285. if (value) {
  21286. node = store.getNodeById(value);
  21287. }
  21288. if (!node) {
  21289. node = store.getRoot();
  21290. }
  21291. picker.ensureVisible(node, {
  21292. select: true,
  21293. focus: true
  21294. });
  21295. },
  21296. setValue: function (value) {
  21297. var me = this;
  21298. console.log('setValue', value);
  21299. me.value = value;
  21300. if (!me.store || me.store.loading) {
  21301. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21302. return me.mixins.field.setValue.call(me, value);
  21303. // return me;
  21304. }
  21305. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21306. if (value === undefined) {
  21307. record = me.store.getRoot();
  21308. console.log('setValue', record.getId());
  21309. me.value = record.getId();
  21310. return me.mixins.field.setValue.call(me, value);
  21311. }
  21312. else {
  21313. record = me.store.getNodeById(value);
  21314. }
  21315. // set the raw value to the record's display field if a record was found
  21316. me.setRawValue(record ? record.get(me.displayField) : '');
  21317. return me.mixins.field.setValue.call(me, value);
  21318. },
  21319. getSubmitValue: function () {
  21320. return this.value;
  21321. },
  21322. getValue: function () {
  21323. return this.value;
  21324. },
  21325. onLoad: function () {
  21326. var value = this.value;
  21327. if (value) {
  21328. this.setValue(value);
  21329. }
  21330. },
  21331. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21332. var display = this.displayField;
  21333. var me = this;
  21334. if (type === 'edit' && modifiedFieldNames &&
  21335. Ext.Array.contains(modifiedFieldNames, display) &&
  21336. this.value === rec.getId()) {
  21337. me.mixins.field.setValue.call(me, this.value);
  21338. this.setRawValue(rec.get(display));
  21339. }
  21340. }
  21341. });
  21342. }
  21343. //# sourceMappingURL=combotree.js.map
  21344. function initPickerPlus () {
  21345. Ext.define('Yvan.PickerAlignCenter', {
  21346. extend: 'Ext.form.field.Picker',
  21347. /**
  21348. * Performs the alignment on the picker using the class defaults
  21349. * @private
  21350. */
  21351. doAlign: function () {
  21352. // 不要挪动就好
  21353. },
  21354. });
  21355. }
  21356. //# sourceMappingURL=pickerplus.js.map
  21357. function initCombogrid () {
  21358. Ext.define('Yvan.ComboGrid', {
  21359. extend: 'Ext.form.field.Picker',
  21360. // extend: 'Yvan.PickerAlignCenter',
  21361. xtype: 'combogrid',
  21362. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21363. triggers: {
  21364. clear: {
  21365. weight: 0,
  21366. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21367. hidden: true,
  21368. handler: 'onClearClick',
  21369. },
  21370. },
  21371. config: __assign({}, comboGrid),
  21372. editable: true,
  21373. _superBlur: false,
  21374. allowCustomInput: false,
  21375. pressEnterPopup: true,
  21376. initComponent: function () {
  21377. var that = this;
  21378. var scope = lookupScope(that);
  21379. var config = that.config;
  21380. if (isDesignMode(scope, config)) {
  21381. this.superclass.initComponent.call(this, arguments);
  21382. return;
  21383. }
  21384. this.on({
  21385. blur: function (sender, e) {
  21386. if (this._superBlur) {
  21387. // 挂起时不恢复内容
  21388. return;
  21389. }
  21390. // 离开焦点时,恢复原来的值
  21391. sender.setRawValue(sender.value);
  21392. },
  21393. afterrender: function (sender) {
  21394. var $dom = $(sender.inputEl.dom);
  21395. that.scope = lookupScope(sender);
  21396. if (sender.column) {
  21397. // 列模式,拦截 keydown
  21398. $dom.on('keydown', function (e) {
  21399. if (isChartEvent(e) && !that.tryEnable()) {
  21400. // 没有达成 editEnable 条件,不用响应
  21401. stopEvent(e);
  21402. return;
  21403. }
  21404. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21405. stopEvent(e);
  21406. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21407. return;
  21408. }
  21409. });
  21410. }
  21411. else {
  21412. // 常规模式,拦截 keyup
  21413. $dom.on('keyup', function (e) {
  21414. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21415. return;
  21416. }
  21417. if (isChartEvent(e) && !that.tryEnable()) {
  21418. // 没有达成 editEnable 条件,不用响应
  21419. stopEvent(e);
  21420. return;
  21421. }
  21422. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21423. stopEvent(e);
  21424. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21425. return;
  21426. }
  21427. if (!that.allowCustomInput) {
  21428. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21429. stopEvent(e);
  21430. }
  21431. });
  21432. $dom.on('change', function (e) {
  21433. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21434. // if (that.isExpanded) {
  21435. // that.filterChange(that, e.target.value)
  21436. // }
  21437. stopEvent(e);
  21438. });
  21439. }
  21440. $dom.on('input', function (e) {
  21441. stopEvent(e);
  21442. });
  21443. },
  21444. });
  21445. this.superclass.initComponent.apply(this, arguments);
  21446. },
  21447. createPicker: function () {
  21448. var me = this;
  21449. var cfg = {
  21450. layout: 'fit',
  21451. border: 0,
  21452. // border: 5,
  21453. style: {
  21454. // borderColor: 'black',
  21455. // borderWidth: '5px',
  21456. // borderStyle: 'solid',
  21457. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21458. },
  21459. shadow: 'side',
  21460. shadowOffset: 100,
  21461. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21462. shrinkWrapDock: 2,
  21463. floating: true,
  21464. width: me.pickerWidth,
  21465. height: me.pickerHeight,
  21466. minWidth: me.pickerWidth,
  21467. minHeight: me.pickerHeight,
  21468. maxWidth: me.pickerWidth,
  21469. maxHeight: me.pickerHeight,
  21470. items: [
  21471. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21472. xtype: 'toolbar',
  21473. items: [
  21474. { xtype: 'textfield', fieldLabel: '筛选' },
  21475. {
  21476. xtype: 'button',
  21477. text: '查询',
  21478. iconCls: 'x-fa fa-search',
  21479. cssType: 'primary',
  21480. listeners: {
  21481. click: function () {
  21482. me.reloadGrid();
  21483. }
  21484. }
  21485. },
  21486. ]
  21487. }, autoLoad: false, listeners: {
  21488. afterrender: function (grid) {
  21489. me.grid = grid;
  21490. grid.focus();
  21491. grid.on({
  21492. rowdblclick: function (sender, row) {
  21493. me.selectItem(row);
  21494. },
  21495. dataLoadComplete: function (sender) {
  21496. _$2.defer(function () {
  21497. me.setFocus();
  21498. });
  21499. },
  21500. keydown: function (sender, e) {
  21501. if (me.column) {
  21502. // 列模式,拦截 keydown
  21503. me.processKey(e);
  21504. }
  21505. },
  21506. keyup: function (sender, e) {
  21507. if (!me.column) {
  21508. // 常规模式,拦截 keyup
  21509. me.processKey(e);
  21510. }
  21511. }
  21512. });
  21513. },
  21514. } })
  21515. ]
  21516. };
  21517. // @ts-ignore
  21518. var picker = new Ext.container.Container(cfg);
  21519. return picker;
  21520. },
  21521. setFocus: function () {
  21522. if (this.grid.store.getCount() > 0) {
  21523. this.grid.focusRow(0);
  21524. }
  21525. },
  21526. processKey: function (e) {
  21527. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21528. this.selectItem(this.grid.selection);
  21529. stopEvent(e);
  21530. }
  21531. else if (e.key === 'Escape') {
  21532. this.collapse();
  21533. }
  21534. },
  21535. repaintPickerView: function () {
  21536. var style = this.picker.getView().getEl().dom.style;
  21537. style.display = style.display;
  21538. },
  21539. onItemClick: function (view, record, node, rowIndex, e) {
  21540. this.selectItem(record);
  21541. },
  21542. onPickerKeyDown: function (treeView, record, item, index, e) {
  21543. var key = e.getKey();
  21544. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21545. this.selectItem(record);
  21546. }
  21547. },
  21548. filterChange: _$2.debounce(function (sender, value) {
  21549. sender.onExpand();
  21550. }, 1000),
  21551. selectItem: function (record) {
  21552. var me = this;
  21553. var lookup = this.lookup;
  21554. var scope = lookupScope(this);
  21555. me.fireEvent('select', me, record);
  21556. if (record.isModel) {
  21557. record = record.data;
  21558. }
  21559. tryWriteObject(lookup, record, function (path, value) {
  21560. me._lookupSet(path, value);
  21561. });
  21562. // lookup
  21563. // fromColumn: 'toTarget'
  21564. // fromColumn: 'toTarget'
  21565. // fromColumn: 'toTarget'
  21566. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21567. var value = _$2.get(record, fromColumn);
  21568. me._lookupSet(toTarget, value);
  21569. });
  21570. // 选定之后不能做清空
  21571. // const {lookupClearOnChange} = me
  21572. // if (_.isArray(lookupClearOnChange)) {
  21573. // _.each(lookupClearOnChange, item => {
  21574. // me._lookupSet(item, '')
  21575. // })
  21576. // }
  21577. me.collapse();
  21578. // 触发 _raiseNextFocus
  21579. me._raiseNextFocus(me);
  21580. },
  21581. onExpand: function () {
  21582. // 展开时,根据 lookup 带入查询参数
  21583. var expressData = this.getExpressData();
  21584. var txtField = this.grid.down('toolbar').down('textfield');
  21585. txtField.setValue(expressData.queryValue);
  21586. this.reloadGrid();
  21587. },
  21588. reloadGrid: function () {
  21589. // 展开时,根据 lookup 带入查询参数
  21590. var expressData = this.getExpressData();
  21591. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21592. var txtField = this.grid.down('toolbar').down('textfield');
  21593. // 每个 combogrid 默认带上 __queryValue 属性
  21594. reloadParam["__queryValue"] = txtField.getValue();
  21595. this.grid.reload(reloadParam);
  21596. },
  21597. onTriggerClick: function (sender) {
  21598. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21599. if (!grid) {
  21600. msg('正在初始化,请稍后');
  21601. return;
  21602. }
  21603. if (!this.tryEnable()) {
  21604. // 没有达成 editEnable 条件,不用弹出
  21605. return;
  21606. }
  21607. if (isExpanded || readOnly || disabled) {
  21608. // 已弹出、只读、禁用状态下,不允许弹出
  21609. return;
  21610. }
  21611. this._superBlur = true;
  21612. this.superclass.onTriggerClick.apply(this, arguments);
  21613. this._superBlur = false;
  21614. },
  21615. onCollapse: function () {
  21616. // 每次收回时,删除下拉组件
  21617. // delete this.picker
  21618. },
  21619. /**
  21620. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21621. */
  21622. setValue: function (value) {
  21623. var me = this;
  21624. // 设值用户看到的表面内容
  21625. this.setRawValue(value);
  21626. // 设值 setValue 调用链,正常触发 change 事件等
  21627. return me.mixins.field.setValue.call(me, value);
  21628. },
  21629. _lookupSet: function (path, value) {
  21630. var me = this;
  21631. path = tryVarSimple(path);
  21632. if (me.column) {
  21633. // 判断写入目标,是否与自己绑定的属性相等
  21634. if (path === 'queryValue' || me.column.dataIndex === path) {
  21635. me.setValue(value);
  21636. }
  21637. // 列模式下,写当前编辑行
  21638. var parentRecord = me._lookupEditorRecord();
  21639. if (parentRecord) {
  21640. // Ext.data.Record / Ext.data.Model
  21641. parentRecord.set(path, value);
  21642. }
  21643. else {
  21644. debugger;
  21645. }
  21646. }
  21647. else {
  21648. // 常规模式下,写 viewModel
  21649. me.scope.viewModel.set(path, value);
  21650. }
  21651. },
  21652. _lookupGrid: function () {
  21653. return this.column.up('grid');
  21654. },
  21655. _lookupEditorRecord: function () {
  21656. var _a, _b, _c, _d;
  21657. // parentGrid.getSelectionModel().getLastSelected()
  21658. var grid = this._lookupGrid();
  21659. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21660. if (!editingPlugin) {
  21661. return grid.getSelectionModel().getLastSelected();
  21662. }
  21663. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21664. if (_$2.isNumber(rowIdx)) {
  21665. return grid.store.getAt(rowIdx);
  21666. }
  21667. else {
  21668. return grid.getSelectionModel().getLastSelected();
  21669. }
  21670. },
  21671. onChange: function (newVal, oldVal) {
  21672. var me = this;
  21673. var value = newVal;
  21674. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21675. if (hideTrigger || disabled || readOnly || hideClear) {
  21676. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21677. return;
  21678. }
  21679. if (value) {
  21680. me.getTrigger('clear').show();
  21681. me.updateLayout();
  21682. }
  21683. else {
  21684. me.getTrigger('clear').hide();
  21685. me.updateLayout();
  21686. }
  21687. },
  21688. /**
  21689. * 得到能用于 express 表达式计算的上下文数据
  21690. */
  21691. getExpressData: function () {
  21692. var queryValue = this.getRawValue();
  21693. if (!queryValue) {
  21694. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21695. queryValue = this.getPicker().down('textfield').getRawValue();
  21696. }
  21697. if (this.column) {
  21698. // 列模式, 准备好判断 editEnable 表达式用的数据
  21699. var parentRecord = this._lookupEditorRecord();
  21700. if (!parentRecord) {
  21701. debugger;
  21702. }
  21703. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21704. }
  21705. else {
  21706. // 编辑模式,准备好判断用的数据
  21707. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21708. }
  21709. },
  21710. tryEnable: function () {
  21711. return tryEnable(this.getExpressData(), this.editEnable);
  21712. },
  21713. /**
  21714. * 清空所有值
  21715. */
  21716. onClearClick: function (sender, e) {
  21717. var me = this;
  21718. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21719. me.fireEvent('clear', sender, e);
  21720. me.setValue('');
  21721. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21722. me._lookupSet(toTarget, '');
  21723. });
  21724. _$2.each(lookupClearOnChange, function (item) {
  21725. me._lookupSet(item, '');
  21726. });
  21727. }
  21728. });
  21729. }
  21730. //# sourceMappingURL=combogrid.js.map
  21731. function initContainer () {
  21732. var cc = Ext.container.Container.prototype.constructor;
  21733. //const {initComponent} = Ext.container.Container.prototype
  21734. Ext.container.Container.override({
  21735. constructor: function (config) {
  21736. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21737. cc.call(this, newConfig);
  21738. },
  21739. });
  21740. }
  21741. //# sourceMappingURL=container.js.map
  21742. function initRows () {
  21743. Ext.define('Yvan.Rows', {
  21744. extend: 'Ext.container.Container',
  21745. xtype: 'rows',
  21746. constructor: function (config) {
  21747. var self = this;
  21748. var newConfig = _$2.defaultsDeep({
  21749. // 强制性属性
  21750. layout: 'anchor', border: false,
  21751. defaults: {
  21752. border: false, anchor: '100%',
  21753. margin: '0 0 5 0',
  21754. },
  21755. }, baseConfig(config, 'rows-container'), config, rows);
  21756. this.superclass.constructor.call(self, newConfig);
  21757. },
  21758. });
  21759. }
  21760. //# sourceMappingURL=rows.js.map
  21761. function initForm () {
  21762. var ct = Ext.form.Panel.prototype.constructor;
  21763. Ext.form.Panel.override({
  21764. constructor: function (config) {
  21765. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21766. ct.call(this, newConfig);
  21767. }
  21768. });
  21769. }
  21770. //# sourceMappingURL=form.js.map
  21771. function initCols () {
  21772. Ext.define('Yvan.Cols', {
  21773. extend: 'Ext.container.Container',
  21774. xtype: 'cols',
  21775. constructor: function (config) {
  21776. var self = this;
  21777. var newConfig = _$2.defaultsDeep({
  21778. // 强制性属性
  21779. layout: 'hbox',
  21780. minHeight: config.designMode ? 32 : 0
  21781. }, baseConfig(config, 'cols-container'), config, cols);
  21782. this.superclass.constructor.call(self, newConfig);
  21783. },
  21784. });
  21785. }
  21786. //# sourceMappingURL=cols.js.map
  21787. function initButton () {
  21788. /**
  21789. *
  21790. */
  21791. var ct = Ext.button.Button.prototype.constructor;
  21792. Ext.button.Button.override({
  21793. constructor: function (config) {
  21794. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21795. ct.call(this, newConfig);
  21796. },
  21797. setLoading: function (value) {
  21798. if (value) {
  21799. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21800. this._originIconCls = this.iconCls;
  21801. }
  21802. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21803. this.setDisabled(true);
  21804. }
  21805. else {
  21806. this.setIconCls(this._originIconCls);
  21807. this.setDisabled(false);
  21808. }
  21809. }
  21810. });
  21811. }
  21812. //# sourceMappingURL=button.js.map
  21813. function initIframe () {
  21814. Ext.define('Ext.ux.IFrame', {
  21815. extend: 'Ext.Component',
  21816. alias: 'widget.uxiframe',
  21817. loadMask: 'Loading...',
  21818. src: 'about:blank',
  21819. renderTpl: [
  21820. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21821. ],
  21822. childEls: ['iframeEl'],
  21823. initComponent: function () {
  21824. this.superclass.initComponent.call(this);
  21825. this.superclass.initEvents.call(this);
  21826. this.frameName = this.frameName || this.id + '-frame';
  21827. },
  21828. initEvents: function () {
  21829. var me = this;
  21830. this.superclass.initEvents.call(this);
  21831. me.iframeEl.on('load', me.onLoad, me);
  21832. },
  21833. initRenderData: function () {
  21834. return Ext.apply(this.superclass.initRenderData.call(this), {
  21835. src: this.src,
  21836. frameName: this.frameName
  21837. });
  21838. },
  21839. getBody: function () {
  21840. var doc = this.getDoc();
  21841. return doc.body || doc.documentElement;
  21842. },
  21843. getDoc: function () {
  21844. try {
  21845. return this.getWin().document;
  21846. }
  21847. catch (ex) {
  21848. return null;
  21849. }
  21850. },
  21851. getWin: function () {
  21852. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21853. return win;
  21854. },
  21855. getFrame: function () {
  21856. var me = this;
  21857. return me.iframeEl.dom;
  21858. },
  21859. onLoad: function () {
  21860. var me = this, doc = me.getDoc();
  21861. if (doc) {
  21862. this.el.unmask();
  21863. this.fireEvent('load', this);
  21864. }
  21865. else if (me.src) {
  21866. this.el.unmask();
  21867. this.fireEvent('error', this);
  21868. }
  21869. },
  21870. load: function (src) {
  21871. var me = this, text = me.loadMask, frame = me.getFrame();
  21872. if (me.fireEvent('beforeload', me, src) !== false) {
  21873. if (text && me.el) {
  21874. me.el.mask(text);
  21875. }
  21876. frame.src = me.src = (src || me.src);
  21877. }
  21878. }
  21879. });
  21880. }
  21881. //# sourceMappingURL=iframe.js.map
  21882. /**
  21883. * 属性:
  21884. * - autoLoad: true
  21885. * - dataSource: ''
  21886. * 方法:
  21887. * - handleZoomBig
  21888. * - handleZoomSmall
  21889. * - handleZoomReset
  21890. * - openDiagram
  21891. * - getBpmn
  21892. * - getBpmnCanvas
  21893. * - getBpmnOverlays
  21894. * - getBpmnZoomScroll
  21895. * 事件:
  21896. * - initFinish
  21897. * - failed
  21898. * - success
  21899. * - itemHover
  21900. * - itemOut
  21901. * - itemClick
  21902. * - itemDblclick
  21903. * - itemMousedown
  21904. * - itemMouseup
  21905. */
  21906. function initBpmn () {
  21907. Ext.define('Yvan.Bpmn', {
  21908. // extend: 'Ext.container.Container',
  21909. extend: 'Ext.panel.Panel',
  21910. alias: 'widget.bpmn',
  21911. xtype: 'bpmn',
  21912. constructor: function (config) {
  21913. var self = this;
  21914. var newConfig = _$2.defaultsDeep({
  21915. // 强制性属性
  21916. }, baseConfig(config, 'row-item'), config, bpmn);
  21917. if (!newConfig.hideToolbar) {
  21918. newConfig.tbar = [];
  21919. newConfig.tbar.push({
  21920. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21921. listeners: {
  21922. click: function (sender) {
  21923. self.reload();
  21924. }
  21925. }
  21926. });
  21927. newConfig.tbar.push({
  21928. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21929. listeners: {
  21930. click: function (sender) {
  21931. self.handleZoomBig();
  21932. }
  21933. },
  21934. });
  21935. newConfig.tbar.push({
  21936. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21937. listeners: {
  21938. click: function (sender) {
  21939. self.handleZoomSmall();
  21940. }
  21941. },
  21942. });
  21943. newConfig.tbar.push({
  21944. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21945. listeners: {
  21946. click: function (sender) {
  21947. self.handleZoomReset();
  21948. }
  21949. },
  21950. });
  21951. }
  21952. this.superclass.constructor.call(self, newConfig);
  21953. },
  21954. initComponent: function () {
  21955. var _this = this;
  21956. var me = this;
  21957. var config = me.config;
  21958. var scope = lookupScope(this);
  21959. if (!isDesignMode(scope, config)) {
  21960. //@ts-ignore
  21961. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21962. console.log('BpNavigated', me, BpNavigated);
  21963. var dom = me.el.dom;
  21964. var $dom = $(dom);
  21965. var $container = $dom.find('.x-autocontainer-innerCt');
  21966. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21967. _this._bpmn = bpmn;
  21968. if (_this.autoLoad) {
  21969. _this.reload();
  21970. }
  21971. _this.fireEvent('initFinish', _this);
  21972. var eventBus = bpmn.get('eventBus');
  21973. eventBus.on('element.hover', function (e) {
  21974. // this.fireEvent('itemHover', this, e);
  21975. });
  21976. eventBus.on('element.out', function (e) {
  21977. _this.fireEvent('itemOut', _this, e);
  21978. });
  21979. eventBus.on('element.click', function (e) {
  21980. _this.fireEvent('itemClick', _this, e);
  21981. });
  21982. eventBus.on('element.dblclick', function (e) {
  21983. _this.fireEvent('itemDblclick', _this, e);
  21984. });
  21985. eventBus.on('element.mousedown', function (e) {
  21986. _this.fireEvent('itemMousedown', _this, e);
  21987. });
  21988. eventBus.on('element.mouseup', function (e) {
  21989. _this.fireEvent('itemMouseup', _this, e);
  21990. });
  21991. });
  21992. }
  21993. this.superclass.initComponent.call(this);
  21994. this.on({
  21995. afterrender: function (sender) {
  21996. }
  21997. });
  21998. },
  21999. /**
  22000. * 重新载入
  22001. */
  22002. reload: function () {
  22003. var _this = this;
  22004. var _a;
  22005. if (typeof this.dataSource === 'string' && this.dataSource) {
  22006. var scope = lookupScope(this);
  22007. var fn = lookupFn(scope, this.dataSource);
  22008. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  22009. _this.openDiagram(res.data);
  22010. });
  22011. }
  22012. },
  22013. /**
  22014. * 获取bpmn
  22015. */
  22016. getBpmn: function () {
  22017. return this._bpmn;
  22018. },
  22019. getBpmnCanvas: function () {
  22020. var _a;
  22021. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  22022. },
  22023. getBpmnOverlays: function () {
  22024. var _a;
  22025. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  22026. },
  22027. getBpmnZoomScroll: function () {
  22028. var _a;
  22029. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  22030. },
  22031. handleZoomBig: function () {
  22032. var _a;
  22033. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  22034. },
  22035. handleZoomSmall: function () {
  22036. var _a;
  22037. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  22038. },
  22039. handleZoomReset: function () {
  22040. var _a;
  22041. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  22042. },
  22043. openDiagram: function (diagram) {
  22044. var _this = this;
  22045. if (!this.getBpmn()) {
  22046. return;
  22047. }
  22048. this.getBpmn().importXML(diagram, function (err) {
  22049. if (err) {
  22050. // YvEventDispatch(this.onFailed, this, undefined);
  22051. _this.fireEvent('failed', _this, err);
  22052. return console.error('could not import BPMN 2.0 diagram', err);
  22053. }
  22054. // zoom to fit full viewport
  22055. _this.getBpmnCanvas().zoom('fit-viewport');
  22056. _this.fireEvent('success', _this);
  22057. });
  22058. },
  22059. });
  22060. }
  22061. //# sourceMappingURL=bpmn.js.map
  22062. function initSqlComplex () {
  22063. Ext.define('Yvan.SqlComplex', {
  22064. extend: 'Ext.panel.Panel',
  22065. xtype: 'sqlcomplex',
  22066. alias: 'widget.sqlcomplex',
  22067. getSqlExpress: function () {
  22068. },
  22069. constructor: function (config) {
  22070. var reference = config.reference;
  22071. var me = this;
  22072. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22073. {
  22074. region: 'west',
  22075. width: 280,
  22076. border: false,
  22077. split: true,
  22078. reference: reference + '_tree',
  22079. xtype: 'yvtree',
  22080. hideRefresh: true,
  22081. hideExpand: true,
  22082. hideCollapse: true,
  22083. listeners: {
  22084. itemdblclick: function (sender, record, item, index, e) {
  22085. var field = record.get('field');
  22086. var defaultValue = record.get('defaultValue');
  22087. if (!field) {
  22088. return;
  22089. }
  22090. var tabExpress = me.down('tabpanel');
  22091. var sqleditor = me.down('sqleditor');
  22092. var expressGrid = me.down('yvgrid');
  22093. if (tabExpress.getActiveTab().key !== 'grid') {
  22094. // SQL 模式
  22095. sqleditor.insertText(field + '=');
  22096. }
  22097. else {
  22098. // 表格模式
  22099. expressGrid.appendEditRow({
  22100. field: field,
  22101. operator: '=',
  22102. value: defaultValue,
  22103. remark: '',
  22104. });
  22105. _$2.defer(function () {
  22106. gridChanged(me, expressGrid);
  22107. });
  22108. }
  22109. }
  22110. },
  22111. },
  22112. {
  22113. region: 'center',
  22114. xtype: 'tabpanel',
  22115. reference: reference + '_tab',
  22116. tabPosition: 'bottom',
  22117. listeners: {
  22118. afterrender: function (sender) {
  22119. var scope = lookupScope(me);
  22120. var value = scope.viewModel.get(me.config.bindValue);
  22121. // sql 转换为 grid
  22122. try {
  22123. var list_1 = parseSqlToGrid(value);
  22124. _$2.defer(function () {
  22125. var grid = me.down('yvgrid');
  22126. grid.setData(list_1);
  22127. });
  22128. }
  22129. catch (e) {
  22130. console.error(e);
  22131. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22132. var tabSql = sender.down('sqleditor');
  22133. sender.setActiveTab(tabSql);
  22134. }
  22135. },
  22136. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22137. var scope = lookupScope(me);
  22138. var value = scope.viewModel.get(me.config.bindValue);
  22139. if (newCard.key === 'grid') {
  22140. // sql 转换为 grid
  22141. try {
  22142. var list_2 = parseSqlToGrid(value);
  22143. _$2.defer(function () {
  22144. var grid = me.down('yvgrid');
  22145. grid.setData(list_2);
  22146. });
  22147. return true;
  22148. }
  22149. catch (e) {
  22150. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22151. console.error(e);
  22152. return false;
  22153. }
  22154. }
  22155. else if (newCard.key === 'sql') {
  22156. // grid 转换为 sql
  22157. _$2.defer(function () {
  22158. var editor = me.down('sqleditor');
  22159. editor.setValue(value);
  22160. });
  22161. return true;
  22162. }
  22163. }
  22164. },
  22165. items: [
  22166. {
  22167. title: '表格模式',
  22168. key: 'grid',
  22169. xtype: 'yvgrid',
  22170. _mode: 'select',
  22171. reference: reference + '_grid',
  22172. hideFootbar: true,
  22173. pagination: false,
  22174. tbar: [
  22175. {
  22176. xtype: 'button',
  22177. text: '删除',
  22178. iconCls: 'x-fa fa-minus-circle',
  22179. cls: 'ext-btn-danger',
  22180. bind: {
  22181. disabled: '{!' + reference + '_grid.selection}',
  22182. },
  22183. listeners: {
  22184. click: function (sender) {
  22185. var grid = sender.up('yvgrid');
  22186. removeGridRow(grid);
  22187. gridChanged(me, grid);
  22188. }
  22189. },
  22190. },
  22191. ],
  22192. store: {},
  22193. listeners: {
  22194. editfinish: function (sender) {
  22195. gridChanged(me, sender);
  22196. },
  22197. },
  22198. columns: [
  22199. {
  22200. dataIndex: 'field',
  22201. header: '字段', sortable: false, menuDisabled: true,
  22202. width: 190,
  22203. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22204. var column = context.column;
  22205. var propertyConfig = me.config.propertyConfig;
  22206. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22207. var field = record.get('field');
  22208. if (field) {
  22209. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22210. if (idx >= 0) {
  22211. var meta = propertyConfig[idx];
  22212. return meta.text;
  22213. }
  22214. }
  22215. return value;
  22216. }
  22217. },
  22218. {
  22219. dataIndex: 'operator',
  22220. header: '运算符', sortable: false, menuDisabled: true,
  22221. dict: 'operator',
  22222. width: 65,
  22223. editor: { xtype: 'combo' },
  22224. },
  22225. {
  22226. dataIndex: 'value',
  22227. header: '值', sortable: false, menuDisabled: true,
  22228. flex: 1,
  22229. getEditor: function (record) {
  22230. var column = this;
  22231. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22232. var propertyConfig = me.config.propertyConfig;
  22233. var field = record.get('field');
  22234. if (!field) {
  22235. // 没有填 propertyName
  22236. return;
  22237. }
  22238. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22239. if (idx < 0) {
  22240. console.error('没有找到 field=' + field + ". propertyConfig");
  22241. return;
  22242. }
  22243. var meta = propertyConfig[idx];
  22244. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22245. return new Ext.grid.CellEditor({
  22246. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22247. });
  22248. }
  22249. return new Ext.grid.CellEditor({
  22250. field: __assign({ dict: meta.dict }, meta.editor)
  22251. });
  22252. },
  22253. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22254. var column = context.column;
  22255. var grid = _$2.get(view, 'ownerGrid');
  22256. var propertyConfig = me.config.propertyConfig;
  22257. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22258. var field = record.get('field');
  22259. if (field) {
  22260. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22261. if (idx >= 0) {
  22262. var meta = propertyConfig[idx];
  22263. var dictName = _$2.get(meta, 'dict');
  22264. if (dictName && window['DICT_CACHE'][dictName]) {
  22265. var dict_1 = window['DICT_CACHE'][dictName];
  22266. var valueText_1 = [];
  22267. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22268. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22269. if (idxKv >= 0) {
  22270. valueText_1.push(dict_1[idxKv].text);
  22271. }
  22272. else {
  22273. valueText_1.push(value);
  22274. }
  22275. });
  22276. return valueText_1.join(',');
  22277. }
  22278. }
  22279. }
  22280. return valueList;
  22281. },
  22282. },
  22283. ]
  22284. },
  22285. {
  22286. title: 'SQL模式',
  22287. key: 'sql',
  22288. xtype: 'sqleditor',
  22289. reference: reference + '_sql',
  22290. listeners: {
  22291. change: function (sender) {
  22292. var scope = lookupScope(me);
  22293. // 保存 editor 写入的值
  22294. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22295. }
  22296. }
  22297. },
  22298. ]
  22299. }
  22300. ] });
  22301. this.superclass.constructor.call(this, newConfig);
  22302. },
  22303. initComponent: function () {
  22304. // 货位条件树
  22305. var me = this;
  22306. me.superclass.initComponent.apply(this, arguments);
  22307. var tree = this.down('yvtree');
  22308. var config = me.config;
  22309. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22310. },
  22311. });
  22312. function gridChanged(me, grid) {
  22313. var data = grid.getDataRows();
  22314. var propertyConfig = me.config.propertyConfig;
  22315. var bindValue = me.config.bindValue;
  22316. var scope = lookupScope(me);
  22317. var sql = parseGridToSql(data);
  22318. scope.viewModel.set(bindValue, sql);
  22319. }
  22320. /**
  22321. * 用于从 propertyConfig 解析出树形结构
  22322. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22323. * ->
  22324. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22325. */
  22326. function buildConfigTree(propertyConfig) {
  22327. var root = {
  22328. expanded: true,
  22329. leaf: false,
  22330. children: []
  22331. };
  22332. var categoryObj = {};
  22333. var cfgList = propertyConfig;
  22334. _$2.forEach(cfgList, function (cfg) {
  22335. var cateNode = categoryObj[cfg.category];
  22336. if (!cateNode) {
  22337. cateNode = {
  22338. text: cfg.category, expanded: true, leaf: false,
  22339. children: []
  22340. };
  22341. categoryObj[cfg.category] = cateNode;
  22342. root.children.push(cateNode);
  22343. }
  22344. cateNode.children.push({
  22345. text: cfg.text,
  22346. field: cfg.field,
  22347. operator: cfg.operator,
  22348. defaultValue: cfg.defaultValue,
  22349. leaf: true,
  22350. });
  22351. });
  22352. return root;
  22353. }
  22354. /**
  22355. * 将表格变成 SQL where语句 [
  22356. * {field: 'f1', value: 1, operator: '='}
  22357. * {field: 'f2', value: 2, operator: '='}
  22358. * {field: 'f3', value: '3', operator: '>='}
  22359. * {field: 'f4', value: 4, operator: '='}
  22360. * ]
  22361. * ->
  22362. * f1=v1 and f2=v2
  22363. */
  22364. function parseGridToSql(list) {
  22365. var sqls = [];
  22366. _$2.forEach(list, function (i) {
  22367. var _a;
  22368. if (i.operator === 'in') {
  22369. sqls.push(i.field + ' in (' + (i.value) + ')');
  22370. }
  22371. else if (i.operator === 'notIn') {
  22372. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22373. }
  22374. else {
  22375. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22376. }
  22377. });
  22378. return sqls.join(' AND ');
  22379. }
  22380. /**
  22381. * 将 SQL 语句的 where 片段变成表格
  22382. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22383. * @return [
  22384. {field: 'f1', value: 1, operator: '='}
  22385. {field: 'f2', value: 2, operator: '='}
  22386. {field: 'f3', value: '3', operator: '>='}
  22387. {field: 'f4', value: 4, operator: '='}
  22388. ]
  22389. */
  22390. function parseSqlToGrid(sql) {
  22391. if (!sql || !_$2.trim(sql)) {
  22392. return [];
  22393. }
  22394. var parser = new window['NodeSQLParser'].Parser();
  22395. var ast = parser.astify('select * from dual where ' + sql);
  22396. var ret = [];
  22397. exp(ast.where, ret);
  22398. return ret;
  22399. }
  22400. function exp(ast, ret) {
  22401. if (ast.type === 'binary_expr') {
  22402. if (_$2.toUpper(ast.operator) === 'AND') {
  22403. if (ast.left.type === 'binary_expr') {
  22404. exp(ast.left, ret);
  22405. }
  22406. if (ast.right.type === 'binary_expr') {
  22407. exp(ast.right, ret);
  22408. }
  22409. }
  22410. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22411. if (ast.left.type === 'column_ref') {
  22412. if (ast.right.type === 'number' ||
  22413. ast.right.type === 'single_quote_string' ||
  22414. ast.right.type === 'double_quote_string') {
  22415. // 具体值相等
  22416. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22417. }
  22418. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22419. && ast.right.type === 'expr_list') {
  22420. // in / not in
  22421. var valueList_1 = [];
  22422. _$2.forEach(ast.right.value, function (item) {
  22423. valueList_1.push(item.value);
  22424. });
  22425. var operator = void 0;
  22426. if (_$2.toUpper(ast.operator) === 'IN') {
  22427. operator = 'in';
  22428. }
  22429. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22430. operator = 'notIn';
  22431. }
  22432. ret.push({
  22433. field: ast.left.column, value: valueList_1.join(','),
  22434. operator: operator
  22435. });
  22436. }
  22437. else {
  22438. throw new Error('ast.right must is value.');
  22439. }
  22440. }
  22441. else {
  22442. throw new Error('ast.left must is column_ref.');
  22443. }
  22444. }
  22445. else {
  22446. // 必须用 AND 条件符匹配
  22447. throw new Error('ast.operator must is "AND / =".');
  22448. }
  22449. }
  22450. else {
  22451. throw new Error('ast.type must is "binary_expr".');
  22452. }
  22453. }
  22454. /**
  22455. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22456. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22457. {
  22458. type: 'binary_expr',
  22459. operator: 'AND',
  22460. left: {
  22461. type: 'binary_expr',
  22462. operator: 'AND',
  22463. left: {
  22464. type: 'binary_expr',
  22465. operator: 'AND',
  22466. left: {
  22467. type: 'binary_expr',
  22468. operator: 'AND',
  22469. left: {
  22470. type: 'binary_expr',
  22471. operator: '=',
  22472. left: {
  22473. type: 'column_ref',
  22474. table: null,
  22475. column: 'f1'
  22476. },
  22477. right: {
  22478. type: 'number',
  22479. value: 1
  22480. }
  22481. },
  22482. right: {
  22483. type: 'binary_expr',
  22484. operator: '=',
  22485. left: {
  22486. type: 'column_ref',
  22487. table: null,
  22488. column: 'f2'
  22489. },
  22490. right: {
  22491. type: 'number',
  22492. value: 2
  22493. }
  22494. }
  22495. },
  22496. right: {
  22497. type: 'binary_expr',
  22498. operator: '=',
  22499. left: {
  22500. type: 'column_ref',
  22501. table: null,
  22502. column: 'f3'
  22503. },
  22504. right: {
  22505. type: 'single_quote_string',
  22506. value: '3'
  22507. }
  22508. }
  22509. },
  22510. right: {
  22511. type: 'binary_expr',
  22512. operator: '>=',
  22513. left: {
  22514. type: 'column_ref',
  22515. table: null,
  22516. column: 'f4'
  22517. },
  22518. right: {
  22519. type: 'number',
  22520. value: 4
  22521. }
  22522. }
  22523. },
  22524. right: {
  22525. type: 'binary_expr',
  22526. operator: '<',
  22527. left: {
  22528. type: 'column_ref',
  22529. table: null,
  22530. column: 'f4'
  22531. },
  22532. right: {
  22533. type: 'number',
  22534. value: 3
  22535. }
  22536. }
  22537. }
  22538. * */
  22539. }
  22540. //# sourceMappingURL=SqlComplex.js.map
  22541. function initParamComplex () {
  22542. Ext.define('Yvan.ParamComplex', {
  22543. extend: 'Ext.panel.Panel',
  22544. xtype: 'paramcomplex',
  22545. alias: 'widget.paramcomplex',
  22546. getSqlExpress: function () {
  22547. },
  22548. constructor: function (config) {
  22549. var reference = config.reference;
  22550. var me = this;
  22551. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22552. {
  22553. region: 'west',
  22554. width: 280,
  22555. border: false,
  22556. split: true,
  22557. reference: reference + '_tree',
  22558. xtype: 'yvtree',
  22559. hideRefresh: true,
  22560. hideExpand: true,
  22561. hideCollapse: true,
  22562. listeners: {
  22563. itemdblclick: function (sender, record, item, index, e) {
  22564. var field = record.get('field');
  22565. var defaultValue = record.get('defaultValue');
  22566. if (!field) {
  22567. return;
  22568. }
  22569. var tabExpress = me.down('tabpanel');
  22570. var sqleditor = me.down('sqleditor');
  22571. var expressGrid = me.down('yvgrid');
  22572. if (tabExpress.getActiveTab().key !== 'grid') {
  22573. // SQL 模式
  22574. sqleditor.insertText(field + '=');
  22575. }
  22576. else {
  22577. // 表格模式
  22578. expressGrid.appendEditRow({
  22579. field: field,
  22580. operator: '=',
  22581. value: defaultValue,
  22582. remark: '',
  22583. });
  22584. _$2.defer(function () {
  22585. gridChanged(me, expressGrid);
  22586. });
  22587. }
  22588. }
  22589. },
  22590. },
  22591. {
  22592. region: 'center',
  22593. xtype: 'tabpanel',
  22594. reference: reference + '_tab',
  22595. tabPosition: 'bottom',
  22596. listeners: {
  22597. afterrender: function (sender) {
  22598. var scope = lookupScope(me);
  22599. var value = scope.viewModel.get(me.config.bindValue);
  22600. // sql 转换为 grid
  22601. try {
  22602. var list_1 = parseParamToGrid(value);
  22603. _$2.defer(function () {
  22604. var grid = me.down('yvgrid');
  22605. grid.setData(list_1);
  22606. });
  22607. }
  22608. catch (e) {
  22609. console.error(e);
  22610. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22611. var tabSql = sender.down('sqleditor');
  22612. sender.setActiveTab(tabSql);
  22613. }
  22614. },
  22615. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22616. var scope = lookupScope(me);
  22617. var value = scope.viewModel.get(me.config.bindValue);
  22618. if (newCard.key === 'grid') {
  22619. // sql 转换为 grid
  22620. try {
  22621. var list_2 = parseParamToGrid(value);
  22622. _$2.defer(function () {
  22623. var grid = me.down('yvgrid');
  22624. grid.setData(list_2);
  22625. });
  22626. return true;
  22627. }
  22628. catch (e) {
  22629. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22630. console.error(e);
  22631. return false;
  22632. }
  22633. }
  22634. else if (newCard.key === 'sql') {
  22635. // grid 转换为 sql
  22636. _$2.defer(function () {
  22637. var editor = me.down('sqleditor');
  22638. editor.setValue(value);
  22639. });
  22640. return true;
  22641. }
  22642. }
  22643. },
  22644. items: [
  22645. {
  22646. title: '表格模式',
  22647. key: 'grid',
  22648. xtype: 'yvgrid',
  22649. _mode: 'select',
  22650. reference: reference + '_grid',
  22651. hideFootbar: true,
  22652. pagination: false,
  22653. tbar: [
  22654. {
  22655. xtype: 'button',
  22656. text: '删除',
  22657. iconCls: 'x-fa fa-minus-circle',
  22658. cls: 'ext-btn-danger',
  22659. bind: {
  22660. disabled: '{!' + reference + '_grid.selection}',
  22661. },
  22662. listeners: {
  22663. click: function (sender) {
  22664. var grid = sender.up('yvgrid');
  22665. removeGridRow(grid);
  22666. gridChanged(me, grid);
  22667. }
  22668. },
  22669. },
  22670. ],
  22671. store: {},
  22672. listeners: {
  22673. editfinish: function (sender) {
  22674. gridChanged(me, sender);
  22675. },
  22676. },
  22677. columns: [
  22678. {
  22679. dataIndex: 'field',
  22680. header: '字段', sortable: false, menuDisabled: true,
  22681. width: 190,
  22682. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22683. var column = context.column;
  22684. var propertyConfig = me.config.propertyConfig;
  22685. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22686. var field = record.get('field');
  22687. if (field) {
  22688. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22689. if (idx >= 0) {
  22690. var meta = propertyConfig[idx];
  22691. return meta.text;
  22692. }
  22693. }
  22694. return value;
  22695. }
  22696. },
  22697. {
  22698. dataIndex: 'value',
  22699. header: '值', sortable: false, menuDisabled: true,
  22700. flex: 1,
  22701. getEditor: function (record) {
  22702. var column = this;
  22703. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22704. var propertyConfig = me.config.propertyConfig;
  22705. var field = record.get('field');
  22706. if (!field) {
  22707. // 没有填 propertyName
  22708. return;
  22709. }
  22710. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22711. if (idx < 0) {
  22712. console.error('没有找到 field=' + field + ". propertyConfig");
  22713. return;
  22714. }
  22715. var meta = propertyConfig[idx];
  22716. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22717. return new Ext.grid.CellEditor({
  22718. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22719. });
  22720. }
  22721. return new Ext.grid.CellEditor({
  22722. field: __assign({ dict: meta.dict }, meta.editor)
  22723. });
  22724. },
  22725. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22726. var column = context.column;
  22727. var grid = _$2.get(view, 'ownerGrid');
  22728. var propertyConfig = me.config.propertyConfig;
  22729. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22730. var field = record.get('field');
  22731. if (field) {
  22732. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22733. if (idx >= 0) {
  22734. var meta = propertyConfig[idx];
  22735. var dictName = _$2.get(meta, 'dict');
  22736. if (dictName && window['DICT_CACHE'][dictName]) {
  22737. var dict_1 = window['DICT_CACHE'][dictName];
  22738. var valueText_1 = [];
  22739. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22740. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22741. if (idxKv >= 0) {
  22742. valueText_1.push(dict_1[idxKv].text);
  22743. }
  22744. else {
  22745. valueText_1.push(value);
  22746. }
  22747. });
  22748. return valueText_1.join(',');
  22749. }
  22750. }
  22751. }
  22752. return valueList;
  22753. },
  22754. },
  22755. ]
  22756. },
  22757. {
  22758. title: '文本模式',
  22759. key: 'sql',
  22760. xtype: 'sqleditor',
  22761. reference: reference + '_sql',
  22762. listeners: {
  22763. change: function (sender) {
  22764. var scope = lookupScope(me);
  22765. // 保存 editor 写入的值
  22766. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22767. }
  22768. }
  22769. },
  22770. ]
  22771. }
  22772. ] });
  22773. this.superclass.constructor.call(this, newConfig);
  22774. },
  22775. initComponent: function () {
  22776. // 货位条件树
  22777. var me = this;
  22778. me.superclass.initComponent.apply(this, arguments);
  22779. var tree = this.down('yvtree');
  22780. var config = me.config;
  22781. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22782. },
  22783. });
  22784. function gridChanged(me, grid) {
  22785. var data = grid.getDataRows();
  22786. var propertyConfig = me.config.propertyConfig;
  22787. var bindValue = me.config.bindValue;
  22788. var scope = lookupScope(me);
  22789. var sql = parseGridToParam(data);
  22790. scope.viewModel.set(bindValue, sql);
  22791. }
  22792. /**
  22793. * 用于从 propertyConfig 解析出树形结构
  22794. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22795. * ->
  22796. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22797. */
  22798. function buildConfigTree(propertyConfig) {
  22799. var root = {
  22800. expanded: true,
  22801. leaf: false,
  22802. children: []
  22803. };
  22804. var categoryObj = {};
  22805. var cfgList = propertyConfig;
  22806. _$2.forEach(cfgList, function (cfg) {
  22807. var cateNode = categoryObj[cfg.category];
  22808. if (!cateNode) {
  22809. cateNode = {
  22810. text: cfg.category, expanded: true, leaf: false,
  22811. children: []
  22812. };
  22813. categoryObj[cfg.category] = cateNode;
  22814. root.children.push(cateNode);
  22815. }
  22816. cateNode.children.push({
  22817. text: cfg.text,
  22818. field: cfg.field,
  22819. operator: cfg.operator,
  22820. defaultValue: cfg.defaultValue,
  22821. leaf: true,
  22822. });
  22823. });
  22824. return root;
  22825. }
  22826. /**
  22827. * 将表格变成参数语句 [
  22828. * {field: 'f1', value: 1}
  22829. * {field: 'f2', value: 2}
  22830. * {field: 'f3', value: '3'}
  22831. * {field: 'f4', value: 4}
  22832. * ]
  22833. * ->
  22834. * f1=v1, f2=v2
  22835. */
  22836. function parseGridToParam(list) {
  22837. var sqls = [];
  22838. _$2.forEach(list, function (i) {
  22839. sqls.push(i.field + '=' + (i.value));
  22840. });
  22841. return sqls.join('; ');
  22842. }
  22843. /**
  22844. * 将 分号分割的的参数设置 变成表格
  22845. * @param param a=1; b=2; c='3'
  22846. * @return [
  22847. {field: 'a', value: 1}
  22848. {field: 'b', value: 2}
  22849. {field: 'c', value: '3'}
  22850. ]
  22851. */
  22852. function parseParamToGrid(param) {
  22853. if (!param || !_$2.trim(param)) {
  22854. return [];
  22855. }
  22856. var ret = [];
  22857. var sp = _$2.split(param, ';');
  22858. _$2.forEach(sp, function (v) {
  22859. var vi = _$2.indexOf(v, '=');
  22860. var field = _$2.trim(v.substr(0, vi));
  22861. var value = eval(v.substr(vi + 1));
  22862. ret.push({ field: field, value: value });
  22863. });
  22864. return ret;
  22865. }
  22866. }
  22867. //# sourceMappingURL=ParamComplex.js.map
  22868. function initSqlEditor () {
  22869. Ext.define('com.yvan.studio.SqlEditor', {
  22870. extend: 'Ext.panel.Panel',
  22871. alias: 'widget.sqleditor',
  22872. xtype: 'sqleditor',
  22873. layout: 'fit',
  22874. border: false,
  22875. html: "<div class=\"editor\"/>",
  22876. config: {
  22877. value: ''
  22878. },
  22879. codeChange: undefined,
  22880. isChangeFromOuter: false,
  22881. setCode: function (value) {
  22882. var _this = this;
  22883. this.code = value;
  22884. this.value = value;
  22885. _$2.defer(function () {
  22886. _this.isChangeFromOuter = true;
  22887. if (_this.editor) {
  22888. _this.editor.setValue(value);
  22889. }
  22890. });
  22891. },
  22892. getCode: function () {
  22893. return this.getValue();
  22894. },
  22895. updateOptions: function (options) {
  22896. if (this.editor && options) {
  22897. this.editor.updateOptions(options);
  22898. }
  22899. },
  22900. getValue: function () {
  22901. if (!this.editor) {
  22902. return this.code;
  22903. }
  22904. return this.editor.getValue();
  22905. },
  22906. applyPosition: function () {
  22907. var _this = this;
  22908. if (this.autoFocusMethod) {
  22909. if (this.editor) {
  22910. _$2.defer(function () {
  22911. if (_this.autoFocusStartLine) {
  22912. _this.editor.setPosition({
  22913. lineNumber: _this.autoFocusStartLine,
  22914. column: _this.autoFocusStartColumn
  22915. });
  22916. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22917. }
  22918. _this.editor.focus();
  22919. });
  22920. delete this.autoFocusMethod;
  22921. }
  22922. }
  22923. this.editor.layout();
  22924. },
  22925. insertText: function (text) {
  22926. var editor = this.editor;
  22927. var position = editor.getPosition();
  22928. editor.executeEdits('', [
  22929. {
  22930. range: {
  22931. startLineNumber: position.lineNumber,
  22932. startColumn: position.column,
  22933. endLineNumber: position.lineNumber,
  22934. endColumn: position.column
  22935. },
  22936. text: text
  22937. }
  22938. ]);
  22939. },
  22940. setValue: function (value, fromEditor) {
  22941. this.setCode(value);
  22942. var me = this;
  22943. if (me.value === value) {
  22944. // 值相等,不需要变化
  22945. return;
  22946. }
  22947. if (fromEditor !== true && me.editor) {
  22948. // 不是来源于编辑器的变化,才设置编辑器的值
  22949. me.editor.setValue(value);
  22950. }
  22951. // 通知mixins setValue
  22952. me.value = value;
  22953. me.fireEvent('change', value);
  22954. },
  22955. initComponent: function () {
  22956. var that = this;
  22957. this.superclass.initComponent.call(this);
  22958. that.on({
  22959. resize: function () {
  22960. if (that.editor) {
  22961. that.editor.layout();
  22962. }
  22963. },
  22964. destory: function () {
  22965. if (that.editor) {
  22966. that.editor.dispose();
  22967. delete that.editor;
  22968. }
  22969. },
  22970. afterrender: function (sender) {
  22971. var $dom = $(that.el.dom).find('.editor');
  22972. attach_2($dom[0], {
  22973. value: that.code
  22974. }).then(function (editor) {
  22975. that.editor = editor;
  22976. that.applyPosition();
  22977. that.editor.onDidChangeModelContent(function (e) {
  22978. that.fireEvent('change', that.editor, e);
  22979. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22980. that.codeChange(that.editor.getValue(), that.name, e);
  22981. }
  22982. that.isChangeFromOuter = false;
  22983. });
  22984. });
  22985. }
  22986. });
  22987. }
  22988. });
  22989. function attach_2(element, opts) {
  22990. if (!window['monaco']) {
  22991. return;
  22992. }
  22993. var monaco = window['monaco'];
  22994. return new Promise(function (resolve) {
  22995. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  22996. enabled: false
  22997. } }));
  22998. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  22999. // const sql = editor.getValue()
  23000. // if (_.trim(sql).length > 0) {
  23001. // editor.setValue(format(sql, {
  23002. // indent: ' ',
  23003. // uppercase: true,
  23004. // }))
  23005. // }
  23006. // })
  23007. editor.onKeyUp(function (e) {
  23008. // console.log(e)
  23009. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23010. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23011. }
  23012. });
  23013. resolve(editor);
  23014. });
  23015. }
  23016. }
  23017. //# sourceMappingURL=SqlEditor.js.map
  23018. function initJsonEditor () {
  23019. Ext.define('com.yvan.studio.JsonEditor', {
  23020. extend: 'Ext.panel.Panel',
  23021. alias: 'widget.jsoneditor',
  23022. xtype: 'jsoneditor',
  23023. layout: 'fit',
  23024. border: false,
  23025. html: "<div class=\"editor\"/>",
  23026. autoFocusMethod: true,
  23027. autoFocusStartLine: 0,
  23028. autoFocusStartColumn: 0,
  23029. codeChange: undefined,
  23030. funcArr: [],
  23031. modulePage: null,
  23032. isChangeFromOuter: false,
  23033. name: "",
  23034. /**
  23035. * 设置代码
  23036. */
  23037. setCode: function (value) {
  23038. var _this = this;
  23039. this.code = value;
  23040. _$2.defer(function () {
  23041. _this.isChangeFromOuter = true;
  23042. if (_this.editor) {
  23043. _this.editor.setValue(value);
  23044. }
  23045. });
  23046. },
  23047. updateOptions: function (options) {
  23048. if (this.editor && options) {
  23049. this.editor.updateOptions(options);
  23050. }
  23051. },
  23052. setLanguage: function (lang) {
  23053. if (!window['monaco']) {
  23054. return;
  23055. }
  23056. var monaco = window['monaco'];
  23057. if (this.editor && lang) {
  23058. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  23059. }
  23060. },
  23061. getCode: function () {
  23062. var _a;
  23063. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23064. },
  23065. applyPosition: function () {
  23066. var _this = this;
  23067. if (this.autoFocusMethod) {
  23068. if (this.editor) {
  23069. _$2.defer(function () {
  23070. if (_this.autoFocusStartLine) {
  23071. _this.editor.setPosition({
  23072. lineNumber: _this.autoFocusStartLine,
  23073. column: _this.autoFocusStartColumn
  23074. });
  23075. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23076. }
  23077. _this.editor.focus();
  23078. });
  23079. delete this.autoFocusMethod;
  23080. }
  23081. }
  23082. this.editor.layout();
  23083. },
  23084. initComponent: function () {
  23085. var that = this;
  23086. this.superclass.initComponent.apply(this, arguments);
  23087. this.on({
  23088. resize: function (sender, width, height) {
  23089. if (that.editor) {
  23090. that.editor.layout();
  23091. }
  23092. },
  23093. destory: function () {
  23094. if (that.editor) {
  23095. that.editor.dispose();
  23096. delete that.editor;
  23097. }
  23098. },
  23099. afterrender: function (sender) {
  23100. var $dom = $(that.el.dom).find('.editor');
  23101. attach_116($dom[0], {
  23102. value: that.code
  23103. }).then(function (editor) {
  23104. that.editor = editor;
  23105. that.applyPosition();
  23106. that.editor.onDidChangeModelContent(function (e) {
  23107. that.fireEvent('change', that.editor, e);
  23108. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23109. that.codeChange(that.editor.getValue(), that.name, e);
  23110. }
  23111. that.isChangeFromOuter = false;
  23112. });
  23113. });
  23114. }
  23115. });
  23116. },
  23117. });
  23118. function attach_116(element, opts) {
  23119. if (!window['monaco']) {
  23120. return;
  23121. }
  23122. var monaco = window['monaco'];
  23123. return new Promise(function (resolve) {
  23124. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23125. enabled: false
  23126. } }));
  23127. editor.onKeyUp(function (e) {
  23128. // console.log(e)
  23129. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23130. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23131. }
  23132. });
  23133. resolve(editor);
  23134. });
  23135. }
  23136. }
  23137. //# sourceMappingURL=JsonEditor.js.map
  23138. function initJsEditor () {
  23139. Ext.define('com.yvan.studio.JsEditor', {
  23140. extend: 'Ext.panel.Panel',
  23141. alias: 'widget.jseditor',
  23142. xtype: 'jseditor',
  23143. layout: 'fit',
  23144. border: false,
  23145. html: "<div class=\"editor\"/>",
  23146. autoFocusMethod: true,
  23147. autoFocusStartLine: 0,
  23148. autoFocusStartColumn: 0,
  23149. codeChange: undefined,
  23150. funcArr: [],
  23151. modulePage: null,
  23152. isChangeFromOuter: false,
  23153. name: "",
  23154. /**
  23155. * 设置代码
  23156. */
  23157. setCode: function (value) {
  23158. var _this = this;
  23159. this.code = value;
  23160. _$2.defer(function () {
  23161. _this.isChangeFromOuter = true;
  23162. if (_this.editor) {
  23163. _this.editor.setValue(value);
  23164. if (_this.name === "controllerEditor") {
  23165. _this.funcArr = _this.getAllFunction();
  23166. }
  23167. }
  23168. });
  23169. },
  23170. getCode: function () {
  23171. var _a;
  23172. if (!this.editor) {
  23173. return this.code;
  23174. }
  23175. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23176. },
  23177. applyPosition: function () {
  23178. var _this = this;
  23179. if (this.autoFocusMethod) {
  23180. if (this.editor) {
  23181. _$2.defer(function () {
  23182. if (_this.autoFocusStartLine) {
  23183. _this.editor.setPosition({
  23184. lineNumber: _this.autoFocusStartLine,
  23185. column: _this.autoFocusStartColumn
  23186. });
  23187. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23188. }
  23189. _this.editor.focus();
  23190. });
  23191. delete this.autoFocusMethod;
  23192. }
  23193. }
  23194. this.editor.layout();
  23195. },
  23196. initComponent: function () {
  23197. var that = this;
  23198. this.superclass.initComponent.apply(this, arguments);
  23199. this.on({
  23200. resize: function (sender, width, height) {
  23201. if (that.editor) {
  23202. that.editor.layout();
  23203. }
  23204. },
  23205. destory: function () {
  23206. if (that.editor) {
  23207. that.editor.dispose();
  23208. delete that.editor;
  23209. }
  23210. },
  23211. afterrender: function () {
  23212. var $dom = $(that.el.dom).find('.editor');
  23213. attach_1($dom[0], {
  23214. value: that.code
  23215. }).then(function (editor) {
  23216. that.editor = editor;
  23217. that.applyPosition();
  23218. that.editor.onDidChangeModelContent(function (e) {
  23219. that.fireEvent('change', that.editor, e);
  23220. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23221. that.codeChange(that.editor.getValue(), that.name, e);
  23222. }
  23223. that.isChangeFromOuter = false;
  23224. });
  23225. });
  23226. }
  23227. });
  23228. },
  23229. getAllFunction: function () {
  23230. var funcArr = [];
  23231. var ast = window['YvanUI'].recast.parse(this.code);
  23232. if (ast && ast.program && ast.program.body) {
  23233. if (Array.isArray(ast.program.body)) {
  23234. for (var i = 0; i < ast.program.body.length; i++) {
  23235. var m = ast.program.body[i];
  23236. if (m.type === "ExportDefaultDeclaration") {
  23237. if (m.declaration.type === "ClassDeclaration") {
  23238. if (m.declaration.body.type === "ClassBody") {
  23239. if (Array.isArray(m.declaration.body.body)) {
  23240. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23241. var ob = m.declaration.body.body[j];
  23242. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23243. var funcItem = { name: ob.key.name, args: [] };
  23244. if (Array.isArray(ob.value.params)) {
  23245. for (var k = 0; k < ob.value.params.length; k++) {
  23246. var p = ob.value.params[k];
  23247. funcItem.args.push(p.name);
  23248. }
  23249. }
  23250. funcArr.push(funcItem);
  23251. }
  23252. }
  23253. }
  23254. }
  23255. }
  23256. }
  23257. }
  23258. }
  23259. }
  23260. return funcArr;
  23261. }
  23262. });
  23263. var isInited = false;
  23264. function attach_1(element, opts) {
  23265. if (!window['monaco']) {
  23266. return;
  23267. }
  23268. var monaco = window['monaco'];
  23269. return new Promise(function (resolve) {
  23270. if (!isInited) {
  23271. isInited = true;
  23272. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23273. noSemanticValidation: true,
  23274. noSyntaxValidation: false
  23275. });
  23276. // compiler options
  23277. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23278. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23279. allowNonTsExtensions: true,
  23280. });
  23281. // extra libraries
  23282. var libSource = [
  23283. 'declare class Facts {',
  23284. ' /**',
  23285. ' * Returns the next fact',
  23286. ' */',
  23287. ' static next():string',
  23288. ' static next222():string',
  23289. '}',
  23290. "\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 ",
  23291. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23292. ].join('\n');
  23293. var libUri = 'file:///index.d.ts';
  23294. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23295. // When resolving definitions and references, the editor will try to use created models.
  23296. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23297. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23298. }
  23299. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23300. resolve(editor);
  23301. });
  23302. }
  23303. }
  23304. //# sourceMappingURL=JsEditor.js.map
  23305. function initClipboard () {
  23306. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23307. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23308. Ext.grid.plugin.Clipboard.override({
  23309. getCellData: function (format, erase) {
  23310. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23311. if (selection) {
  23312. selection.eachCell(function (cellContext) {
  23313. column = cellContext.column;
  23314. view = cellContext.column.getView();
  23315. record = cellContext.record;
  23316. // Do not copy the check column or row numberer column
  23317. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23318. return;
  23319. }
  23320. if (lastRecord !== record) {
  23321. lastRecord = record;
  23322. ret.push(row = []);
  23323. }
  23324. dataIndex = column.dataIndex;
  23325. // 记录原始数据
  23326. var rData = record.data[dataIndex];
  23327. if (isRaw) {
  23328. data = record.data[dataIndex];
  23329. }
  23330. else {
  23331. // Try to access the view node.
  23332. viewNode = view.all.item(cellContext.rowIdx);
  23333. // If we could not, it's because it's outside of the rendered block -
  23334. // recreate it.
  23335. if (!viewNode) {
  23336. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23337. }
  23338. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23339. data = cell.innerHTML;
  23340. if (isText) {
  23341. data = Ext.util.Format.stripTags(data);
  23342. }
  23343. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23344. data = data || rData;
  23345. }
  23346. row.push(data);
  23347. if (erase && dataIndex) {
  23348. record.set(dataIndex, null);
  23349. }
  23350. });
  23351. }
  23352. // See decode() comment below
  23353. return Ext.util.TSV.encode(ret, undefined, null);
  23354. },
  23355. getCells: function (format, erase) {
  23356. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23357. if (selection) {
  23358. selection.eachCell(function (cellContext) {
  23359. record = cellContext.record;
  23360. if (lastRecord !== record) {
  23361. lastRecord = record;
  23362. ret.push(row = {
  23363. model: record.self,
  23364. fields: []
  23365. });
  23366. }
  23367. dataIndex = cellContext.column.dataIndex;
  23368. row.fields.push({
  23369. name: dataIndex,
  23370. value: record.data[dataIndex]
  23371. });
  23372. if (erase && dataIndex) {
  23373. record.set(dataIndex, null);
  23374. }
  23375. });
  23376. }
  23377. return ret;
  23378. },
  23379. getTextData: function (format, erase) {
  23380. return this.getCellData(format, erase);
  23381. },
  23382. putCellData: function (data, format) {
  23383. var _a;
  23384. 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 = {};
  23385. // If the view is not focused, use the first cell of the selection as the destination.
  23386. if (!destination && selected) {
  23387. selected.eachCell(function (c) {
  23388. destination = c;
  23389. return false;
  23390. });
  23391. }
  23392. if (destination) {
  23393. // Create a new Context based upon the outermost View.
  23394. // NavigationModel works on local views.
  23395. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23396. // At that point, we can use navModel.getPosition()
  23397. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23398. }
  23399. else {
  23400. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23401. }
  23402. destinationStartColumn = destination.colIdx;
  23403. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23404. row = values[sourceRowIdx];
  23405. // Collect new values in dataObject
  23406. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23407. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23408. continue;
  23409. }
  23410. dataIndex = destination.column.dataIndex;
  23411. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23412. if (dataIndex) {
  23413. switch (format) {
  23414. // Raw field values
  23415. case 'raw':
  23416. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23417. break;
  23418. // Textual data with HTML tags stripped
  23419. case 'text':
  23420. {
  23421. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23422. // 获取字典原始的value
  23423. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23424. }
  23425. else {
  23426. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23427. }
  23428. break;
  23429. }
  23430. }
  23431. }
  23432. // If we are at the end of the destination row, break the column loop.
  23433. if (destination.colIdx === maxColIdx) {
  23434. break;
  23435. }
  23436. destination.setColumn(destination.colIdx + 1);
  23437. }
  23438. // Update the record in one go.
  23439. destination.record.set(dataObject);
  23440. // If we are at the end of the destination store, break the row loop.
  23441. if (destination.rowIdx === maxRowIdx) {
  23442. break;
  23443. }
  23444. // Jump to next row in destination
  23445. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23446. }
  23447. },
  23448. putTextData: function (data, format) {
  23449. var _a, _b, _c;
  23450. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23451. // 根据复制的行数自动添加新的行
  23452. 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;
  23453. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23454. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23455. this.cmp.getStore().add({});
  23456. }
  23457. }
  23458. this.putCellData(data, format);
  23459. },
  23460. });
  23461. }
  23462. //# sourceMappingURL=clipboard.js.map
  23463. function initDict () {
  23464. var DICT_CACHE = window['DICT_CACHE'];
  23465. if (!DICT_CACHE) {
  23466. DICT_CACHE = {};
  23467. window['DICT_CACHE'] = DICT_CACHE;
  23468. }
  23469. DICT_CACHE.XTYPE = [
  23470. { id: 'datefield', text: '日期' },
  23471. { id: 'datetimefield', text: '日期时间' },
  23472. { id: 'textfield', text: '文本' },
  23473. { id: 'numberfield', text: '数字' },
  23474. { id: 'combo', text: '下拉框' },
  23475. ];
  23476. DICT_CACHE.operator = [
  23477. { id: '=', text: '=' },
  23478. { id: '>', text: '>' },
  23479. { id: '<', text: '<' },
  23480. { id: '>=', text: '>=' },
  23481. { id: '<=', text: '<=' },
  23482. { id: 'in', text: 'in' },
  23483. { id: 'notIn', text: 'notIn' },
  23484. ];
  23485. DICT_CACHE.GRID_MODE = [
  23486. { id: 'edit1', text: '单机编辑模式' },
  23487. { id: 'edit2', text: '双击编辑模式' },
  23488. { id: 'checkbox', text: '勾选' },
  23489. { id: 'checkonly', text: '只勾选' },
  23490. { id: 'select', text: '行选择模式' },
  23491. ];
  23492. DICT_CACHE.BOTH_SELECT = [
  23493. { id: 'N/A', text: '<无>' },
  23494. { id: 'textfield', text: '文本' },
  23495. { id: 'numberfield', text: '数字框' },
  23496. { id: 'datefield', text: '日期' },
  23497. { id: 'datetimefield', text: '日期时间' },
  23498. { id: 'combo', text: '下拉框' },
  23499. { id: 'combogrid', text: '下拉表' },
  23500. { id: 'checkbox', text: '勾选' },
  23501. ];
  23502. DICT_CACHE.ROW_LAYOUT = [
  23503. { id: 'flex', text: '按权重摆放' },
  23504. { id: 'hbox', text: '按宽度摆放' },
  23505. ];
  23506. DICT_CACHE.GRID_XTYPE = [
  23507. { id: 'N/A', text: '<无>' },
  23508. { id: 'textfield', text: '文本-textfield' },
  23509. { id: 'numberfield', text: '数字框-numberfield' },
  23510. { id: 'datefield', text: '日期-datefield' },
  23511. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23512. { id: 'combo', text: '下拉框-combo' },
  23513. { id: 'combogrid', text: '下拉表-combogrid' },
  23514. { id: 'checkbox', text: '勾选-checkbox' },
  23515. ];
  23516. DICT_CACHE.FORM_XTYPE = [
  23517. { id: 'N/A', text: '<无>' },
  23518. { id: 'textfield', text: '文本-textfield' },
  23519. { id: 'numberfield', text: '数字框-numberfield' },
  23520. { id: 'datefield', text: '日期-datefield' },
  23521. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23522. { id: 'combo', text: '下拉框-combo' },
  23523. { id: 'combogrid', text: '下拉表-combogrid' },
  23524. { id: 'checkbox', text: '勾选-checkbox' },
  23525. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23526. ];
  23527. DICT_CACHE.GRID_FORMATTER = [
  23528. { id: 'N/A', text: '默认' },
  23529. { id: 'rownum', text: '序号-rownum' },
  23530. { id: 'button', text: '按钮-button' },
  23531. { id: 'checkbox', text: '勾选-checkbox' },
  23532. { id: 'progres', text: '进度条-progres' },
  23533. ];
  23534. }
  23535. //# sourceMappingURL=dict.js.map
  23536. function initDesigner () {
  23537. Ext.define('com.yvan.studio.designer', {
  23538. extend: 'Ext.panel.Panel',
  23539. alias: 'widget.designer',
  23540. xtype: 'designer',
  23541. layout: 'fit',
  23542. items: [],
  23543. constructor: function (config) {
  23544. var self = this;
  23545. var newConfig = _$2.defaultsDeep({
  23546. // 强制性属性
  23547. }, config);
  23548. this.superclass.constructor.call(self, newConfig);
  23549. },
  23550. initComponent: function () {
  23551. var me = this;
  23552. me.on({
  23553. afterrender: function () {
  23554. }
  23555. });
  23556. this.superclass.initComponent.call(me);
  23557. }
  23558. });
  23559. }
  23560. //# sourceMappingURL=designer.js.map
  23561. var FixClass = /** @class */ (function () {
  23562. function FixClass() {
  23563. }
  23564. FixClass.prototype.fix = function (me, config) {
  23565. var _this = this;
  23566. if (isDesignMode(me, config)) {
  23567. return;
  23568. }
  23569. if (!config) {
  23570. return;
  23571. }
  23572. var fix = config.fix;
  23573. if (!fix) {
  23574. return;
  23575. }
  23576. delete config.fix;
  23577. // 这里有个 bug
  23578. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23579. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23580. var scope;
  23581. if (config.$initParent) {
  23582. // 在面板上的组件
  23583. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23584. }
  23585. else if (config.column) {
  23586. // 在列上的组件
  23587. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23588. }
  23589. if (_$2.isArray(fix)) {
  23590. _$2.each(fix, function (f) {
  23591. var fn = lookupFn(scope, f);
  23592. fn.call(_this, me, config);
  23593. });
  23594. }
  23595. else if (_$2.isString(fix)) {
  23596. var fn = lookupFn(scope, fix);
  23597. fn.call(this, me, config);
  23598. }
  23599. };
  23600. __decorate([
  23601. baseConfigProcess(),
  23602. __metadata("design:type", Function),
  23603. __metadata("design:paramtypes", [Object, Object]),
  23604. __metadata("design:returntype", void 0)
  23605. ], FixClass.prototype, "fix", null);
  23606. return FixClass;
  23607. }());
  23608. //# sourceMappingURL=fix.js.map
  23609. function init$1() {
  23610. // 引入 filters 过滤插件
  23611. Ext.require([
  23612. 'Ext.grid.filters.Filters'
  23613. ]);
  23614. // 启用 tooltip 快捷提示
  23615. Ext.QuickTips.init();
  23616. // 定义日期格式化方法
  23617. if (Ext.util && Ext.util.Format) {
  23618. Ext.apply(Ext.util.Format, {
  23619. dateFormat: 'Y-m-d'
  23620. });
  23621. }
  23622. Ext.form.field.Display.override({
  23623. cls: 'yvan-display-field',
  23624. labelAlign: 'right'
  23625. });
  23626. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23627. override: "Ext.picker.Date",
  23628. format: "Y-m-d",
  23629. });
  23630. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23631. override: "Ext.form.field.Date",
  23632. format: "Y-m-d",
  23633. });
  23634. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23635. override: "Ext.grid.PropertyColumnModel",
  23636. format: "Y-m-d",
  23637. });
  23638. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23639. override: "Ext.view.AbstractView",
  23640. loadingText: "读取中..."
  23641. });
  23642. Ext.LoadMask.prototype.msg = '请稍后...';
  23643. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23644. override: "Ext.grid.header.Container",
  23645. sortClearText: '不排序',
  23646. sortAscText: "正序",
  23647. sortDescText: "倒序",
  23648. lockText: "锁定列",
  23649. unlockText: "解除锁定",
  23650. columnsText: "字段隐藏"
  23651. });
  23652. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23653. override: "Ext.grid.filters.filter.Date",
  23654. fields: {
  23655. lt: { text: '之前' },
  23656. gt: { text: '之后' },
  23657. eq: { text: '相等' },
  23658. },
  23659. // Defaults to Ext.Date.defaultFormat
  23660. dateFormat: null
  23661. });
  23662. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23663. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23664. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23665. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23666. override: "Ext.grid.locking.Lockable",
  23667. lockText: "锁定",
  23668. unlockText: '解锁',
  23669. });
  23670. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23671. override: "Ext.grid.filters.Filters",
  23672. menuFilterText: "过滤"
  23673. });
  23674. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23675. override: "Ext.grid.filters.filter.Boolean",
  23676. yesText: "已钩选",
  23677. noText: "未勾选"
  23678. });
  23679. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23680. override: "Ext.grid.filters.filter.String",
  23681. emptyText: "输入过滤文本..."
  23682. });
  23683. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23684. override: "Ext.grid.filters.filter.Number",
  23685. emptyText: "输入数字..."
  23686. });
  23687. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23688. override: "Ext.PagingToolbar",
  23689. beforePageText: "第",
  23690. // update
  23691. afterPageText: "/ {0} 页",
  23692. // update
  23693. firstText: "第一页",
  23694. prevText: "上一页",
  23695. // update
  23696. nextText: "下一页",
  23697. lastText: "最后页",
  23698. refreshText: "刷新",
  23699. displayMsg: "总共 {2} 条",
  23700. // update
  23701. emptyMsg: '没有数据'
  23702. });
  23703. /**
  23704. * 改变事件的获取方式.
  23705. * 具体见: ext-all-debug.js:23216 addListener
  23706. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23707. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23708. */
  23709. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23710. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23711. if (typeof fn === 'string' &&
  23712. (_$2.startsWith(fn, 'scope.') ||
  23713. _$2.startsWith(fn, 'system.') ||
  23714. _$2.startsWith(fn, 'format.'))) {
  23715. scope = lookupScope(this);
  23716. if (isDesignMode(scope, undefined)) {
  23717. fn = Ext.emptyFn;
  23718. }
  23719. else {
  23720. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23721. // const vm = this.lookupViewModel()
  23722. // if (vm && vm.yvanScope) {
  23723. // scope = vm.yvanScope
  23724. // fn = scope[fn.substr('scope.'.length)]
  23725. // }
  23726. fn = lookupFn(scope, fn, this);
  23727. }
  23728. }
  23729. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23730. };
  23731. // 将 SystemLib 扩展到 window.system 下
  23732. if (!window['system']) {
  23733. window['system'] = {};
  23734. }
  23735. _$2.extend(window['system'], SystemLib);
  23736. _$2.extend(window['system'], {
  23737. showGridRowDetail: showGridRowDetail
  23738. });
  23739. Ext.apply(Ext.util.Format, {
  23740. // 百分比
  23741. percentRenderer: function (v, rd, model) {
  23742. if (!v) {
  23743. v = 0;
  23744. }
  23745. if (typeof v === 'string') {
  23746. v = parseInt(v);
  23747. }
  23748. var valueString = v.toFixed(2);
  23749. var valueFixed = v > 100 ? 100 : v;
  23750. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23751. var cls = '';
  23752. if (v < 90) {
  23753. cls = 'danger';
  23754. }
  23755. else if (v < 100) {
  23756. cls = 'warning';
  23757. }
  23758. else {
  23759. cls = 'success';
  23760. }
  23761. return Ext.String
  23762. .format(
  23763. // '<div>'
  23764. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23765. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23766. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23767. // + '</div></div>', valueString, valueFixed, cls);
  23768. '<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(
  23769. // '<div>'
  23770. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23771. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23772. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23773. // + '</div></div>', v, valueFixed, valueString);
  23774. },
  23775. //button
  23776. button: function (v, rd, model) {
  23777. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23778. }
  23779. });
  23780. initComponent();
  23781. initPanel();
  23782. initGridColumn();
  23783. initTree();
  23784. initGrid();
  23785. initMainTab();
  23786. initTextfield();
  23787. initCombo();
  23788. initTag();
  23789. initContainer();
  23790. initRows();
  23791. initCols();
  23792. initForm();
  23793. initToolbar();
  23794. initSplitter();
  23795. initButton();
  23796. initStores();
  23797. initSearch();
  23798. initMultipleSearch();
  23799. initDate();
  23800. initDateTimePicker();
  23801. initDateTime();
  23802. initNumber();
  23803. initCheckbox();
  23804. initCheckboxGroup();
  23805. initRadio();
  23806. initRadioGroup();
  23807. initFieldset();
  23808. initCombotree();
  23809. initPickerPlus();
  23810. initCombogrid();
  23811. initComboGridMulti();
  23812. initIframe();
  23813. initBpmn();
  23814. initSqlEditor();
  23815. initJsonEditor();
  23816. initJsEditor();
  23817. initClipboard();
  23818. initSqlComplex();
  23819. initParamComplex();
  23820. initDict();
  23821. initDesigner();
  23822. }
  23823. //# sourceMappingURL=init.js.map
  23824. /**
  23825. * 创建一个 Ajax 客户端
  23826. */
  23827. function createAjax(createOption) {
  23828. if (createOption.baseUrl) {
  23829. axios__default.defaults.baseURL = createOption.baseUrl;
  23830. axios__default.defaults.timeout = createOption.timeout;
  23831. storeAjax.timeout = createOption.timeout;
  23832. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23833. }
  23834. return function (option) {
  23835. //@ts-ignore
  23836. option.method = (option.method || 'get').toLocaleLowerCase();
  23837. //@ts-ignore
  23838. var ax = __assign({}, option);
  23839. switch (option.method) {
  23840. case 'get':
  23841. ax.method = 'GET';
  23842. ax.params = option.param;
  23843. ax.headers = __assign({}, option.headers);
  23844. break;
  23845. case 'post':
  23846. ax.method = 'POST';
  23847. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23848. ax.params = option.param;
  23849. ax.data = Qs.stringify(option.data);
  23850. break;
  23851. case 'put':
  23852. case 'patch':
  23853. case 'delete':
  23854. ax.method = option.method;
  23855. ax.headers = option.headers;
  23856. ax.params = option.param;
  23857. ax.data = Qs.stringify(option.data);
  23858. break;
  23859. case 'download':
  23860. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23861. return new Promise(function (resolver, reject) {
  23862. });
  23863. case "invoke":
  23864. ax.url = serverInvokeUrlTransform(option.url, option);
  23865. ax.method = 'POST';
  23866. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23867. if (typeof option.args === 'object') {
  23868. ax.data = JSON.stringify({
  23869. args: option.args,
  23870. });
  23871. }
  23872. else {
  23873. ax.data = JSON.stringify({
  23874. args: [
  23875. __assign(__assign({}, option.data), option.param)
  23876. ],
  23877. filterModel: option.filterModel,
  23878. sortModel: option.sortModel
  23879. });
  23880. }
  23881. break;
  23882. case 'post-json':
  23883. ax.method = 'POST';
  23884. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23885. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23886. break;
  23887. case 'post-file':
  23888. //TODO 刘壮. 上传文件
  23889. var forms = new FormData();
  23890. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23891. _$2.forOwn(option.data, function (value, key) {
  23892. if (key === 'files') {
  23893. var i_1 = 0;
  23894. _$2.each(value, function (f) {
  23895. // @ts-ignore
  23896. forms.append('file' + (++i_1), f);
  23897. });
  23898. }
  23899. else {
  23900. forms.append(key, value);
  23901. }
  23902. });
  23903. ax.data = forms;
  23904. ax.method = 'POST';
  23905. break;
  23906. case "sql":
  23907. ax.url = sqlUrlTransform(option.url);
  23908. ax.method = 'POST';
  23909. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23910. ax.data = JSON.stringify({
  23911. args: [option.data],
  23912. db: option.db,
  23913. filterModel: option.filterModel,
  23914. sortModel: option.sortModel
  23915. });
  23916. break;
  23917. default:
  23918. throw new Error('not implements');
  23919. }
  23920. return new Promise(function (resolver, reject) {
  23921. axios__default(ax).then(function (resolverRaw) {
  23922. var apiResult = {
  23923. rawData: resolverRaw.data,
  23924. status: resolverRaw.status,
  23925. success: (resolverRaw.data && resolverRaw.data.success),
  23926. data: resolverRaw.data.data,
  23927. pagination: resolverRaw.data.pagination,
  23928. msg: (resolverRaw.data.msg),
  23929. errors: resolverRaw.data.errors,
  23930. headers: resolverRaw.headers
  23931. };
  23932. if (typeof window['apiTranslate'] === 'function') {
  23933. window['apiTranslate'](apiResult.rawData, option.url);
  23934. }
  23935. resolver(apiResult);
  23936. }).catch(function (reason) {
  23937. reject(reason);
  23938. });
  23939. });
  23940. };
  23941. }
  23942. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23943. if (isJson === void 0) { isJson = false; }
  23944. var YvanUI = _$2.get(window, 'YvanUI');
  23945. YvanUI.loading();
  23946. var createObjectURL = function (object) {
  23947. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23948. };
  23949. // const formData = new FormData();
  23950. // _.forOwn(data, (v, k) => {
  23951. // formData.append(k, v);
  23952. // });
  23953. var formData = '';
  23954. var xhr = new XMLHttpRequest();
  23955. xhr.open('POST', downLoadUrl);
  23956. xhr.responseType = 'blob';
  23957. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23958. if (isJson) {
  23959. formData = data ? JSON.stringify(data) : '';
  23960. xhr.setRequestHeader('Content-Type', 'application/json');
  23961. }
  23962. else {
  23963. formData = data ? Qs.stringify(data) : '';
  23964. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23965. }
  23966. //
  23967. if (header) {
  23968. _$2.forOwn(header, function (v, k) {
  23969. xhr.setRequestHeader(k, v);
  23970. });
  23971. }
  23972. xhr.onload = function (e) {
  23973. if (this.status === 200) {
  23974. var blob = this.response;
  23975. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23976. navigator.msSaveBlob(blob, filename);
  23977. YvanUI.clearLoading();
  23978. }
  23979. else {
  23980. var a = document.createElement('a');
  23981. var url = createObjectURL(blob);
  23982. a.href = url;
  23983. a.download = filename;
  23984. document.append(a);
  23985. a.click();
  23986. a.remove();
  23987. window.URL.revokeObjectURL(url);
  23988. YvanUI.clearLoading();
  23989. }
  23990. }
  23991. };
  23992. xhr.send(formData);
  23993. }
  23994. //# sourceMappingURL=ajax.js.map
  23995. function readExcel(file) {
  23996. return new Promise(function (resolve, reject) {
  23997. if (!file) {
  23998. reject("文件读取失败!!!");
  23999. return;
  24000. }
  24001. var reader = new FileReader();
  24002. reader.onload = function (e) {
  24003. if (e.target) {
  24004. var data = e.target.result;
  24005. var workbook = XLSX.read(data, { type: 'binary' });
  24006. resolve(workbook);
  24007. }
  24008. else {
  24009. reject("文件读取失败!!!");
  24010. }
  24011. };
  24012. try {
  24013. reader.readAsBinaryString(file);
  24014. }
  24015. catch (e) {
  24016. reject(e);
  24017. }
  24018. });
  24019. }
  24020. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  24021. if (dataStartRow === void 0) { dataStartRow = 2; }
  24022. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  24023. if (rowValidate === void 0) { rowValidate = undefined; }
  24024. if (otherValidate === void 0) { otherValidate = undefined; }
  24025. if (fieldValidate === void 0) { fieldValidate = undefined; }
  24026. return new Promise(function (resolve, reject) {
  24027. var promiseArr = [];
  24028. for (var i = 0; i < columnsSet.length; i++) {
  24029. var fix = columnsSet[i].fix;
  24030. if (_$2.isArray(fix) && fix.length > 0) {
  24031. var ss = fix[0].toLowerCase();
  24032. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24033. columnsSet[i].importFormatter = function (vdata) {
  24034. // @ts-ignore
  24035. return window.moment(vdata.ov) - 0;
  24036. };
  24037. }
  24038. else {
  24039. var fn = lookupFn(topScope, fix[0]);
  24040. promiseArr.push(fn(null, columnsSet[i]));
  24041. delete columnsSet[i].fix;
  24042. }
  24043. }
  24044. else if (_$2.isString(fix)) {
  24045. var ss = fix.toLowerCase();
  24046. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24047. columnsSet[i].importFormatter = function (vdata) {
  24048. // @ts-ignore
  24049. return window.moment(vdata.ov) - 0;
  24050. };
  24051. }
  24052. else {
  24053. var fn = lookupFn(topScope, fix);
  24054. promiseArr.push(fn(null, columnsSet[i]));
  24055. delete columnsSet[i].fix;
  24056. }
  24057. }
  24058. }
  24059. var read = function () {
  24060. readExcel(file).then(function (workbook) {
  24061. var sheetNames = workbook.SheetNames; // 工作表名称集合
  24062. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  24063. var titleRowValue = [];
  24064. var titleRowKey = [];
  24065. var needLoop = false; // 是否需要迭代
  24066. var columns = [];
  24067. if (worksheet && worksheet["!ref"]) {
  24068. var t = worksheet["!ref"];
  24069. var tempArr = t.split(':');
  24070. if (tempArr.length >= 2) {
  24071. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  24072. // 选取title的行,删除之前的行
  24073. if (titleRowNumber > firstRowNumber) {
  24074. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  24075. for (var key in worksheet) {
  24076. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  24077. delete worksheet[key];
  24078. }
  24079. }
  24080. }
  24081. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  24082. firstRowNumber = titleRowNumber + '';
  24083. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  24084. }
  24085. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  24086. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  24087. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  24088. for (var key in worksheet) {
  24089. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  24090. titleRowKey.push(key);
  24091. titleRowValue.push(worksheet[key].v);
  24092. }
  24093. }
  24094. if (columnsSet && columnsSet.length > 0) {
  24095. var length = columnsSet.length;
  24096. length = length <= titleRowKey.length ? length : titleRowKey.length;
  24097. for (var i = 0; i < length; i++) {
  24098. var vk = titleRowKey[i];
  24099. var item = columnsSet[i];
  24100. var column = {};
  24101. if (typeof item === 'string') {
  24102. column.dataIndex = item;
  24103. column.header = worksheet[vk].v;
  24104. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  24105. }
  24106. else if (typeof item.dataIndex === "string") {
  24107. column.dataIndex = item.dataIndex;
  24108. column.header = worksheet[vk].v;
  24109. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  24110. if (typeof item.validate === "function") {
  24111. column.validate = item.validate;
  24112. needLoop = true;
  24113. }
  24114. if (typeof item.importFormatter === "function") {
  24115. column.importFormatter = item.importFormatter;
  24116. needLoop = true;
  24117. }
  24118. if ((item.data instanceof Array && item.data.length > 0)
  24119. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24120. column.data = item.data;
  24121. needLoop = true;
  24122. }
  24123. }
  24124. columns.push(column);
  24125. }
  24126. }
  24127. }
  24128. }
  24129. if (fieldValidate && typeof fieldValidate === "function") {
  24130. if (fieldValidate(columns, titleRowValue) !== true) {
  24131. reject("fields validate error");
  24132. return;
  24133. }
  24134. }
  24135. var allData = XLSX.utils.sheet_to_json(worksheet);
  24136. var okData = [], errorData = [], errorMsgData = [];
  24137. var needItemLoop = needLoop;
  24138. if (rowValidate && typeof rowValidate === "function") {
  24139. needLoop = true;
  24140. }
  24141. if (needLoop === true) {
  24142. for (var index = 0; index < allData.length; index++) {
  24143. var row = allData[index];
  24144. var rowNumber = dataStartRow + index;
  24145. row.__importID__ = rowNumber;
  24146. var isRowOk = true;
  24147. if (needItemLoop) {
  24148. var _loop_1 = function (num) {
  24149. var column = columns[num];
  24150. var ov = row[column.dataIndex];
  24151. var nv = ov;
  24152. var hasError = false;
  24153. var rowNumber_1 = dataStartRow + index;
  24154. var ei = {
  24155. errorId: rowNumber_1 + '_' + column.dataIndex,
  24156. importID: rowNumber_1,
  24157. dataIndex: column.dataIndex,
  24158. header: column.header,
  24159. value: ov,
  24160. errormessage: ""
  24161. };
  24162. // 格式化
  24163. if (column.data instanceof Array) {
  24164. nv = undefined;
  24165. ei.errormessage = "字典匹配失败";
  24166. _$2.forEach(column.data, function (v, index) {
  24167. if (v.text === ov) {
  24168. nv = v.id;
  24169. return;
  24170. }
  24171. });
  24172. }
  24173. else if (_$2.isPlainObject(column.data)) {
  24174. nv = undefined;
  24175. ei.errormessage = "字典匹配失败";
  24176. _$2.forEach(column.data, function (value, key) {
  24177. if (value === ov) {
  24178. nv = key;
  24179. return;
  24180. }
  24181. });
  24182. }
  24183. if (typeof column.importFormatter === 'function') {
  24184. var vdata = {
  24185. column: column,
  24186. ov: ov,
  24187. nv: nv,
  24188. rowIndex: index,
  24189. data: row,
  24190. rowDatas: allData
  24191. };
  24192. nv = undefined;
  24193. ei.errormessage = "格式化失败";
  24194. nv = column.importFormatter(vdata);
  24195. }
  24196. if (!nv && nv != 0) {
  24197. hasError = true;
  24198. }
  24199. else {
  24200. row[column.dataIndex] = nv;
  24201. ei.errormessage = "";
  24202. }
  24203. // 校验
  24204. if (typeof column.validate === 'function') {
  24205. var vdata = {
  24206. column: column,
  24207. ov: ov,
  24208. nv: nv,
  24209. rowIndex: index,
  24210. data: row,
  24211. rowDatas: allData
  24212. };
  24213. var errormessage = column.validate(vdata);
  24214. if (errormessage === true) ;
  24215. else {
  24216. hasError = true;
  24217. ei.errormessage = ei.errormessage + "/" + errormessage;
  24218. }
  24219. }
  24220. if (hasError === true) {
  24221. isRowOk = false;
  24222. errorMsgData.push(ei);
  24223. }
  24224. };
  24225. for (var num = 0; num < columns.length; num++) {
  24226. _loop_1(num);
  24227. }
  24228. }
  24229. if (rowValidate && typeof rowValidate === "function") {
  24230. var errormessage = rowValidate({
  24231. columns: columns,
  24232. data: row,
  24233. rowIndex: index,
  24234. rowDatas: allData
  24235. });
  24236. if (errormessage === true) ;
  24237. else {
  24238. isRowOk = false;
  24239. var ei = {
  24240. errorId: rowNumber + '',
  24241. dataIndex: "row",
  24242. header: "数据行",
  24243. value: "当前行的数据",
  24244. importID: rowNumber,
  24245. errormessage: errormessage
  24246. };
  24247. errorMsgData.push(ei);
  24248. }
  24249. }
  24250. row.__hasError__ = !isRowOk;
  24251. if (isRowOk === true) {
  24252. okData.push(row);
  24253. }
  24254. else {
  24255. errorData.push(row);
  24256. }
  24257. }
  24258. }
  24259. else {
  24260. // 添加数据的唯一标识
  24261. for (var index = 0; index < allData.length; index++) {
  24262. var row = allData[index];
  24263. var rowNumber = dataStartRow + index;
  24264. row.__importID__ = rowNumber;
  24265. row.__hasError__ = false;
  24266. }
  24267. okData = allData;
  24268. }
  24269. if (otherValidate && typeof otherValidate === "function") {
  24270. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24271. }
  24272. else {
  24273. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24274. }
  24275. // clearLoading()
  24276. }).catch(function (e) {
  24277. reject(e);
  24278. });
  24279. };
  24280. if (promiseArr.length > 0) {
  24281. Promise.all(promiseArr).then(function (resArr) {
  24282. for (var i = 0; i < resArr.length; i++) {
  24283. var tmp = resArr[i];
  24284. tmp.config.data = [];
  24285. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24286. if (tmp.r.field.length > 1) {
  24287. var keyKey = tmp.r.field[0];
  24288. var valueKey = tmp.r.field[1];
  24289. for (var j = 0; j < tmp.r.data.length; j++) {
  24290. var it = tmp.r.data[j];
  24291. var newIt = {};
  24292. newIt.id = it[keyKey];
  24293. newIt.text = it[valueKey];
  24294. tmp.config.data.push(newIt);
  24295. }
  24296. }
  24297. }
  24298. }
  24299. read();
  24300. });
  24301. }
  24302. else {
  24303. setTimeout(read, 50);
  24304. }
  24305. });
  24306. }
  24307. //# sourceMappingURL=xlsx.js.map
  24308. var ExcelImportDialog = /** @class */ (function (_super) {
  24309. __extends(ExcelImportDialog, _super);
  24310. function ExcelImportDialog(option) {
  24311. var _this = this;
  24312. var vjson = vjsonFunc(option);
  24313. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24314. _this.importExcelOption = option;
  24315. return _this;
  24316. }
  24317. ExcelImportDialog.prototype.onLoad = function () {
  24318. _super.prototype.onLoad.call(this);
  24319. };
  24320. ExcelImportDialog.prototype.fileChange = function (sender) {
  24321. var _this = this;
  24322. var file = sender.fileInputEl.dom.files[0];
  24323. // const senderScope = lookupScope(sender)
  24324. var topScope = this.topScope;
  24325. var rowValidate = this.importExcelOption.rowValidate;
  24326. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24327. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24328. }
  24329. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24330. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24331. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24332. }
  24333. var fieldValidate = this.importExcelOption.fieldValidate;
  24334. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24335. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24336. }
  24337. this.setLoading(true);
  24338. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24339. _this.importData = res;
  24340. _this.refs.dataGrid.setData(res.allData);
  24341. _this.viewModel.set("dataCount", res.allData.length);
  24342. _this.refs.errGrid.setData(res.errorMsgData);
  24343. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24344. }).catch(function (e) {
  24345. _this.importData = null;
  24346. _this.refs.dataGrid.setData();
  24347. _this.refs.errGrid.setData();
  24348. msg(e.toString());
  24349. }).finally(function () {
  24350. _this.setLoading(false);
  24351. });
  24352. };
  24353. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24354. if (record.get('__hasError__')) {
  24355. return "x-grid-record-bg-red";
  24356. }
  24357. };
  24358. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24359. return "x-grid-record-bg-red";
  24360. };
  24361. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24362. var _a;
  24363. var id = record.data.__importID__;
  24364. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24365. var selectRecord = null;
  24366. var dataIndex = -1;
  24367. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24368. for (var i = 0; i < rows.length; i++) {
  24369. if (rows[i].importID === id) {
  24370. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24371. dataIndex = i;
  24372. }
  24373. if (rows[i].errorId === id + "_" + subId) {
  24374. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24375. dataIndex = i;
  24376. break;
  24377. }
  24378. }
  24379. if (selectRecord) {
  24380. this.refs.errGrid.ensureVisible(selectRecord);
  24381. this.refs.errGrid.selModel.select(dataIndex);
  24382. // this.refs.errGrid.reload()
  24383. }
  24384. };
  24385. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24386. var _a;
  24387. var id = record.data.importID;
  24388. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24389. var selectRecord = null;
  24390. var dataIndex = -1;
  24391. for (var i = 0; i < rows.length; i++) {
  24392. if (rows[i].__importID__ === id) {
  24393. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24394. dataIndex = i;
  24395. break;
  24396. }
  24397. }
  24398. if (selectRecord) {
  24399. this.refs.dataGrid.ensureVisible(selectRecord);
  24400. this.refs.dataGrid.selModel.select(dataIndex);
  24401. // this.refs.dataGrid.reload()
  24402. }
  24403. };
  24404. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24405. this.viewModel.set("dataType", newValue);
  24406. if (this.importData) {
  24407. this.refs.dataGrid.setData(this.importData[newValue]);
  24408. this.viewModel.set("dataCount", this.importData[newValue].length);
  24409. }
  24410. };
  24411. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24412. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24413. window.location.href = this.importExcelOption.dowLoadUrl;
  24414. return;
  24415. }
  24416. var xt = [];
  24417. _$2.forEach(this.importExcelOption.columns, function (v) {
  24418. xt.push(v.header);
  24419. });
  24420. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24421. if (filename.endsWith(".xlsx")) {
  24422. filename = filename.split(".xlsx")[0];
  24423. }
  24424. filename = filename + ".xlsx";
  24425. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24426. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24427. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24428. XLSX.writeFile(wb, filename); //导出Excel
  24429. };
  24430. ExcelImportDialog.prototype.getData = function (sender) {
  24431. _$2.each(this.importData.okData, function (item) {
  24432. delete item.id;
  24433. delete item.__hasError__;
  24434. delete item.__importID__;
  24435. delete item._origin;
  24436. });
  24437. _$2.each(this.importData.allData, function (item) {
  24438. delete item.id;
  24439. delete item.__hasError__;
  24440. delete item.__importID__;
  24441. delete item._origin;
  24442. });
  24443. _$2.each(this.importData.errorData, function (item) {
  24444. delete item.id;
  24445. delete item.__hasError__;
  24446. delete item.__importID__;
  24447. delete item._origin;
  24448. });
  24449. this.dialogSuccess(this.importData);
  24450. };
  24451. return ExcelImportDialog;
  24452. }(Scope));
  24453. var model$d = {
  24454. data: {
  24455. dataType: "all",
  24456. errMsgCount: 0,
  24457. dataCount: 0
  24458. }
  24459. };
  24460. var vjsonFunc = function (option) {
  24461. return {
  24462. title: option.title || 'excel导入',
  24463. layout: 'fit',
  24464. items: [
  24465. {
  24466. layout: 'border',
  24467. tbar: {
  24468. xtype: "form",
  24469. items: [
  24470. {
  24471. xtype: "cols",
  24472. items: [
  24473. {
  24474. xtype: "filefield",
  24475. fieldLabel: 'excel文件',
  24476. buttonText: '请选择excel文件',
  24477. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24478. flex: 3,
  24479. listeners: {
  24480. change: "scope.fileChange"
  24481. }
  24482. }, {
  24483. xtype: "button",
  24484. iconCls: "x-fa fa-download",
  24485. text: "下载模版",
  24486. listeners: {
  24487. click: "scope.downloadTemplate"
  24488. }
  24489. }, {
  24490. xtype: 'container',
  24491. border: false,
  24492. layout: 'hbox',
  24493. }, {
  24494. xtype: "button",
  24495. iconCls: "x-fa fa-upload",
  24496. text: option.tQButtonText || "提取数据",
  24497. listeners: {
  24498. click: "scope.getData"
  24499. }
  24500. }
  24501. ]
  24502. },
  24503. ]
  24504. },
  24505. items: [
  24506. {
  24507. tbar: {
  24508. xtype: "toolbar",
  24509. title: "导入的数据",
  24510. items: [{
  24511. xtype: 'label',
  24512. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24513. }, {
  24514. xtype: 'radiogroup',
  24515. items: [
  24516. {
  24517. boxLabel: '所有数据',
  24518. checked: true,
  24519. inputValue: 'allData',
  24520. }, {
  24521. boxLabel: '正确数据',
  24522. inputValue: 'okData',
  24523. }, {
  24524. boxLabel: '错误数据',
  24525. inputValue: 'errorData',
  24526. }
  24527. ],
  24528. listeners: {
  24529. change: 'scope.filterData',
  24530. },
  24531. }, {
  24532. xtype: "textfield",
  24533. readOnly: true,
  24534. fieldLabel: "条目数",
  24535. bind: "{dataCount}"
  24536. }]
  24537. },
  24538. xtype: 'yvgrid',
  24539. reference: 'dataGrid',
  24540. layout: 'fit',
  24541. pagination: false,
  24542. // pageSize: 50,
  24543. getRowClass: 'scope.getDataGridRowRecord',
  24544. columns: option.columns,
  24545. region: 'center',
  24546. split: true,
  24547. listeners: {
  24548. cellclick: "scope.dataGridClick",
  24549. },
  24550. selModel: {
  24551. // type: 'rowmodel',
  24552. mode: 'SINGLE',
  24553. },
  24554. }, {
  24555. tbar: {
  24556. xtype: "toolbar", items: [
  24557. {
  24558. xtype: 'label',
  24559. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24560. }, {
  24561. xtype: "textfield",
  24562. readOnly: true,
  24563. fieldLabel: "条目数",
  24564. bind: "{errMsgCount}"
  24565. }
  24566. ]
  24567. },
  24568. xtype: 'yvgrid',
  24569. reference: 'errGrid',
  24570. layout: 'fit',
  24571. pagination: false,
  24572. getRowClass: 'scope.getErrGridRowRecord',
  24573. height: "40%",
  24574. columns: [
  24575. { dataIndex: "errorId", header: "ID", hidden: true },
  24576. { dataIndex: "importID", header: "行号", width: 80 },
  24577. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24578. { dataIndex: "value", header: "值", width: 120 },
  24579. { dataIndex: "header", header: "字段名", width: 120 },
  24580. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24581. ],
  24582. region: 'south',
  24583. split: true,
  24584. listeners: {
  24585. itemclick: "scope.errGridClick"
  24586. },
  24587. selModel: {
  24588. // type: 'rowmodel',
  24589. mode: 'SINGLE',
  24590. },
  24591. },
  24592. ],
  24593. },
  24594. ],
  24595. referenceHolder: true,
  24596. };
  24597. };
  24598. //# sourceMappingURL=ExcelImportDialog.js.map
  24599. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24600. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24601. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24602. ret.report_id = reportId;
  24603. ret.report = report;
  24604. return ret;
  24605. }
  24606. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24607. var e_1, _a, e_2, _b;
  24608. var model = {
  24609. data: {
  24610. report_name: config.report_name,
  24611. query: {},
  24612. sum: {},
  24613. }
  24614. };
  24615. var json5 = window['YvanUI'].json5;
  24616. var report = config.report ? json5.parse(config.report) : {};
  24617. var conditionRows = [];
  24618. var sumRows = [];
  24619. model.data.has_sum = _$2.size(report.summary) > 0;
  24620. // query 查询条件
  24621. var newRow = false;
  24622. var currentRow = { xtype: 'cols', items: [], };
  24623. conditionRows.push(currentRow);
  24624. _$2.forEach(report.query, function (item) {
  24625. if (newRow) {
  24626. currentRow = { xtype: 'cols', items: [], };
  24627. conditionRows.push(currentRow);
  24628. }
  24629. var vj = json5.parse(item.conditionFieldExtend);
  24630. if (item.conditionFieldXtype) {
  24631. vj.xtype = item.conditionFieldXtype;
  24632. if (item.conditionFieldXtype === 'combo') {
  24633. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24634. }
  24635. if (item.conditionFieldXtype === 'datetimefield') {
  24636. //@ts-ignore
  24637. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  24638. }
  24639. else if (item.conditionFieldXtype === 'datefield') {
  24640. //@ts-ignore
  24641. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24642. }
  24643. else {
  24644. model.data.query[item.conditionFieldBind] = '';
  24645. }
  24646. }
  24647. else {
  24648. // 没有组件类型,是个空占位符
  24649. vj.border = false;
  24650. }
  24651. if (item.conditionFieldBind) {
  24652. vj.bind = {
  24653. value: '{query.' + item.conditionFieldBind + '}'
  24654. };
  24655. }
  24656. if (item.conditionFieldFlex) {
  24657. vj.flex = item.conditionFieldFlex;
  24658. }
  24659. if (item.conditionFieldXtype) {
  24660. vj.fieldLabel = item.conditionFieldLabel;
  24661. }
  24662. if (item.fieldLabel) {
  24663. vj.fieldLabel = item.fieldLabel;
  24664. }
  24665. newRow = item.conditionFieldWrap || false;
  24666. currentRow.items.push(vj);
  24667. });
  24668. if (currentRow) {
  24669. currentRow.margin = '10 0 10 0';
  24670. }
  24671. // sum 汇总条件
  24672. newRow = true;
  24673. try {
  24674. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24675. var item = _d.value;
  24676. if (newRow) {
  24677. currentRow = {
  24678. xtype: 'cols',
  24679. defaultType: 'displayfield',
  24680. defaults: {
  24681. labelWidth: 70,
  24682. },
  24683. items: []
  24684. };
  24685. sumRows.push(currentRow);
  24686. }
  24687. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24688. if (item.sumFieldBind) {
  24689. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24690. model.data.sum[item.sumFieldBind] = '';
  24691. }
  24692. else {
  24693. // 没有组件类型,是个空占位符
  24694. vj.border = false;
  24695. }
  24696. if (item.sumFieldFlex) {
  24697. vj.flex = item.sumFieldFlex;
  24698. }
  24699. if (item.sumFieldLabel) {
  24700. vj.fieldLabel = item.sumFieldLabel;
  24701. }
  24702. // sumFieldBind: "zs"
  24703. // sumFieldExtend: "{}"
  24704. // sumFieldFlex: 1
  24705. // sumFieldLabel: "总数"
  24706. // sumFieldWrap: false
  24707. newRow = item.sumFieldWrap || false;
  24708. currentRow.items.push(vj);
  24709. }
  24710. }
  24711. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24712. finally {
  24713. try {
  24714. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24715. }
  24716. finally { if (e_1) throw e_1.error; }
  24717. }
  24718. if (currentRow) {
  24719. currentRow.margin = '10 0 10 0';
  24720. }
  24721. // column 结果字段
  24722. var columns = [];
  24723. try {
  24724. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24725. var item = _f.value;
  24726. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24727. if (item.xtype) {
  24728. if (item.xtype == 'checkbox') {
  24729. vj.xtype = 'checkcolumn';
  24730. vj.disabled = true;
  24731. }
  24732. else {
  24733. vj.xtype = item.xtype;
  24734. }
  24735. }
  24736. if (item.dataType) {
  24737. vj.dataType = item.dataType;
  24738. }
  24739. if (item.align) {
  24740. vj.align = item.align;
  24741. }
  24742. if (item.width) {
  24743. vj.width = item.width;
  24744. }
  24745. if (item.dict) {
  24746. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24747. }
  24748. columns.push(vj);
  24749. }
  24750. }
  24751. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24752. finally {
  24753. try {
  24754. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24755. }
  24756. finally { if (e_2) throw e_2.error; }
  24757. }
  24758. var vjson = {
  24759. bind: {
  24760. title: '{report_name}',
  24761. },
  24762. layout: 'fit',
  24763. referenceHolder: true,
  24764. items: [
  24765. {
  24766. layout: 'border',
  24767. border: false,
  24768. items: [
  24769. {
  24770. region: 'north',
  24771. border: false,
  24772. tbar: {
  24773. xtype: 'toolbar',
  24774. border: false,
  24775. items: [
  24776. {
  24777. xtype: 'button',
  24778. text: '查询',
  24779. reference: 'btnSearch',
  24780. iconCls: 'x-fa fa-search',
  24781. listeners: {
  24782. click: 'scope.reload',
  24783. },
  24784. },
  24785. {
  24786. xtype: 'button',
  24787. text: '关闭',
  24788. iconCls: 'x-fa fa-times',
  24789. listeners: {
  24790. click: 'system.closeMe()',
  24791. },
  24792. },
  24793. ],
  24794. },
  24795. defaults: {
  24796. margin: '8 0 0 0'
  24797. },
  24798. items: __spread(conditionRows, sumRows),
  24799. fix: ['system.enterToClick("btnSearch")'],
  24800. },
  24801. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24802. method: 'invoke',
  24803. url: '/report/Report@execute',
  24804. params: {
  24805. dataSource: report.dataSource,
  24806. pagination: report.grid.pagination || true,
  24807. report_id: config.report_id,
  24808. query: '{query}',
  24809. },
  24810. }, columns: columns }, report.grid),
  24811. ],
  24812. },
  24813. ],
  24814. };
  24815. return { model: model, vjson: vjson, report: report };
  24816. }
  24817. var ReportScope = /** @class */ (function (_super) {
  24818. __extends(ReportScope, _super);
  24819. function ReportScope(_a, invokeServerFn) {
  24820. var model = _a.model, vjson = _a.vjson;
  24821. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  24822. _this.invokeServerFn = invokeServerFn;
  24823. return _this;
  24824. }
  24825. ReportScope.prototype.onLoad = function () {
  24826. // this.reload()
  24827. };
  24828. ReportScope.prototype.reload = function () {
  24829. var _this = this;
  24830. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24831. if (this.viewModel.get('has_sum')) {
  24832. this.invokeServerFn('/report/Report@executeSum', {
  24833. dataSource: this.report.dataSource,
  24834. report_id: this.report_id,
  24835. query: this.viewModel.get('query'),
  24836. }).then(function (res) {
  24837. if (!res.success) {
  24838. showErrorDialog$1(res.msg);
  24839. }
  24840. else {
  24841. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24842. }
  24843. });
  24844. }
  24845. this.refs.grid1.reload();
  24846. };
  24847. return ReportScope;
  24848. }(Scope));
  24849. //# sourceMappingURL=Report.js.map
  24850. var model$e = {
  24851. data: {
  24852. form: {
  24853. resource_parent: '',
  24854. resource_name: '',
  24855. resource_icon: '',
  24856. scope_url: '',
  24857. scope_params: '',
  24858. resource_order: '',
  24859. permission_code: '',
  24860. },
  24861. }
  24862. };
  24863. //# sourceMappingURL=RegisterModule.model.js.map
  24864. var vjson$d = {
  24865. title: '注册模块',
  24866. layout: 'fit',
  24867. width: "40%",
  24868. height: "50%",
  24869. fbar: {
  24870. xtype: 'toolbar',
  24871. items: [
  24872. {
  24873. xtype: "button",
  24874. text: "确定",
  24875. iconCls: 'x-fa fa-check',
  24876. listeners: {
  24877. click: 'scope.saveNode',
  24878. }
  24879. },
  24880. {
  24881. xtype: "button",
  24882. text: "关闭",
  24883. iconCls: 'x-fa fa-times',
  24884. listeners: {
  24885. click: 'system.closeMe()',
  24886. }
  24887. },
  24888. ]
  24889. },
  24890. items: [
  24891. {
  24892. layout: 'border',
  24893. items: [
  24894. {
  24895. region: 'west',
  24896. layout: 'fit',
  24897. xtype: 'tabpanel',
  24898. reference: 'tabs',
  24899. width: "50%",
  24900. split: true,
  24901. listeners: {
  24902. tabchange: 'scope.tabchange',
  24903. },
  24904. items: [
  24905. {
  24906. region: 'center',
  24907. layout: 'fit',
  24908. title: 'PC菜单',
  24909. key: "1",
  24910. items: [
  24911. {
  24912. xtype: 'treepanel',
  24913. layout: 'fit',
  24914. region: 'west',
  24915. rootVisible: false,
  24916. useArrows: true,
  24917. reference: 'tree1',
  24918. listeners: {
  24919. itemclick: "scope.tree1NodeClick",
  24920. }
  24921. },
  24922. ]
  24923. },
  24924. {
  24925. region: 'center',
  24926. layout: 'fit',
  24927. title: 'PDA菜单',
  24928. key: "2",
  24929. items: [
  24930. {
  24931. xtype: 'treepanel',
  24932. layout: 'fit',
  24933. region: 'west',
  24934. reference: 'tree2',
  24935. rootVisible: false,
  24936. useArrows: true,
  24937. listeners: {
  24938. itemclick: "scope.tree1NodeClick",
  24939. }
  24940. },
  24941. ]
  24942. },
  24943. ]
  24944. },
  24945. {
  24946. region: 'center',
  24947. xtype: 'form',
  24948. margin: '0 0 0 0',
  24949. split: true,
  24950. width: '50%',
  24951. items: [
  24952. {
  24953. xtype: 'cols',
  24954. items: [
  24955. {
  24956. xtype: 'textfield',
  24957. fieldLabel: '上级资源ID',
  24958. bind: {
  24959. readOnly: true,
  24960. disabled: true,
  24961. value: '{form.resource_parent}'
  24962. },
  24963. },
  24964. ],
  24965. },
  24966. {
  24967. xtype: 'cols',
  24968. items: [
  24969. {
  24970. xtype: 'textfield',
  24971. fieldLabel: '资源名称',
  24972. bind: {
  24973. value: '{form.resource_name}'
  24974. },
  24975. allowBlank: false,
  24976. },
  24977. ],
  24978. },
  24979. {
  24980. xtype: 'cols',
  24981. items: [
  24982. {
  24983. xtype: 'numberfield',
  24984. fieldLabel: '资源排序',
  24985. bind: {
  24986. value: '{form.resource_order}'
  24987. },
  24988. allowBlank: false,
  24989. },
  24990. ],
  24991. },
  24992. {
  24993. xtype: 'cols',
  24994. items: [
  24995. {
  24996. xtype: 'textfield',
  24997. fieldLabel: '功能URL',
  24998. bind: {
  24999. disabled: true,
  25000. value: '{form.scope_url}'
  25001. },
  25002. },
  25003. ]
  25004. },
  25005. {
  25006. xtype: 'cols',
  25007. items: [
  25008. {
  25009. xtype: 'textfield',
  25010. fieldLabel: '权限编码',
  25011. bind: {
  25012. value: '{form.permission_code}'
  25013. }
  25014. },
  25015. ],
  25016. },
  25017. {
  25018. xtype: 'cols',
  25019. items: [
  25020. {
  25021. xtype: 'textfield',
  25022. fieldLabel: '功能参数',
  25023. bind: {
  25024. value: '{form.scope_params}'
  25025. }
  25026. },
  25027. ],
  25028. },
  25029. ],
  25030. },
  25031. ],
  25032. },
  25033. ],
  25034. referenceHolder: true,
  25035. };
  25036. //# sourceMappingURL=RegisterModule.view.js.map
  25037. var RegisterModule = /** @class */ (function (_super) {
  25038. __extends(RegisterModule, _super);
  25039. function RegisterModule() {
  25040. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  25041. }
  25042. RegisterModule.prototype.onLoad = function () {
  25043. this.reloadTree("PC");
  25044. };
  25045. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  25046. var currTabKey = b.key;
  25047. if (currTabKey === '1') {
  25048. this.viewModel.set('form', '');
  25049. this.reloadTree("PC");
  25050. }
  25051. else {
  25052. this.viewModel.set('form', '');
  25053. this.reloadTree("PDA");
  25054. }
  25055. };
  25056. RegisterModule.prototype.reloadTree = function (type) {
  25057. var _this = this;
  25058. if ("PC" === type) {
  25059. this.setLoading(true);
  25060. getMenuTree({ type: "PC" }).then(function (res) {
  25061. if (res.success) {
  25062. _this.refs.tree1.store.setRootNode({
  25063. expanded: true,
  25064. children: res.data
  25065. });
  25066. }
  25067. }).finally(function () {
  25068. _this.setLoading(false);
  25069. });
  25070. }
  25071. else {
  25072. this.setLoading(true);
  25073. getMenuTree({ type: "PDA" }).then(function (res) {
  25074. if (res.success) {
  25075. _this.refs.tree2.store.setRoot({
  25076. expanded: true,
  25077. children: res.data
  25078. });
  25079. }
  25080. }).finally(function () {
  25081. _this.setLoading(false);
  25082. });
  25083. }
  25084. };
  25085. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  25086. var id = _$2.split(node.data.id, '_')[1];
  25087. if (!id) {
  25088. return;
  25089. }
  25090. this.viewModel.set('form.resource_parent', id);
  25091. };
  25092. RegisterModule.prototype.saveNode = function () {
  25093. var _this = this;
  25094. var tabKey = this.refs.tabs.activeTab.key;
  25095. // 检验菜单数据
  25096. var param = this.viewModel.get('form');
  25097. if (!param.resource_parent) {
  25098. msg('请选择一个父节点');
  25099. return;
  25100. }
  25101. if (!param.resource_name) {
  25102. msg('资源名称不能为空');
  25103. return;
  25104. }
  25105. if (!param.scope_url) {
  25106. msg('功能URL不能为空');
  25107. return;
  25108. }
  25109. var type;
  25110. if (tabKey === '1') {
  25111. type = 'PC';
  25112. }
  25113. else {
  25114. type = 'PDA';
  25115. }
  25116. this.setLoading(true);
  25117. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  25118. if (res.success) {
  25119. msg("注册成功");
  25120. _this.close();
  25121. }
  25122. }).finally(function () {
  25123. _this.setLoading(false);
  25124. });
  25125. };
  25126. return RegisterModule;
  25127. }(Scope));
  25128. //# sourceMappingURL=RegisterModule.js.map
  25129. var model$f = {
  25130. data: {
  25131. title: "模板选择",
  25132. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25133. moduleType: 1,
  25134. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25135. packagePath: "",
  25136. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25137. fileSavePath: "",
  25138. // 模块名称 "Dict"
  25139. moduleName: "NewModule",
  25140. // 页面标题 "字典维护"
  25141. pageTitle: "新模块",
  25142. // 单表查询
  25143. singleTable: {
  25144. sql: "select * from bas_dict",
  25145. // 新增或者删除所用的表
  25146. tableName: "",
  25147. // 是否分页查询
  25148. pagination: true,
  25149. // 是否需要删除
  25150. delete: true,
  25151. // 删除条件字段
  25152. deleteWhereColumn: "",
  25153. // 删除提示语
  25154. deleteTips: "确定要删除?",
  25155. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25156. editType: 2,
  25157. },
  25158. singleTableView: {
  25159. tableNameList: [
  25160. // { value: "aaa"},
  25161. ],
  25162. columnList: [
  25163. // { value: "aaa"},
  25164. ],
  25165. }
  25166. }
  25167. };
  25168. //# sourceMappingURL=CreateModule.model.js.map
  25169. var vjson$e = {
  25170. bind: {
  25171. title: '新建模块-{title}',
  25172. },
  25173. width: "55%",
  25174. height: "60%",
  25175. minWidth: 500,
  25176. minHeight: 400,
  25177. modal: true,
  25178. frame: true,
  25179. layout: 'card',
  25180. bbar: [
  25181. '->',
  25182. {
  25183. itemId: 'card-prev',
  25184. text: '&laquo; 上一步',
  25185. disabled: true,
  25186. listeners: {
  25187. click: 'scope.showPrevious',
  25188. },
  25189. },
  25190. {
  25191. itemId: 'card-next',
  25192. text: '下一步 &raquo;',
  25193. listeners: {
  25194. click: 'scope.showNext',
  25195. },
  25196. },
  25197. {
  25198. itemId: 'card-finish',
  25199. text: '立刻执行',
  25200. iconCls: 'x-fa fa-flash',
  25201. hidden: true,
  25202. listeners: {
  25203. click: 'scope.finish',
  25204. },
  25205. },
  25206. ],
  25207. items: [
  25208. {
  25209. vtitle: '模板选择',
  25210. reference: 'templateSelection',
  25211. layout: {
  25212. type: 'hbox',
  25213. pack: 'start',
  25214. align: 'stretch'
  25215. },
  25216. listeners: {
  25217. cardEnter: 'scope.templateEnter',
  25218. cardLevel: 'scope.templateLevel'
  25219. },
  25220. items: [
  25221. {
  25222. width: 150,
  25223. xtype: 'form',
  25224. border: false,
  25225. layout: {
  25226. type: 'vbox',
  25227. align: 'stretch'
  25228. },
  25229. defaults: {
  25230. border: false,
  25231. anchor: '100%',
  25232. margin: '5',
  25233. },
  25234. items: [
  25235. {
  25236. xtype: 'radiogroup',
  25237. bind: {
  25238. value: '{moduleType}'
  25239. },
  25240. layout: 'vbox',
  25241. defaults: {
  25242. border: false,
  25243. anchor: '100%',
  25244. margin: '5',
  25245. },
  25246. items: [
  25247. { boxLabel: '单表查询', inputValue: 1 },
  25248. { boxLabel: '主/明细查询', inputValue: 2 },
  25249. { boxLabel: '树/明细查询', inputValue: 3 },
  25250. { boxLabel: '卡片表单', inputValue: 4 },
  25251. { boxLabel: '主/详情查询', inputValue: 5 },
  25252. ]
  25253. },
  25254. ]
  25255. },
  25256. {
  25257. flex: 1,
  25258. region: 'center',
  25259. xtype: "panel",
  25260. border: false,
  25261. frame: true,
  25262. padding: "4px 8px",
  25263. html: "描述...",
  25264. }
  25265. ]
  25266. },
  25267. {
  25268. vtitle: '模块名称',
  25269. reference: 'moduleName',
  25270. layout: 'fit',
  25271. listeners: {
  25272. cardEnter: 'scope.moduleEnter',
  25273. cardLevel: 'scope.moduleLevel'
  25274. },
  25275. items: [
  25276. {
  25277. xtype: 'form',
  25278. border: false,
  25279. layout: {
  25280. type: 'vbox',
  25281. align: 'stretch'
  25282. },
  25283. defaults: {
  25284. border: false,
  25285. anchor: '100%',
  25286. margin: '5',
  25287. },
  25288. items: [
  25289. {
  25290. xtype: 'textfield',
  25291. fieldLabel: '包路径',
  25292. allowBlank: false,
  25293. bind: { value: '{packagePath}' },
  25294. },
  25295. {
  25296. xtype: 'textfield',
  25297. fieldLabel: '文件路径',
  25298. allowBlank: false,
  25299. bind: { value: '{fileSavePath}' },
  25300. },
  25301. {
  25302. xtype: 'textfield',
  25303. fieldLabel: '模块名',
  25304. allowBlank: false,
  25305. bind: { value: '{moduleName}' },
  25306. },
  25307. {
  25308. xtype: 'textfield',
  25309. fieldLabel: '菜单名',
  25310. allowBlank: false,
  25311. bind: { value: '{pageTitle}' },
  25312. },
  25313. ]
  25314. },
  25315. ]
  25316. },
  25317. {
  25318. vtitle: '确认结果',
  25319. reference: 'confirmResult',
  25320. layout: 'fit',
  25321. listeners: {
  25322. cardEnter: 'scope.optionEnter',
  25323. cardLevel: 'scope.optionLevel',
  25324. },
  25325. items: [
  25326. {
  25327. xtype: 'jsoneditor',
  25328. reference: 'jsoneditor'
  25329. }
  25330. ]
  25331. },
  25332. // ---------------------------------------------------------------------------------- 单表查询
  25333. {
  25334. vtitle: '查询SQL',
  25335. reference: 'singleTable_1',
  25336. layout: 'fit',
  25337. listeners: {
  25338. cardEnter: 'scope.editorEnter',
  25339. cardLevel: 'scope.editorLevel'
  25340. },
  25341. items: [
  25342. {
  25343. xtype: 'sqleditor',
  25344. }
  25345. ],
  25346. },
  25347. {
  25348. vtitle: '字段选项',
  25349. reference: 'singleTable_2',
  25350. layout: 'fit',
  25351. listeners: {
  25352. cardEnter: 'scope.columnEnter',
  25353. cardLevel: 'scope.columnLevel',
  25354. },
  25355. items: [
  25356. {
  25357. xtype: 'yvgrid',
  25358. border: false,
  25359. selModel: {
  25360. type: 'spreadsheet',
  25361. columnSelect: true,
  25362. pruneRemoved: false,
  25363. extensible: 'y'
  25364. },
  25365. plugins: {
  25366. clipboard: true,
  25367. selectionreplicator: true
  25368. },
  25369. reference: 'grid1',
  25370. idField: 'column_name',
  25371. hideFootbar: true,
  25372. tbar: {
  25373. xtype: 'toolbar',
  25374. items: [
  25375. {
  25376. xtype: 'button',
  25377. text: '添加',
  25378. iconCls: 'x-fa fa-plus-circle',
  25379. listeners: {
  25380. click: 'scope.addField'
  25381. }
  25382. },
  25383. {
  25384. xtype: 'button',
  25385. text: '删除',
  25386. iconCls: 'x-fa fa-minus-circle',
  25387. listeners: {
  25388. click: 'scope.removeField'
  25389. }
  25390. },
  25391. {
  25392. xtype: 'button',
  25393. text: '分析SQL',
  25394. iconCls: 'x-fa fa-refresh',
  25395. listeners: {
  25396. click: 'scope.parseSQL'
  25397. }
  25398. },
  25399. ]
  25400. },
  25401. columns: [
  25402. {
  25403. text: '字段名', dataIndex: 'column_name',
  25404. sortable: false,
  25405. menuDisabled: true,
  25406. width: 150,
  25407. editor: {
  25408. allowBlank: true,
  25409. selectOnFocus: false,
  25410. }
  25411. },
  25412. {
  25413. text: '字段中文', dataIndex: 'column_comment',
  25414. width: 150,
  25415. sortable: false,
  25416. menuDisabled: true,
  25417. editor: {
  25418. allowBlank: true,
  25419. selectOnFocus: false,
  25420. }
  25421. },
  25422. {
  25423. dataIndex: "column_useto",
  25424. // fix: ['system.getDict("column_useto")'],
  25425. header: "用途",
  25426. editor: {
  25427. xtype: 'combo',
  25428. allowBlank: false,
  25429. },
  25430. },
  25431. {
  25432. text: '主键', dataIndex: 'is_primary_key',
  25433. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25434. width: 48, resizable: false,
  25435. },
  25436. {
  25437. text: '必填', dataIndex: 'not_null',
  25438. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25439. width: 48, resizable: false,
  25440. },
  25441. {
  25442. text: '长度', dataIndex: 'column_size',
  25443. sortable: false, menuDisabled: true,
  25444. xtype: 'numbercolumn', format: '0',
  25445. editor: { allowBlank: true, selectOnFocus: true }
  25446. },
  25447. {
  25448. text: '字典', dataIndex: 'column_dict',
  25449. sortable: false, menuDisabled: true,
  25450. width: 200,
  25451. editor: {
  25452. allowBlank: true,
  25453. }
  25454. },
  25455. {
  25456. text: 'UI组件', dataIndex: 'column_ui',
  25457. sortable: false, menuDisabled: true,
  25458. // fix: ['system.getDict("column_ui")'],
  25459. width: 150,
  25460. editor: {
  25461. xtype: 'combo',
  25462. allowBlank: true,
  25463. }
  25464. },
  25465. {
  25466. dataIndex: 'data_type',
  25467. hidden: true,
  25468. },
  25469. ]
  25470. }
  25471. ],
  25472. },
  25473. {
  25474. vtitle: '其他选项',
  25475. reference: 'singleTable_3',
  25476. isEnd: true,
  25477. listeners: {
  25478. cardEnter: 'scope.extendEnter',
  25479. cardLevel: 'scope.extendLevel',
  25480. },
  25481. layout: 'fit',
  25482. items: [
  25483. {
  25484. xtype: 'form',
  25485. border: false,
  25486. layout: {
  25487. type: 'vbox',
  25488. align: 'stretch'
  25489. },
  25490. defaults: {
  25491. border: false,
  25492. anchor: '100%',
  25493. margin: '5',
  25494. },
  25495. items: [
  25496. {
  25497. xtype: 'checkbox',
  25498. fieldLabel: '需要分页',
  25499. labelWidth: 100,
  25500. bind: {
  25501. value: '{singleTable.pagination}',
  25502. },
  25503. },
  25504. {
  25505. xtype: 'combobox',
  25506. fieldLabel: '操作数据库表',
  25507. labelWidth: 100,
  25508. publishes: 'singleTable.tableName',
  25509. displayField: 'value',
  25510. valueField: 'value',
  25511. bind: {
  25512. data: '{singleTableView.tableNameList}',
  25513. value: '{singleTable.tableName}',
  25514. },
  25515. },
  25516. {
  25517. xtype: 'checkboxfield',
  25518. fieldLabel: '需要删除',
  25519. labelWidth: 100,
  25520. bind: {
  25521. value: '{singleTable.delete}',
  25522. },
  25523. },
  25524. {
  25525. xtype: 'combobox',
  25526. fieldLabel: '删除条件字段',
  25527. labelWidth: 100,
  25528. publishes: 'singleTable.deleteWhereColumn',
  25529. displayField: 'value',
  25530. valueField: 'value',
  25531. bind: {
  25532. data: '{singleTableView.columnList}',
  25533. hidden: '{!singleTable.delete}',
  25534. value: '{singleTable.deleteWhereColumn}',
  25535. },
  25536. },
  25537. {
  25538. xtype: 'textfield',
  25539. fieldLabel: '删除提示语句',
  25540. labelWidth: 100,
  25541. bind: {
  25542. hidden: '{!singleTable.delete}',
  25543. value: '{singleTable.deleteTips}',
  25544. },
  25545. },
  25546. {
  25547. fieldLabel: '新增与编辑',
  25548. labelWidth: 100,
  25549. xtype: 'radiogroup',
  25550. bind: {
  25551. value: '{singleTable.editType}'
  25552. },
  25553. layout: 'vbox',
  25554. defaults: {
  25555. border: false,
  25556. anchor: '100%',
  25557. margin: '5',
  25558. },
  25559. items: [
  25560. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25561. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25562. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25563. ]
  25564. },
  25565. ]
  25566. }
  25567. ]
  25568. },
  25569. // ---------------------------------------------------------------------------------- 主/明细查询
  25570. {
  25571. vtitle: '主表查询SQL',
  25572. reference: 'mainDetailTable_1',
  25573. layout: 'fit',
  25574. listeners: {},
  25575. items: [],
  25576. },
  25577. {
  25578. vtitle: '主表字段选项',
  25579. reference: 'mainDetailTable_2',
  25580. layout: 'fit',
  25581. listeners: {},
  25582. items: [],
  25583. },
  25584. {
  25585. vtitle: '主表其他选项',
  25586. reference: 'mainDetailTable_3',
  25587. layout: 'fit',
  25588. listeners: {},
  25589. items: [],
  25590. },
  25591. {
  25592. vtitle: '子表查询SQL',
  25593. reference: 'mainDetailTable_4',
  25594. layout: 'fit',
  25595. listeners: {},
  25596. items: [],
  25597. },
  25598. {
  25599. vtitle: '子表字段选项',
  25600. reference: 'mainDetailTable_5',
  25601. layout: 'fit',
  25602. listeners: {},
  25603. items: [],
  25604. },
  25605. {
  25606. vtitle: '子表其他选项',
  25607. reference: 'mainDetailTable_6',
  25608. isEnd: true,
  25609. layout: 'fit',
  25610. listeners: {},
  25611. items: [],
  25612. },
  25613. // ---------------------------------------------------------------------------------- 树/明细查询
  25614. // ---------------------------------------------------------------------------------- 卡片表单
  25615. {
  25616. vtitle: '表单字段',
  25617. reference: 'cardForm_1',
  25618. layout: 'fit',
  25619. listeners: {},
  25620. items: [],
  25621. },
  25622. {
  25623. vtitle: '表单初始化',
  25624. reference: 'cardForm_2',
  25625. isEnd: true,
  25626. layout: 'fit',
  25627. listeners: {},
  25628. items: [],
  25629. },
  25630. ]
  25631. };
  25632. //# sourceMappingURL=CreateModule.view.js.map
  25633. // noinspection TypeScriptCheckImport
  25634. function getSingleTableData(origin) {
  25635. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25636. var _a, _b, _c;
  25637. var data = {
  25638. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25639. package: _$2.replace(origin.packagePath, /\//g, "."),
  25640. groovyClass: origin.moduleName,
  25641. qClass: queryDslInfo.qClass,
  25642. qClassTable: queryDslInfo.qClassTable,
  25643. queryColumns: [],
  25644. insertColumns: [],
  25645. updateColumns: [],
  25646. updateWheres: [],
  25647. deleteWheres: [],
  25648. gridColumns: [],
  25649. sql: origin.sql,
  25650. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25651. addButton: origin.editType !== 1,
  25652. saveButton: origin.editType === 2,
  25653. deleteButton: true,
  25654. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25655. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25656. fileSavePath: origin.fileSavePath,
  25657. };
  25658. origin.columnList.forEach(function (column) {
  25659. 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;
  25660. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25661. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25662. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25663. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25664. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25665. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25666. if (query) {
  25667. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25668. }
  25669. if (insert) {
  25670. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25671. }
  25672. if (update) {
  25673. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25674. }
  25675. if (grid) {
  25676. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25677. if (column_dict) {
  25678. gridColumn.fix = { dictName: column_dict };
  25679. }
  25680. if (origin.editType == 2 && (insert || update)) {
  25681. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25682. if (column_dict) {
  25683. gridColumn.editor.fix = { dictName: column_dict };
  25684. }
  25685. }
  25686. data.gridColumns.push(gridColumn);
  25687. }
  25688. if (is_primary_key) {
  25689. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25690. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25691. }
  25692. });
  25693. return data;
  25694. });
  25695. }
  25696. // noinspection HttpUrlsUsage
  25697. var urlPrefix = "/static/studio-template/single_table";
  25698. function generateCode(data) {
  25699. return Promise.all([
  25700. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25701. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25702. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25703. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25704. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25705. ]).then(function (values) {
  25706. var groovy = handlebars.compile(values[0]);
  25707. var mybatis = handlebars.compile(values[1]);
  25708. var controller = handlebars.compile(values[2]);
  25709. var view = handlebars.compile(values[3]);
  25710. var model = handlebars.compile(values[4]);
  25711. var code = {
  25712. groovy: groovy(data),
  25713. mybatis: mybatis(data),
  25714. controller: controller(data),
  25715. view: view(data),
  25716. model: model(data),
  25717. };
  25718. return code;
  25719. });
  25720. }
  25721. //# sourceMappingURL=SingleTableCodegen.js.map
  25722. var CreateModule = /** @class */ (function (_super) {
  25723. __extends(CreateModule, _super);
  25724. function CreateModule() {
  25725. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25726. _this.columns = [];
  25727. return _this;
  25728. }
  25729. CreateModule.prototype.onLoad = function () {
  25730. this.refs.grid1.setData([]);
  25731. };
  25732. CreateModule.prototype.addField = function () {
  25733. this.refs.grid1.appendEditRow({
  25734. column_name: '',
  25735. column_comment: '',
  25736. is_primary_key: false,
  25737. not_null: true,
  25738. column_domain: '',
  25739. data_type: '',
  25740. column_size: 0,
  25741. decimal_digits: 0,
  25742. default_value: '',
  25743. column_dict: '',
  25744. column_ui: '',
  25745. column_note: '',
  25746. }, 0);
  25747. };
  25748. CreateModule.prototype.removeField = function () {
  25749. var _this = this;
  25750. var rows = [];
  25751. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25752. rows.push(r);
  25753. });
  25754. _$2.forEach(rows, function (r) {
  25755. _this.refs.grid1.getStore().remove(r);
  25756. });
  25757. };
  25758. CreateModule.prototype.parseSQL = function (sender) {
  25759. var _this = this;
  25760. var sql = this.viewModel.get('singleTable.sql');
  25761. sender.up('window').setLoading(true);
  25762. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25763. parseSqlApi(sql).then(function (parseResult) {
  25764. if (!parseResult.success) {
  25765. msg(parseResult.msg);
  25766. return;
  25767. }
  25768. var tableNameList = [];
  25769. var columnList = [];
  25770. var singleTableTableName;
  25771. var singleTableDeleteWhereColumn;
  25772. _this.refs.grid1.setData([]);
  25773. var rows = _this.refs.grid1.getDataRows();
  25774. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25775. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25776. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25777. return;
  25778. }
  25779. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25780. tableNameList.push({ value: tableName });
  25781. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25782. columnList.push({ value: columnName });
  25783. if (!singleTableTableName)
  25784. singleTableTableName = tableName;
  25785. if (!singleTableDeleteWhereColumn)
  25786. singleTableDeleteWhereColumn = columnName;
  25787. // 已经加过这个列了
  25788. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25789. if (rowExists) {
  25790. return;
  25791. }
  25792. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25793. if (columnRow) {
  25794. _this.refs.grid1.appendEditRow({
  25795. table_name: tableName,
  25796. column_name: columnRow.column_name,
  25797. column_comment: columnRow.column_comment,
  25798. column_useto: 2,
  25799. is_primary_key: columnRow.is_primary_key,
  25800. not_null: columnRow.not_null,
  25801. column_size: columnRow.column_size,
  25802. column_dict: columnRow.column_dict,
  25803. column_ui: columnRow.column_ui,
  25804. data_type: columnRow.data_type,
  25805. });
  25806. if (columnRow.is_primary_key)
  25807. singleTableDeleteWhereColumn = columnName;
  25808. }
  25809. else {
  25810. _this.refs.grid1.appendEditRow({
  25811. table_name: tableName,
  25812. column_name: columnName,
  25813. column_useto: 2,
  25814. });
  25815. }
  25816. });
  25817. _this.viewModel.set("singleTableView.columnList", columnList);
  25818. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25819. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25820. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25821. }).finally(function () {
  25822. sender.up('window').setLoading(false);
  25823. });
  25824. }).catch(function () {
  25825. sender.up('window').setLoading(false);
  25826. });
  25827. };
  25828. CreateModule.prototype.templateEnter = function (sender) {
  25829. };
  25830. CreateModule.prototype.templateLevel = function (sender, opt) {
  25831. if (!this.viewModel.get('moduleType')) {
  25832. msg('请选择模板类型');
  25833. opt.cancel = true;
  25834. return;
  25835. }
  25836. };
  25837. CreateModule.prototype.moduleEnter = function (sender) {
  25838. };
  25839. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25840. if (!sender.down('form').isValid()) {
  25841. opt.cancel = true;
  25842. return;
  25843. }
  25844. };
  25845. CreateModule.prototype.editorEnter = function (sender) {
  25846. var editor = sender.down('sqleditor');
  25847. editor.setValue(this.viewModel.get('singleTable.sql'));
  25848. };
  25849. CreateModule.prototype.editorLevel = function (sender, opt) {
  25850. var editor = sender.down('sqleditor');
  25851. var sql = editor.getValue();
  25852. if (!sql) {
  25853. msg('查询SQL语句必填');
  25854. opt.cancel = true;
  25855. return;
  25856. }
  25857. this.viewModel.set('singleTable.sql', sql);
  25858. };
  25859. CreateModule.prototype.columnEnter = function (sender) {
  25860. };
  25861. CreateModule.prototype.columnLevel = function (sender, opt) {
  25862. };
  25863. CreateModule.prototype.extendEnter = function (sender) {
  25864. };
  25865. CreateModule.prototype.extendLevel = function (sender, opt) {
  25866. };
  25867. // 确认结果 - Enter
  25868. CreateModule.prototype.optionEnter = function (sender) {
  25869. var _this = this;
  25870. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25871. var moduleType = this.viewModel.get("moduleType");
  25872. var data = this.viewModel.getData();
  25873. var code = "";
  25874. var origin = {};
  25875. if (moduleType === 1) {
  25876. var singleTable = data.singleTable;
  25877. var editColumns = this.refs.grid1.getDataRows();
  25878. origin.moduleType = data.moduleType;
  25879. origin.packagePath = data.packagePath;
  25880. origin.fileSavePath = data.fileSavePath;
  25881. origin.moduleName = data.moduleName;
  25882. origin.pageTitle = data.pageTitle;
  25883. if (singleTable) {
  25884. origin.sql = singleTable.sql;
  25885. origin.tableName = singleTable.tableName;
  25886. origin.pagination = singleTable.pagination;
  25887. origin.delete = singleTable.delete;
  25888. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25889. origin.deleteTips = singleTable.deleteTips;
  25890. origin.editType = singleTable.editType;
  25891. }
  25892. origin.columnList = [];
  25893. origin.queryColumns = [];
  25894. origin.insertColumns = [];
  25895. origin.updateColumns = [];
  25896. origin.gridColumns = [];
  25897. editColumns.forEach(function (column) {
  25898. var row = {
  25899. table_name: column.table_name,
  25900. column_name: column.column_name,
  25901. column_comment: column.column_comment,
  25902. is_primary_key: column.is_primary_key,
  25903. not_null: column.not_null,
  25904. column_size: column.column_size,
  25905. column_dict: column.column_dict,
  25906. column_ui: column.column_ui,
  25907. data_type: column.data_type,
  25908. column_type: column.column_type,
  25909. };
  25910. origin.columnList.push(row);
  25911. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25912. var column_name = column.column_name, column_useto = column.column_useto;
  25913. switch (column_useto) {
  25914. case 1:
  25915. origin.queryColumns.push(column_name);
  25916. break;
  25917. case 2:
  25918. origin.gridColumns.push(column_name);
  25919. break;
  25920. case 3:
  25921. origin.queryColumns.push(column_name);
  25922. origin.gridColumns.push(column_name);
  25923. break;
  25924. }
  25925. origin.insertColumns.push(column_name);
  25926. origin.updateColumns.push(column_name);
  25927. });
  25928. }
  25929. this.setLoading(true);
  25930. getSingleTableData(origin).then(function (data) {
  25931. code = JSON.stringify(data, null, 4);
  25932. window['lastTemplateData'] = code;
  25933. var editor = _this.refs.jsoneditor;
  25934. editor.setCode(code);
  25935. }).finally(function () { return _this.setLoading(false); });
  25936. };
  25937. // 确认结果 - Level
  25938. CreateModule.prototype.optionLevel = function (sender, opt) {
  25939. };
  25940. // 上一步
  25941. CreateModule.prototype.showPrevious = function () {
  25942. this.doCardNavigation(false);
  25943. };
  25944. // 下一步
  25945. CreateModule.prototype.showNext = function () {
  25946. this.doCardNavigation(true, true);
  25947. };
  25948. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25949. if (isNext === void 0) { isNext = true; }
  25950. if (isCancelable === void 0) { isCancelable = false; }
  25951. var layout = this._handle.getLayout();
  25952. var activeItem = layout.activeItem;
  25953. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25954. if (isNext)
  25955. this.prevCard = reference;
  25956. var activeCard;
  25957. if (reference === "templateSelection") {
  25958. if (isNext) {
  25959. activeCard = this.refs['moduleName'];
  25960. }
  25961. }
  25962. else if (reference === "moduleName") {
  25963. if (isNext) {
  25964. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25965. var moduleType = this.viewModel.get("moduleType");
  25966. switch (moduleType) {
  25967. case 1:
  25968. activeCard = this.refs['singleTable_1'];
  25969. break;
  25970. case 2:
  25971. activeCard = this.refs['mainDetailTable_1'];
  25972. break;
  25973. case 3:
  25974. // activeCard =
  25975. break;
  25976. case 4:
  25977. activeCard = this.refs['cardForm_1'];
  25978. break;
  25979. }
  25980. }
  25981. else {
  25982. activeCard = this.refs['templateSelection'];
  25983. }
  25984. }
  25985. else if (reference === "confirmResult") {
  25986. if (!isNext) {
  25987. activeCard = this.refs[this.prevCard];
  25988. }
  25989. }
  25990. else {
  25991. var name = reference.split('_')[0];
  25992. var idx = parseInt(reference.split('_')[1], 10);
  25993. if (isNext) {
  25994. if (isEnd) {
  25995. activeCard = this.refs['confirmResult'];
  25996. }
  25997. else {
  25998. idx += 1;
  25999. }
  26000. }
  26001. else {
  26002. idx -= 1;
  26003. }
  26004. if (idx <= 0) {
  26005. activeCard = this.refs['moduleName'];
  26006. }
  26007. else if (!activeCard) {
  26008. activeCard = this.refs[name + "_" + idx];
  26009. }
  26010. }
  26011. // 按钮状态
  26012. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  26013. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  26014. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  26015. // 设置下一页显示
  26016. if (activeCard) {
  26017. var optCancel = { cancel: false };
  26018. // 发出 cardLevel 事件
  26019. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  26020. if (isCancelable && optCancel.cancel) {
  26021. // 取消了
  26022. return;
  26023. }
  26024. layout.setActiveItem(activeCard);
  26025. this.viewModel.set('title', layout.activeItem.vtitle);
  26026. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  26027. }
  26028. };
  26029. // 立刻执行
  26030. CreateModule.prototype.finish = function (sender) {
  26031. var _this = this;
  26032. var parent = sender.up('window');
  26033. var editor = this.refs.jsoneditor;
  26034. var data = JSON.parse(editor.getCode());
  26035. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26036. var moduleType = this.viewModel.get("moduleType");
  26037. if (moduleType === 1) {
  26038. this.setLoading(true);
  26039. generateCode(data).then(function (code) {
  26040. console.log("===> ", code);
  26041. _this.setLoading(true);
  26042. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  26043. .then(function () {
  26044. msg("创建成功!");
  26045. parent.close();
  26046. handles$1.fileTree.reload();
  26047. }).finally(function () { return _this.setLoading(false); });
  26048. }).finally(function () { return _this.setLoading(false); });
  26049. }
  26050. };
  26051. return CreateModule;
  26052. }(Scope));
  26053. //# sourceMappingURL=CreateModule.js.map
  26054. function getModuleId(path) {
  26055. var separator = "/";
  26056. var sps = path.split(separator);
  26057. var joinSps = sps.join('$');
  26058. if (!joinSps) {
  26059. return "ROOT";
  26060. }
  26061. return joinSps;
  26062. }
  26063. /**
  26064. * Module数据转换成Tree数据
  26065. */
  26066. function modulesToTreeData(modules) {
  26067. var separator = "/";
  26068. var treeNodeMap = new Map();
  26069. var root = {
  26070. type: "Dir",
  26071. path: "",
  26072. expanded: true,
  26073. leaf: false,
  26074. children: [],
  26075. };
  26076. root.id = getModuleId(root.path);
  26077. treeNodeMap.set(root.path, root);
  26078. modules.forEach(function (module) {
  26079. var _a;
  26080. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  26081. if (paths.length <= 0)
  26082. return;
  26083. var path = [];
  26084. var parent = root;
  26085. paths.forEach(function (dirName, idx) {
  26086. var parentPath = path.join(separator);
  26087. parent = treeNodeMap.get(parentPath);
  26088. path.push(dirName);
  26089. var currentPath = path.join(separator);
  26090. var child = treeNodeMap.get(currentPath);
  26091. if (child == null) {
  26092. // 获取当前path 绝对路径
  26093. var indexLength = module.absolutePath.indexOf(currentPath);
  26094. var currentAbsolutePath = "";
  26095. if (indexLength > 0) {
  26096. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  26097. }
  26098. child = {
  26099. type: "Dir",
  26100. path: currentPath,
  26101. absolutePath: currentAbsolutePath,
  26102. leaf: false,
  26103. children: [],
  26104. text: dirName
  26105. };
  26106. child.id = getModuleId(child.path);
  26107. parent.children.push(child);
  26108. treeNodeMap.set(child.path, child);
  26109. }
  26110. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  26111. var leaf = {
  26112. type: "Module",
  26113. path: module.path + separator + module.name,
  26114. absolutePath: module.absolutePath,
  26115. leaf: true,
  26116. text: module.name,
  26117. module: module,
  26118. };
  26119. leaf.id = getModuleId(leaf.path);
  26120. child.children.push(leaf);
  26121. treeNodeMap.set(leaf.path, leaf);
  26122. }
  26123. });
  26124. });
  26125. // 排序处理
  26126. treeNodeMap.forEach(function (module) {
  26127. if (module.children) {
  26128. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26129. module.children.length = 0;
  26130. children.forEach(function (item) { return module.children.push(item); });
  26131. }
  26132. });
  26133. return root;
  26134. }
  26135. function showDialog(sender, option) {
  26136. var _a, _b;
  26137. var win = new Ext.Window({
  26138. autoDestroy: true,
  26139. title: option.title,
  26140. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26141. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26142. resizable: false,
  26143. closable: true,
  26144. modal: true,
  26145. maximizable: false,
  26146. minimizable: false,
  26147. // constrainHeader: true,
  26148. constrain: true,
  26149. layout: 'fit',
  26150. animateTarget: sender,
  26151. buttonAlign: 'center',
  26152. items: [
  26153. {
  26154. xtype: "form",
  26155. layout: "hbox",
  26156. margin: '10px 20px',
  26157. border: 0,
  26158. items: option.items
  26159. }
  26160. ],
  26161. //窗口按钮
  26162. fbar: [
  26163. {
  26164. xtype: 'button', text: '保存', handler: function (btn) {
  26165. //窗口获取表单
  26166. var form = win.down('form');
  26167. var vaildSuccess = form.isValid();
  26168. if (!vaildSuccess) {
  26169. return;
  26170. }
  26171. option.submitFunc(form);
  26172. }
  26173. },
  26174. {
  26175. xtype: 'button', text: '取消', handler: function (btn) {
  26176. //窗口关闭
  26177. btn.up('window').close();
  26178. }
  26179. }
  26180. ],
  26181. });
  26182. win.show();
  26183. }
  26184. function showCreateFolderWin(sender, parentPath) {
  26185. showDialog(sender, {
  26186. title: '新建文件夹',
  26187. height: 150,
  26188. items: [
  26189. {
  26190. xtype: "textfield",
  26191. name: "filename",
  26192. fieldLabel: "文件夹名称",
  26193. allowBlank: false,
  26194. selectOnFocus: true,
  26195. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26196. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26197. labelWidth: 80,
  26198. width: "100%",
  26199. listeners: {
  26200. afterrender: function (sender) {
  26201. _$2.defer(function () {
  26202. sender.focus();
  26203. });
  26204. }
  26205. }
  26206. },
  26207. ],
  26208. submitFunc: function (form) {
  26209. var filename = form.down('textfield[name="filename"]').getValue();
  26210. createFolder(parentPath, filename).then(function (res) {
  26211. if (res.success) {
  26212. msg$1('创建成功');
  26213. handles$1.fileTree.reload();
  26214. form.up('window').close();
  26215. }
  26216. else {
  26217. showErrorDialog$1(res.msg);
  26218. }
  26219. }).catch(function (e) {
  26220. showErrorDialog$1(e.responseJSON.msg);
  26221. });
  26222. }
  26223. });
  26224. }
  26225. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26226. var dlg = new CreateModule();
  26227. dlg.showDialog(sender, {}, {
  26228. data: {
  26229. packagePath: path,
  26230. fileSavePath: absolutePath,
  26231. }
  26232. });
  26233. }
  26234. function registerModule$1(sender, path, name, icon) {
  26235. // 前缀 com/galaxis/wms 写死了
  26236. var dlg = new RegisterModule();
  26237. dlg.showDialog(sender, {}, {
  26238. data: {
  26239. form: {
  26240. scope_url: path.replace("com/galaxis/wms", "."),
  26241. resource_name: name,
  26242. resource_icon: icon,
  26243. }
  26244. }
  26245. });
  26246. }
  26247. function showCreateEmptyModule(sender, path) {
  26248. var win = new Ext.Window({
  26249. autoDestroy: true,
  26250. title: "新建空模块",
  26251. width: 400,
  26252. height: 150,
  26253. resizable: true,
  26254. closable: true,
  26255. maximizable: true,
  26256. minimizable: true,
  26257. plain: true,
  26258. // constrainHeader: true,
  26259. constrain: true,
  26260. layout: 'fit',
  26261. animateTarget: sender,
  26262. buttonAlign: 'center',
  26263. items: [
  26264. {
  26265. xtype: "form",
  26266. layout: "hbox",
  26267. margin: '10px 20px',
  26268. border: 0,
  26269. items: [
  26270. {
  26271. flex: 1,
  26272. layout: 'vbox',
  26273. items: [
  26274. {
  26275. xtype: "textfield",
  26276. name: "filename",
  26277. fieldLabel: "模块名",
  26278. flex: 1,
  26279. allowBlank: false,
  26280. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26281. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26282. labelWidth: 50,
  26283. width: "100%",
  26284. },
  26285. ]
  26286. },
  26287. ]
  26288. }
  26289. ],
  26290. //窗口按钮
  26291. buttons: [
  26292. {
  26293. xtype: 'button', text: '保存', handler: function (btn) {
  26294. //窗口获取表单
  26295. var form = win.down('form');
  26296. var vaildSuccess = form.isValid();
  26297. if (!vaildSuccess) {
  26298. return;
  26299. }
  26300. var filename = form.down('textfield[name="filename"]').getValue();
  26301. createEmptyModule(path, filename).then(function (res) {
  26302. if (res.success) {
  26303. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26304. handles$1.fileTree.reload();
  26305. win.close();
  26306. }
  26307. else {
  26308. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26309. }
  26310. }).catch(function (e) {
  26311. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26312. });
  26313. }
  26314. },
  26315. {
  26316. xtype: 'button', text: '取消', handler: function (btn) {
  26317. //窗口关闭
  26318. win.close();
  26319. }
  26320. }
  26321. ]
  26322. });
  26323. win.show();
  26324. }
  26325. //# sourceMappingURL=FileHelp.js.map
  26326. function initFileTree () {
  26327. Ext.define('com.yvan.studio.FileTree', {
  26328. extend: 'com.yvan.studio.StateTree',
  26329. xtype: 'filetree',
  26330. tooltip: '文件',
  26331. iconCls: 'x-fa fa-file',
  26332. rootVisible: false,
  26333. useArrows: true,
  26334. colspan: 2,
  26335. lines: true,
  26336. reference: 'filetree',
  26337. multiSelect: true,
  26338. getStateFilename: function () {
  26339. return getCurrentProject().uuid + "/filetree.json";
  26340. },
  26341. openNode: function () {
  26342. var selection = this.getSelection();
  26343. var _a = __read(selection, 1), record = _a[0];
  26344. if (!record) {
  26345. return;
  26346. }
  26347. var raw = record.raw;
  26348. if (raw.type === 'Dir') {
  26349. return;
  26350. }
  26351. if (raw.type === "Module" && raw.module) {
  26352. eventBus.publish(EventType.ModuleOpen, raw);
  26353. }
  26354. },
  26355. openInIdea: function () {
  26356. var _a = __read(this.getSelection(), 1), record = _a[0];
  26357. if (record) {
  26358. var data = record.data;
  26359. if (data.type === "Module") {
  26360. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26361. native.openInIdea(data.module.groovyFile.absolutePath);
  26362. }
  26363. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26364. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26365. }
  26366. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26367. native.openInIdea(data.module.jsViewFile.absolutePath);
  26368. }
  26369. return;
  26370. }
  26371. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26372. }
  26373. },
  26374. deleteSelection: function () {
  26375. var selection = this.getSelection();
  26376. var pathList = [];
  26377. _.forEach(selection, function (item) {
  26378. if (item.data.type === "Dir") {
  26379. pathList.push({ path: item.data.path, isFolder: true });
  26380. }
  26381. else {
  26382. pathList.push({ path: item.data.path, isFolder: false });
  26383. }
  26384. });
  26385. {
  26386. return;
  26387. }
  26388. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26389. //
  26390. // Ext.Msg.confirm('提示', title, (btn) => {
  26391. // if (btn === 'yes') {
  26392. // deleteFileOrFolder(raw.path, title, true)
  26393. // }
  26394. // })
  26395. // const title = '您确定要删除(' + raw.path + ')吗?'
  26396. // deleteFileOrFolder(raw.path, title, false)
  26397. },
  26398. listeners: {
  26399. itemverify: function () {
  26400. this.openNode();
  26401. },
  26402. afterrender: function (me) {
  26403. console.log('filetree_afterrender', 'reloadIfNeed');
  26404. moduleStore.registe(me.subscribeModule.bind(this));
  26405. moduleStore.reloadIfNeed("PC");
  26406. },
  26407. destroy: function (me) {
  26408. console.log('filetree_destroy');
  26409. moduleStore.unregiste(me.subscribeModule.bind(this));
  26410. },
  26411. itemcontextmenu: function (sender, node, element, idx, e) {
  26412. e.preventDefault();
  26413. var raw = node.raw;
  26414. var option = {};
  26415. if (raw.type === 'Dir') {
  26416. // 文件夹右键
  26417. option = {
  26418. shadow: 'frame', allowOtherMenus: true,
  26419. items: [
  26420. {
  26421. text: '新建空模块',
  26422. iconCls: 'x-fa fa-plus-circle',
  26423. handler: function (sender) {
  26424. showCreateEmptyModule(sender, raw.path);
  26425. }
  26426. },
  26427. {
  26428. text: '新建模块',
  26429. iconCls: 'x-fa fa-plus-circle',
  26430. handler: function (sender) {
  26431. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26432. }
  26433. },
  26434. '-',
  26435. {
  26436. text: '新建文件夹',
  26437. iconCls: 'x-fa fa-folder-o',
  26438. handler: function (sender) {
  26439. var parentPath = raw.path;
  26440. showCreateFolderWin(sender, parentPath);
  26441. }
  26442. },
  26443. {
  26444. text: '复制路径',
  26445. iconCls: 'x-fa fa-external-link',
  26446. handler: function (sender) {
  26447. native.clipboardSet(raw.path);
  26448. }
  26449. },
  26450. ]
  26451. };
  26452. }
  26453. else {
  26454. // 文件右键
  26455. option = {
  26456. shadow: 'frame', allowOtherMenus: true,
  26457. items: [
  26458. // {
  26459. // text: '重命名',
  26460. // iconCls: 'x-fa fa-terminal',
  26461. // handler(sender) {
  26462. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26463. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26464. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26465. // }
  26466. // },
  26467. // {
  26468. // text: '另存为',
  26469. // iconCls: 'x-fa fa-exchange',
  26470. // handler(sender) {
  26471. // console.error('没做')
  26472. // }
  26473. // },
  26474. {
  26475. text: '复制路径',
  26476. iconCls: 'x-fa fa-external-link',
  26477. handler: function (sender) {
  26478. native.clipboardSet(raw.path);
  26479. }
  26480. },
  26481. '-',
  26482. {
  26483. text: '注册模块',
  26484. iconCls: 'x-fa fa-sign-in',
  26485. handler: function (sender) {
  26486. registerModule$1(sender, raw.path);
  26487. }
  26488. },
  26489. ]
  26490. };
  26491. }
  26492. var treeMenu = new Ext.menu.Menu(option);
  26493. treeMenu.showAt(e.getXY());
  26494. },
  26495. },
  26496. tbar: [
  26497. {
  26498. xtype: 'button',
  26499. iconCls: 'x-fa fa-crosshairs',
  26500. tooltip: '选中当前打开的文件',
  26501. handler: function (sender) {
  26502. msg$1('没做');
  26503. }
  26504. },
  26505. {
  26506. xtype: 'button',
  26507. iconCls: 'x-fa fa-link',
  26508. tooltip: '在IDEA中打开',
  26509. handler: function (sender) {
  26510. var scope = sender.up("filetree");
  26511. scope.openInIdea();
  26512. }
  26513. },
  26514. {
  26515. xtype: 'button',
  26516. iconCls: 'x-fa fa-refresh',
  26517. tooltip: '刷新',
  26518. handler: function (sender) {
  26519. var scope = sender.up("filetree");
  26520. scope.reload();
  26521. }
  26522. },
  26523. {
  26524. xtype: 'button',
  26525. iconCls: 'x-fa fa-percent',
  26526. tooltip: '监控',
  26527. handler: function (sender) {
  26528. // handles.mainWindow.showPerform()
  26529. }
  26530. },
  26531. ],
  26532. initComponent: function () {
  26533. setFileTree(this);
  26534. this.superclass.initComponent.apply(this, arguments);
  26535. // super.initComponent.apply(this, arguments)
  26536. },
  26537. subscribeModule: function (res) {
  26538. if (typeof res === 'object') {
  26539. var rootNode = modulesToTreeData(res.data);
  26540. this.setRootNode(rootNode);
  26541. this.restoreState();
  26542. handles$1.mainWindow.modules = res.data;
  26543. }
  26544. else if (typeof res === 'boolean') {
  26545. this.setLoading(res);
  26546. }
  26547. },
  26548. reload: function () {
  26549. console.log('filetree_reloadForce');
  26550. moduleStore.reloadForce("PC").then(function (res) {
  26551. });
  26552. }
  26553. });
  26554. }
  26555. //# sourceMappingURL=FileTree.js.map
  26556. function initDbTree () {
  26557. var define = {
  26558. extend: 'com.yvan.studio.StateTree',
  26559. xtype: 'dbtree',
  26560. tooltip: '数据库',
  26561. iconCls: 'x-fa fa-database',
  26562. rootVisible: false,
  26563. useArrows: true,
  26564. reference: 'dbtree',
  26565. multiSelect: true,
  26566. getStateFilename: function () {
  26567. return getCurrentProject().uuid + "/dbtree.json";
  26568. },
  26569. tbar: [
  26570. {
  26571. xtype: 'button',
  26572. iconCls: 'x-fa fa-crosshairs',
  26573. tooltip: '选中当前打开的表',
  26574. handler: function (sender) {
  26575. var _a;
  26576. // 获取当前选中的活动标签 tableColumn_bas_car
  26577. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26578. if (!locatPath) {
  26579. return;
  26580. }
  26581. handles$1.dbTree.selectPath(locatPath);
  26582. }
  26583. },
  26584. {
  26585. xtype: 'button',
  26586. iconCls: 'x-fa fa-refresh',
  26587. tooltip: '刷新',
  26588. handler: function (sender) {
  26589. handles$1.dbTree.reload();
  26590. }
  26591. },
  26592. {
  26593. xtype: 'button',
  26594. iconCls: 'x-fa fa-cloud-download',
  26595. tooltip: '重新拉取生成元数据(耗时很长!)',
  26596. handler: function (sender) {
  26597. handles$1.dbTree.dbToMetaAndReload(sender);
  26598. }
  26599. },
  26600. // {
  26601. // xtype: 'button',
  26602. // iconCls: 'x-fa fa-files-o',
  26603. // tooltip: '数据同步',
  26604. // handler(sender) {
  26605. //
  26606. // }
  26607. // },
  26608. {
  26609. xtype: 'button',
  26610. iconCls: 'x-fa fa-exchange',
  26611. tooltip: '数据结构同步',
  26612. handler: function (sender) {
  26613. // handles.mainWindow.showDataSync(sender)
  26614. }
  26615. },
  26616. {
  26617. xtype: 'button',
  26618. iconCls: 'x-fa fa-window-maximize',
  26619. tooltip: 'SQL查询分析器',
  26620. handler: function (sender) {
  26621. // handles.mainWindow.showDbCodeTemplate(sender)
  26622. }
  26623. },
  26624. {
  26625. xtype: 'button',
  26626. iconCls: 'x-fa fa-cubes',
  26627. tooltip: '数据域管理',
  26628. handler: function (sender) {
  26629. // handles.mainWindow.showColumnDomain()
  26630. }
  26631. },
  26632. {
  26633. xtype: 'button',
  26634. iconCls: 'x-fa fa-edit',
  26635. tooltip: '修改结构',
  26636. handler: function (sender) {
  26637. var tree = sender.up("treepanel");
  26638. var selection = tree.getSelection();
  26639. var _a = __read(selection, 1), node = _a[0];
  26640. if (!node) {
  26641. msg$1('请选择一个表');
  26642. return;
  26643. }
  26644. var raw = node.data.raw;
  26645. if (node.get('type') === 'table') ;
  26646. else if (node.get('type') === 'column') ;
  26647. }
  26648. },
  26649. ],
  26650. listeners: {
  26651. afterrender: function (me) {
  26652. setDbTree(this);
  26653. // 找管理器订阅刷新的事件
  26654. instance$1.registe(this.refreshData.bind(this));
  26655. instance$1.reloadIfNeed(undefined);
  26656. },
  26657. destory: function (me) {
  26658. setDbTree(undefined);
  26659. instance$1.unregiste(this.refreshData.bind(this));
  26660. },
  26661. itemcontextmenu: function (sender, node, element, idx, e) {
  26662. var _this = this;
  26663. e.preventDefault();
  26664. var option = {};
  26665. var raw = node.raw.raw;
  26666. if (node.get('type') === 'column') {
  26667. option = {
  26668. shadow: 'frame', allowOtherMenus: true,
  26669. items: [
  26670. {
  26671. text: '设计结构',
  26672. iconCls: 'x-fa fa-edit',
  26673. handler: function (sender) {
  26674. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26675. }
  26676. },
  26677. ]
  26678. };
  26679. }
  26680. else if (node.get('type') === 'table') {
  26681. option = {
  26682. shadow: 'frame', allowOtherMenus: true,
  26683. items: [
  26684. {
  26685. text: '新建',
  26686. iconCls: 'x-fa fa-plus',
  26687. handler: function (sender) {
  26688. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26689. }
  26690. },
  26691. {
  26692. text: '设计结构',
  26693. iconCls: 'x-fa fa-edit',
  26694. handler: function (sender) {
  26695. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26696. }
  26697. },
  26698. {
  26699. text: '重命名',
  26700. iconCls: 'x-fa fa-pencil',
  26701. handler: function (sender) {
  26702. _this.renameTable(sender, node.data.raw);
  26703. }
  26704. },
  26705. '-',
  26706. {
  26707. text: '删除',
  26708. iconCls: 'x-fa fa-minus',
  26709. handler: function (sender) {
  26710. _this.removeTable(sender, node.data.raw);
  26711. }
  26712. },
  26713. ]
  26714. };
  26715. }
  26716. var treeMenu = new Ext.menu.Menu(option);
  26717. treeMenu.showAt(e.getXY());
  26718. }
  26719. },
  26720. // DbTreeStore 刷新时,会回调到这个方法
  26721. refreshData: function (isLoadingState) {
  26722. var me = this;
  26723. if (typeof isLoadingState === 'boolean') {
  26724. me.setLoading(isLoadingState);
  26725. return;
  26726. }
  26727. var rootNode = getDbTree(instance$1.apiResponse);
  26728. me.setRootNode(rootNode);
  26729. this.restoreState();
  26730. },
  26731. renameTable: function (sender, tableRow) {
  26732. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26733. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26734. if (!res.data)
  26735. return;
  26736. var window = Ext.create('Ext.window.Window', {
  26737. title: 'SQL 预览',
  26738. height: 400,
  26739. width: 600,
  26740. modal: true,
  26741. animateTarget: sender,
  26742. maximizable: true,
  26743. layout: 'fit',
  26744. items: {
  26745. xtype: 'sqleditor',
  26746. value: res.data,
  26747. },
  26748. buttons: [
  26749. {
  26750. xtype: 'button',
  26751. text: '执行',
  26752. iconCls: 'x-fa fa-save',
  26753. handler: function (sender) {
  26754. var editor = sender.up('window').down('sqleditor');
  26755. var ddl = editor.getValue();
  26756. window.setLoading(true);
  26757. instance$1.pushToDbCommit({
  26758. schema_name: tableRow.schema_name,
  26759. table_name: name,
  26760. old_table_name: tableRow.table_name,
  26761. ddl: ddl,
  26762. }).then(function () {
  26763. handles$1.dbTree.reload();
  26764. window.close();
  26765. }).finally(function () { return window.setLoading(false); });
  26766. },
  26767. },
  26768. {
  26769. xtype: 'button',
  26770. text: '取消',
  26771. iconCls: 'x-fa fa-times',
  26772. handler: function () {
  26773. window.close();
  26774. }
  26775. },
  26776. ]
  26777. }).show();
  26778. });
  26779. });
  26780. },
  26781. removeTable: function (sender, tableRow) {
  26782. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26783. if (!res.data)
  26784. return;
  26785. var window = Ext.create('Ext.window.Window', {
  26786. title: 'SQL 预览',
  26787. height: 400,
  26788. width: 600,
  26789. modal: true,
  26790. animateTarget: sender,
  26791. maximizable: true,
  26792. layout: 'fit',
  26793. items: {
  26794. xtype: 'sqleditor',
  26795. value: res.data,
  26796. },
  26797. buttons: [
  26798. {
  26799. xtype: 'button',
  26800. text: '执行',
  26801. iconCls: 'x-fa fa-save',
  26802. handler: function (sender) {
  26803. var editor = sender.up('window').down('sqleditor');
  26804. var ddl = editor.getValue();
  26805. window.setLoading(true);
  26806. instance$1.pushToDbCommit({
  26807. schema_name: tableRow.schema_name,
  26808. table_name: tableRow.table_name,
  26809. ddl: ddl
  26810. })
  26811. .then(function () {
  26812. handles$1.dbTree.reload();
  26813. window.close();
  26814. }).finally(function () { return window.setLoading(false); });
  26815. }
  26816. },
  26817. {
  26818. xtype: 'button',
  26819. text: '取消',
  26820. iconCls: 'x-fa fa-times',
  26821. handler: function () {
  26822. window.close();
  26823. }
  26824. }
  26825. ]
  26826. }).show();
  26827. });
  26828. },
  26829. // hideHeaders: true,
  26830. // columns: [
  26831. // {
  26832. // xtype: 'treecolumn',
  26833. // text: '名称',
  26834. // dataIndex: 'text',
  26835. // flex: 2,
  26836. // }, {
  26837. // text: '描述',
  26838. // dataIndex: 'comment',
  26839. // flex: 1,
  26840. // }
  26841. // ],
  26842. reload: function () {
  26843. // 强制刷新 DbManager
  26844. instance$1.reloadForce(undefined);
  26845. },
  26846. dbToMetaAndReload: function () {
  26847. // 从数据库结构重新生成元数据
  26848. instance$1.dbToMetaAndReload();
  26849. }
  26850. };
  26851. Ext.define('com.yvan.studio.DbTree', define);
  26852. }
  26853. /**
  26854. * 将数据构建成 dbTree 需要的格式
  26855. */
  26856. function getDbTree(apiResponse) {
  26857. var rootNode = {
  26858. children: [],
  26859. expanded: true,
  26860. id: "ROOT",
  26861. leaf: false,
  26862. };
  26863. _$2.forEach(apiResponse, function (schemaRow) {
  26864. var schemaNode = {
  26865. id: 'schema$' + schemaRow.schema_name,
  26866. type: "schema",
  26867. expanded: true,
  26868. leaf: false,
  26869. iconCls: 'x-fa fa-th-large ',
  26870. text: schemaRow.schema_name,
  26871. raw: __assign({}, schemaRow),
  26872. children: [],
  26873. };
  26874. delete schemaNode.raw.table_list;
  26875. rootNode.children.push(schemaNode);
  26876. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26877. var _a;
  26878. var tableNode = {
  26879. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26880. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26881. comment: tableRow.description,
  26882. type: "table",
  26883. iconCls: 'x-fa fa-table',
  26884. expanded: false,
  26885. leaf: false,
  26886. children: [],
  26887. raw: __assign({}, tableRow)
  26888. };
  26889. delete tableNode.raw.column_list;
  26890. schemaNode.children.push(tableNode);
  26891. _$2.forEach(tableRow.column_list, function (columnRow) {
  26892. var _a;
  26893. var iconCls = 'x-fa fa-square-o';
  26894. if (columnRow.is_primary_key) {
  26895. iconCls = 'x-fa fa-key';
  26896. }
  26897. else if (columnRow.not_null) {
  26898. iconCls = 'x-fa fa-check-square';
  26899. }
  26900. var columnNode = {
  26901. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26902. type: "column",
  26903. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26904. comment: columnRow.column_comment,
  26905. leaf: true,
  26906. iconCls: iconCls,
  26907. raw: __assign({}, columnRow)
  26908. };
  26909. tableNode.children.push(columnNode);
  26910. }); // column
  26911. }); // table
  26912. }); // schema
  26913. return rootNode;
  26914. }
  26915. //# sourceMappingURL=DbTree.js.map
  26916. var ReportGridController = /** @class */ (function () {
  26917. function ReportGridController() {
  26918. }
  26919. ReportGridController.prototype.onLoad = function (sender) {
  26920. this.reload();
  26921. setReport(this);
  26922. };
  26923. ReportGridController.prototype.showSingle = function (sender) {
  26924. var _this = this;
  26925. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26926. if (record) {
  26927. handles.mainWindow.showFormSingle(record.data, function () {
  26928. _this.reload();
  26929. });
  26930. }
  26931. };
  26932. ReportGridController.prototype.filterChanged = function (sender, value) {
  26933. console.log('filterChange', sender, value);
  26934. this.view.store.clearFilter();
  26935. if (value) {
  26936. this.view.store.filterBy(function (record) {
  26937. var code = _.lowerCase(record.get('report_name'));
  26938. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26939. return (code.includes(value) ||
  26940. dict_desc_py.includes(value));
  26941. });
  26942. }
  26943. };
  26944. ReportGridController.prototype.onClearClick = function () {
  26945. var _a, _b;
  26946. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26947. };
  26948. ReportGridController.prototype.reload = function () {
  26949. var me = this;
  26950. me.getView().setLoading(true);
  26951. reportListApi().then(function (res) {
  26952. _.forEach(res.data, function (r) {
  26953. r.report_enable = r.report_enable === 1;
  26954. });
  26955. me.getView().setStore(new Ext.data.Store({
  26956. fields: ['report_id', 'report_name', 'report_enable'],
  26957. data: res.data,
  26958. }));
  26959. }).finally(function () {
  26960. me.getView().setLoading(false);
  26961. });
  26962. };
  26963. ReportGridController.prototype.reportAdd = function () {
  26964. var _this = this;
  26965. prompt$2('请输入报表名称').then(function (name) {
  26966. createReportApi(name).then(function (res) {
  26967. if (res.success) {
  26968. msg$1('添加成功');
  26969. handles.mainWindow.showReport(res.data, name, function () {
  26970. _this.reload();
  26971. });
  26972. }
  26973. _this.reload();
  26974. });
  26975. });
  26976. };
  26977. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26978. e.preventDefault();
  26979. var me = sender.up('grid').ownerGrid.getController();
  26980. var option = {
  26981. shadow: 'frame', allowOtherMenus: true,
  26982. items: [
  26983. {
  26984. text: '添加',
  26985. iconCls: 'x-fa fa-plus-circle',
  26986. handler: function (sender) {
  26987. me.reportAdd();
  26988. }
  26989. },
  26990. {
  26991. text: '编辑',
  26992. iconCls: 'x-fa fa-edit',
  26993. handler: function (sender) {
  26994. me.reportEdit();
  26995. }
  26996. },
  26997. {
  26998. text: '删除',
  26999. iconCls: 'x-fa fa-minus-circle',
  27000. handler: function (sender) {
  27001. me.reportRemove();
  27002. }
  27003. },
  27004. '-',
  27005. {
  27006. text: '注册(至菜单)',
  27007. iconCls: 'x-fa fa-sign-in',
  27008. handler: function (sender) {
  27009. me.reportRegiste(sender);
  27010. }
  27011. },
  27012. {
  27013. text: '卸载',
  27014. iconCls: 'x-fa fa-sign-out',
  27015. handler: function (sender) {
  27016. console.error('没做');
  27017. }
  27018. },
  27019. ]
  27020. };
  27021. var treeMenu = new Ext.menu.Menu(option);
  27022. treeMenu.showAt(e.getXY());
  27023. };
  27024. ReportGridController.prototype.reportRegiste = function (sender) {
  27025. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27026. if (record) {
  27027. var reportName = record.get('report_name');
  27028. var reportId = record.get('report_id');
  27029. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  27030. }
  27031. };
  27032. ReportGridController.prototype.reportRemove = function () {
  27033. var _this = this;
  27034. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27035. if (record) {
  27036. var reportName = record.get('report_name');
  27037. var reportId_1 = record.get('report_id');
  27038. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  27039. delReportApi(reportId_1).then(function (res) {
  27040. if (res.success) {
  27041. msg$1('删除成功');
  27042. _this.reload();
  27043. }
  27044. });
  27045. });
  27046. }
  27047. };
  27048. ReportGridController.prototype.reportEdit = function () {
  27049. var _this = this;
  27050. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27051. if (record) {
  27052. var reportName = record.get('report_name');
  27053. var reportId = record.get('report_id');
  27054. handles.mainWindow.showReport(reportId, reportName, function () {
  27055. _this.reload();
  27056. });
  27057. }
  27058. };
  27059. ReportGridController.prototype.onDblClick = function (sender) {
  27060. this.reportEdit();
  27061. };
  27062. return ReportGridController;
  27063. }());
  27064. //# sourceMappingURL=ReportGridController.js.map
  27065. function initReportGrid () {
  27066. var controller = new ReportGridController();
  27067. Ext.define('com.yvan.studio.ReportGrid', {
  27068. extend: 'Ext.grid.Panel',
  27069. xtype: 'reportGrid',
  27070. controller: controller,
  27071. scope: controller,
  27072. referenceHolder: true,
  27073. tooltip: '查询报表',
  27074. iconCls: 'x-fa fa-bar-chart',
  27075. useArrows: true,
  27076. reference: 'reportgrid',
  27077. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  27078. listeners: {
  27079. itemdblclick: 'onDblClick',
  27080. afterrender: 'onLoad',
  27081. },
  27082. viewConfig: {
  27083. listeners: {
  27084. itemcontextmenu: 'onGridContextMenu',
  27085. },
  27086. },
  27087. tbar: {
  27088. xtype: 'toolbar',
  27089. items: [
  27090. {
  27091. xtype: 'button',
  27092. tooltip: '测试',
  27093. iconCls: 'x-fa fa-bars',
  27094. listeners: {
  27095. click: 'showSingle'
  27096. }
  27097. },
  27098. {
  27099. xtype: 'button',
  27100. tooltip: '刷新',
  27101. iconCls: 'x-fa fa-refresh',
  27102. listeners: {
  27103. click: 'reload'
  27104. }
  27105. },
  27106. {
  27107. xtype: 'button',
  27108. tooltip: '添加',
  27109. iconCls: 'x-fa fa-plus-circle',
  27110. listeners: {
  27111. click: 'reportAdd'
  27112. }
  27113. },
  27114. {
  27115. xtype: 'button',
  27116. tooltip: '删除',
  27117. iconCls: 'x-fa fa-minus-circle',
  27118. listeners: {
  27119. click: 'reportRemove'
  27120. }
  27121. },
  27122. {
  27123. xtype: 'textfield',
  27124. flex: 1,
  27125. reference: "txtFilter",
  27126. emptyText: '搜索过滤',
  27127. enableKeyEvents: true,
  27128. listeners: {
  27129. change: {
  27130. fn: 'filterChanged',
  27131. buffer: 50
  27132. }
  27133. }
  27134. },
  27135. ]
  27136. },
  27137. columns: [
  27138. {
  27139. text: 'ID', dataIndex: 'report_id',
  27140. hidden: true,
  27141. },
  27142. {
  27143. text: '报表名称', dataIndex: 'report_name',
  27144. menuDisabled: true, flex: 1,
  27145. },
  27146. ]
  27147. });
  27148. }
  27149. //# sourceMappingURL=ReportGrid.js.map
  27150. /** 所有变量类型 */
  27151. var TypeEnum;
  27152. (function (TypeEnum) {
  27153. TypeEnum["string"] = "string";
  27154. TypeEnum["number"] = "number";
  27155. TypeEnum["object"] = "object";
  27156. TypeEnum["array"] = "array";
  27157. TypeEnum["function"] = "function";
  27158. TypeEnum["null"] = "null";
  27159. TypeEnum["boolean"] = "boolean";
  27160. TypeEnum["symbol"] = "symbol";
  27161. TypeEnum["json"] = "json";
  27162. TypeEnum["math"] = "math";
  27163. TypeEnum["regexp"] = "regexp";
  27164. TypeEnum["date"] = "date";
  27165. TypeEnum["undefined"] = "undefined";
  27166. TypeEnum["nan"] = "nan";
  27167. TypeEnum["reactNode"] = "react_node";
  27168. })(TypeEnum || (TypeEnum = {}));
  27169. /**
  27170. * 判断对象类型
  27171. * @param object 对象
  27172. */
  27173. var variableTypeOf = function (object) {
  27174. var typeStr = Object.prototype.toString.call(object);
  27175. var typeName;
  27176. switch (("" + typeStr).toLowerCase()) {
  27177. case '[object string]':
  27178. typeName = TypeEnum.string;
  27179. break;
  27180. case '[object number]':
  27181. if (Number.isNaN(object)) {
  27182. return TypeEnum.nan;
  27183. }
  27184. typeName = TypeEnum.number;
  27185. break;
  27186. case '[object object]':
  27187. if (object.$$typeof && object.props) {
  27188. var type = variableTypeOf(object.$$typeof);
  27189. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27190. return TypeEnum.reactNode;
  27191. }
  27192. }
  27193. typeName = TypeEnum.object;
  27194. break;
  27195. case '[object array]':
  27196. typeName = TypeEnum.array;
  27197. break;
  27198. case '[object function]':
  27199. typeName = TypeEnum.function;
  27200. break;
  27201. case '[object null]':
  27202. typeName = TypeEnum.null;
  27203. break;
  27204. case '[object boolean]':
  27205. typeName = TypeEnum.boolean;
  27206. break;
  27207. case '[object date]':
  27208. typeName = TypeEnum.date;
  27209. break;
  27210. // 不常用
  27211. case '[object symbol]':
  27212. typeName = TypeEnum.symbol;
  27213. break;
  27214. case '[object json]':
  27215. typeName = TypeEnum.json;
  27216. break;
  27217. case '[object math]':
  27218. typeName = TypeEnum.math;
  27219. break;
  27220. case '[object regexp]':
  27221. typeName = TypeEnum.regexp;
  27222. break;
  27223. // 貌似不会走的分支
  27224. case '[object undefined]':
  27225. typeName = TypeEnum.undefined;
  27226. break;
  27227. // 无法识别
  27228. default:
  27229. if (object === undefined) {
  27230. return TypeEnum.undefined;
  27231. }
  27232. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27233. typeName = TypeEnum.object;
  27234. }
  27235. return typeName;
  27236. };
  27237. //# sourceMappingURL=typeof.js.map
  27238. function initGroovyEditor () {
  27239. Ext.define('com.yvan.studio.GroovyEditor', {
  27240. extend: 'Ext.panel.Panel',
  27241. alias: 'widget.groovyeditor',
  27242. xtype: 'groovyeditor',
  27243. layout: 'fit',
  27244. border: false,
  27245. html: "<div class=\"editor\"/>",
  27246. config: {
  27247. value: ''
  27248. },
  27249. codeChange: undefined,
  27250. isChangeFromOuter: false,
  27251. getCode: function () {
  27252. if (this.editor) {
  27253. return this.editor.getValue();
  27254. }
  27255. else {
  27256. return this.code;
  27257. }
  27258. },
  27259. setCode: function (value) {
  27260. var _this = this;
  27261. this.code = value;
  27262. this.value = value;
  27263. _$2.defer(function () {
  27264. _this.isChangeFromOuter = true;
  27265. if (_this.editor) {
  27266. _this.editor.setValue(value);
  27267. }
  27268. });
  27269. },
  27270. applyPosition: function () {
  27271. var _this = this;
  27272. if (this.autoFocusMethod) {
  27273. if (this.editor) {
  27274. _$2.defer(function () {
  27275. if (_this.autoFocusStartLine) {
  27276. _this.editor.setPosition({
  27277. lineNumber: _this.autoFocusStartLine,
  27278. column: _this.autoFocusStartColumn
  27279. });
  27280. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27281. }
  27282. _this.editor.focus();
  27283. });
  27284. delete this.autoFocusMethod;
  27285. }
  27286. }
  27287. this.editor.layout();
  27288. },
  27289. getValue: function () {
  27290. return this.value;
  27291. },
  27292. setValue: function (value, fromEditor) {
  27293. var me = this;
  27294. if (me.value === value) {
  27295. // 值相等,不需要变化
  27296. return;
  27297. }
  27298. if (fromEditor !== true && me.editor) {
  27299. // 不是来源于编辑器的变化,才设置编辑器的值
  27300. me.editor.setValue(value);
  27301. }
  27302. // 通知mixins setValue
  27303. me.value = value;
  27304. me.fireEvent('change', value);
  27305. },
  27306. initComponent: function () {
  27307. var that = this;
  27308. this.superclass.initComponent.call(this, arguments);
  27309. that.on({
  27310. resize: function () {
  27311. if (that.editor) {
  27312. that.editor.layout();
  27313. }
  27314. },
  27315. destory: function () {
  27316. if (that.editor) {
  27317. that.editor.dispose();
  27318. delete that.editor;
  27319. }
  27320. },
  27321. afterrender: function (sender) {
  27322. var $dom = $(that.el.dom).find('.editor');
  27323. attach_3($dom[0], {
  27324. value: that.code
  27325. }).then(function (editor) {
  27326. that.editor = editor;
  27327. that.applyPosition();
  27328. that.editor.onDidChangeModelContent(function (e) {
  27329. that.fireEvent('change', that.editor, e);
  27330. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27331. that.codeChange(that.editor.getValue(), that.name, e);
  27332. }
  27333. that.isChangeFromOuter = false;
  27334. });
  27335. });
  27336. }
  27337. });
  27338. }
  27339. });
  27340. }
  27341. function attach_3(element, opts) {
  27342. return new Promise(function (resolve) {
  27343. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27344. enabled: false
  27345. } }));
  27346. editor.onKeyUp(function (e) {
  27347. // console.log(e)
  27348. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27349. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27350. }
  27351. });
  27352. resolve(editor);
  27353. });
  27354. }
  27355. //# sourceMappingURL=GroovyEditor.js.map
  27356. function initJsEditor$1 () {
  27357. Ext.define('com.yvan.studio.JsEditor', {
  27358. extend: 'Ext.panel.Panel',
  27359. alias: 'widget.jseditor',
  27360. xtype: 'jseditor',
  27361. layout: 'fit',
  27362. border: false,
  27363. html: "<div class=\"editor\"/>",
  27364. autoFocusMethod: true,
  27365. autoFocusStartLine: 0,
  27366. autoFocusStartColumn: 0,
  27367. codeChange: undefined,
  27368. funcArr: [],
  27369. modulePage: null,
  27370. isChangeFromOuter: false,
  27371. name: "",
  27372. /**
  27373. * 设置代码
  27374. */
  27375. setCode: function (value) {
  27376. var _this = this;
  27377. this.code = value;
  27378. _$2.defer(function () {
  27379. _this.isChangeFromOuter = true;
  27380. if (_this.editor) {
  27381. _this.editor.setValue(value);
  27382. if (_this.name === "controllerEditor") {
  27383. _this.funcArr = _this.getAllFunction();
  27384. }
  27385. }
  27386. });
  27387. },
  27388. getCode: function () {
  27389. var _a;
  27390. if (!this.editor) {
  27391. return this.code;
  27392. }
  27393. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27394. },
  27395. applyPosition: function () {
  27396. var _this = this;
  27397. if (this.autoFocusMethod) {
  27398. if (this.editor) {
  27399. _$2.defer(function () {
  27400. if (_this.autoFocusStartLine) {
  27401. _this.editor.setPosition({
  27402. lineNumber: _this.autoFocusStartLine,
  27403. column: _this.autoFocusStartColumn
  27404. });
  27405. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27406. }
  27407. _this.editor.focus();
  27408. });
  27409. delete this.autoFocusMethod;
  27410. }
  27411. }
  27412. this.editor.layout();
  27413. },
  27414. initComponent: function () {
  27415. var that = this;
  27416. this.superclass.initComponent.apply(this, arguments);
  27417. this.on({
  27418. resize: function (sender, width, height) {
  27419. if (that.editor) {
  27420. that.editor.layout();
  27421. }
  27422. },
  27423. destory: function () {
  27424. if (that.editor) {
  27425. that.editor.dispose();
  27426. delete that.editor;
  27427. }
  27428. },
  27429. afterrender: function () {
  27430. var $dom = $(that.el.dom).find('.editor');
  27431. attach_1($dom[0], {
  27432. value: that.code
  27433. }).then(function (editor) {
  27434. that.editor = editor;
  27435. that.applyPosition();
  27436. that.editor.onDidChangeModelContent(function (e) {
  27437. that.fireEvent('change', that.editor, e);
  27438. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27439. that.codeChange(that.editor.getValue(), that.name, e);
  27440. }
  27441. that.isChangeFromOuter = false;
  27442. });
  27443. });
  27444. }
  27445. });
  27446. },
  27447. getAllFunction: function () {
  27448. var funcArr = [];
  27449. var ast = window['YvanUI'].recast.parse(this.code);
  27450. if (ast && ast.program && ast.program.body) {
  27451. if (Array.isArray(ast.program.body)) {
  27452. for (var i = 0; i < ast.program.body.length; i++) {
  27453. var m = ast.program.body[i];
  27454. if (m.type === "ExportDefaultDeclaration") {
  27455. if (m.declaration.type === "ClassDeclaration") {
  27456. if (m.declaration.body.type === "ClassBody") {
  27457. if (Array.isArray(m.declaration.body.body)) {
  27458. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27459. var ob = m.declaration.body.body[j];
  27460. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27461. var funcItem = { name: ob.key.name, args: [] };
  27462. if (Array.isArray(ob.value.params)) {
  27463. for (var k = 0; k < ob.value.params.length; k++) {
  27464. var p = ob.value.params[k];
  27465. funcItem.args.push(p.name);
  27466. }
  27467. }
  27468. funcArr.push(funcItem);
  27469. }
  27470. }
  27471. }
  27472. }
  27473. }
  27474. }
  27475. }
  27476. }
  27477. }
  27478. return funcArr;
  27479. }
  27480. });
  27481. }
  27482. var isInited = false;
  27483. function attach_1(element, opts) {
  27484. return new Promise(function (resolve) {
  27485. var monaco = window['monaco'];
  27486. if (!isInited) {
  27487. isInited = true;
  27488. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27489. noSemanticValidation: true,
  27490. noSyntaxValidation: false
  27491. });
  27492. // compiler options
  27493. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27494. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27495. allowNonTsExtensions: true,
  27496. });
  27497. // extra libraries
  27498. var libSource = [
  27499. 'declare class Facts {',
  27500. ' /**',
  27501. ' * Returns the next fact',
  27502. ' */',
  27503. ' static next():string',
  27504. ' static next222():string',
  27505. '}',
  27506. "\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 ",
  27507. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27508. ].join('\n');
  27509. var libUri = 'file:///index.d.ts';
  27510. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27511. // When resolving definitions and references, the editor will try to use created models.
  27512. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27513. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27514. }
  27515. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27516. resolve(editor);
  27517. });
  27518. }
  27519. //# sourceMappingURL=JsEditor.js.map
  27520. function initJsonEditor$1 () {
  27521. Ext.define('com.yvan.studio.JsonEditor', {
  27522. extend: 'Ext.panel.Panel',
  27523. alias: 'widget.jsoneditor',
  27524. xtype: 'jsoneditor',
  27525. layout: 'fit',
  27526. border: false,
  27527. html: "<div class=\"editor\"/>",
  27528. autoFocusMethod: true,
  27529. autoFocusStartLine: 0,
  27530. autoFocusStartColumn: 0,
  27531. codeChange: undefined,
  27532. funcArr: [],
  27533. modulePage: null,
  27534. isChangeFromOuter: false,
  27535. name: "",
  27536. /**
  27537. * 设置代码
  27538. */
  27539. setCode: function (value) {
  27540. var _this = this;
  27541. this.code = value;
  27542. _$2.defer(function () {
  27543. _this.isChangeFromOuter = true;
  27544. if (_this.editor) {
  27545. _this.editor.setValue(value);
  27546. }
  27547. });
  27548. },
  27549. updateOptions: function (options) {
  27550. if (this.editor && options) {
  27551. this.editor.updateOptions(options);
  27552. }
  27553. },
  27554. setLanguage: function (lang) {
  27555. if (this.editor && lang) {
  27556. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27557. }
  27558. },
  27559. getCode: function () {
  27560. var _a;
  27561. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27562. },
  27563. applyPosition: function () {
  27564. var _this = this;
  27565. if (this.autoFocusMethod) {
  27566. if (this.editor) {
  27567. _$2.defer(function () {
  27568. if (_this.autoFocusStartLine) {
  27569. _this.editor.setPosition({
  27570. lineNumber: _this.autoFocusStartLine,
  27571. column: _this.autoFocusStartColumn
  27572. });
  27573. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27574. }
  27575. _this.editor.focus();
  27576. });
  27577. delete this.autoFocusMethod;
  27578. }
  27579. }
  27580. this.editor.layout();
  27581. },
  27582. initComponent: function () {
  27583. var that = this;
  27584. this.superclass.initComponent.apply(this, arguments);
  27585. this.on({
  27586. resize: function (sender, width, height) {
  27587. if (that.editor) {
  27588. that.editor.layout();
  27589. }
  27590. },
  27591. destory: function () {
  27592. if (that.editor) {
  27593. that.editor.dispose();
  27594. delete that.editor;
  27595. }
  27596. },
  27597. afterrender: function (sender) {
  27598. var $dom = $(that.el.dom).find('.editor');
  27599. attach_116($dom[0], {
  27600. value: that.code
  27601. }).then(function (editor) {
  27602. that.editor = editor;
  27603. that.applyPosition();
  27604. that.editor.onDidChangeModelContent(function (e) {
  27605. that.fireEvent('change', that.editor, e);
  27606. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27607. that.codeChange(that.editor.getValue(), that.name, e);
  27608. }
  27609. that.isChangeFromOuter = false;
  27610. });
  27611. });
  27612. }
  27613. });
  27614. },
  27615. });
  27616. }
  27617. function attach_116(element, opts) {
  27618. return new Promise(function (resolve) {
  27619. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27620. enabled: false
  27621. } }));
  27622. editor.onKeyUp(function (e) {
  27623. // console.log(e)
  27624. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27625. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27626. }
  27627. });
  27628. resolve(editor);
  27629. });
  27630. }
  27631. //# sourceMappingURL=JsonEditor.js.map
  27632. function initSqlEditor$1 () {
  27633. Ext.define('com.yvan.studio.SqlEditor', {
  27634. extend: 'Ext.panel.Panel',
  27635. alias: 'widget.sqleditor',
  27636. xtype: 'sqleditor',
  27637. layout: 'fit',
  27638. border: false,
  27639. html: "<div class=\"editor\"/>",
  27640. config: {
  27641. value: ''
  27642. },
  27643. codeChange: undefined,
  27644. isChangeFromOuter: false,
  27645. setCode: function (value) {
  27646. var _this = this;
  27647. this.code = value;
  27648. this.value = value;
  27649. _$2.defer(function () {
  27650. _this.isChangeFromOuter = true;
  27651. if (_this.editor) {
  27652. _this.editor.setValue(value);
  27653. }
  27654. });
  27655. },
  27656. getCode: function () {
  27657. return this.getValue();
  27658. },
  27659. updateOptions: function (options) {
  27660. if (this.editor && options) {
  27661. this.editor.updateOptions(options);
  27662. }
  27663. },
  27664. getValue: function () {
  27665. if (!this.editor) {
  27666. return this.code;
  27667. }
  27668. return this.editor.getValue();
  27669. },
  27670. applyPosition: function () {
  27671. var _this = this;
  27672. if (this.autoFocusMethod) {
  27673. if (this.editor) {
  27674. _$2.defer(function () {
  27675. if (_this.autoFocusStartLine) {
  27676. _this.editor.setPosition({
  27677. lineNumber: _this.autoFocusStartLine,
  27678. column: _this.autoFocusStartColumn
  27679. });
  27680. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27681. }
  27682. _this.editor.focus();
  27683. });
  27684. delete this.autoFocusMethod;
  27685. }
  27686. }
  27687. this.editor.layout();
  27688. },
  27689. setValue: function (value, fromEditor) {
  27690. this.setCode(value);
  27691. var me = this;
  27692. if (me.value === value) {
  27693. // 值相等,不需要变化
  27694. return;
  27695. }
  27696. if (fromEditor !== true && me.editor) {
  27697. // 不是来源于编辑器的变化,才设置编辑器的值
  27698. me.editor.setValue(value);
  27699. }
  27700. // 通知mixins setValue
  27701. me.value = value;
  27702. me.fireEvent('change', value);
  27703. },
  27704. initComponent: function () {
  27705. var that = this;
  27706. this.superclass.initComponent.call(this);
  27707. that.on({
  27708. resize: function () {
  27709. if (that.editor) {
  27710. that.editor.layout();
  27711. }
  27712. },
  27713. destory: function () {
  27714. if (that.editor) {
  27715. that.editor.dispose();
  27716. delete that.editor;
  27717. }
  27718. },
  27719. afterrender: function (sender) {
  27720. var $dom = $(that.el.dom).find('.editor');
  27721. attach_2($dom[0], {
  27722. value: that.code
  27723. }).then(function (editor) {
  27724. that.editor = editor;
  27725. that.applyPosition();
  27726. that.editor.onDidChangeModelContent(function (e) {
  27727. that.fireEvent('change', that.editor, e);
  27728. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27729. that.codeChange(that.editor.getValue(), that.name, e);
  27730. }
  27731. that.isChangeFromOuter = false;
  27732. });
  27733. });
  27734. }
  27735. });
  27736. }
  27737. });
  27738. }
  27739. function attach_2(element, opts) {
  27740. return new Promise(function (resolve) {
  27741. var monaco = window['monaco'];
  27742. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27743. enabled: false
  27744. } }));
  27745. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27746. // const sql = editor.getValue()
  27747. // if (_.trim(sql).length > 0) {
  27748. // editor.setValue(format(sql, {
  27749. // indent: ' ',
  27750. // uppercase: true,
  27751. // }))
  27752. // }
  27753. msg$1('没做');
  27754. });
  27755. editor.onKeyUp(function (e) {
  27756. // console.log(e)
  27757. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27758. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27759. }
  27760. });
  27761. resolve(editor);
  27762. });
  27763. }
  27764. //# sourceMappingURL=SqlEditor.js.map
  27765. function initTemplateEditor () {
  27766. Ext.define('com.yvan.studio.TemplateEditor', {
  27767. extend: 'Ext.panel.Panel',
  27768. alias: 'widget.templateeditor',
  27769. xtype: 'templateeditor',
  27770. layout: 'fit',
  27771. border: false,
  27772. html: "<div class=\"editor\"/>",
  27773. autoFocusMethod: true,
  27774. autoFocusStartLine: 0,
  27775. autoFocusStartColumn: 0,
  27776. codeChange: undefined,
  27777. funcArr: [],
  27778. modulePage: null,
  27779. isChangeFromOuter: false,
  27780. name: "",
  27781. /**
  27782. * 设置代码
  27783. */
  27784. setCode: function (value) {
  27785. var _this = this;
  27786. this.code = value;
  27787. _$2.defer(function () {
  27788. _this.isChangeFromOuter = true;
  27789. if (_this.editor) {
  27790. _this.editor.setValue(value);
  27791. }
  27792. });
  27793. },
  27794. getCode: function () {
  27795. var _a;
  27796. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27797. },
  27798. applyPosition: function () {
  27799. var _this = this;
  27800. if (this.autoFocusMethod) {
  27801. if (this.editor) {
  27802. _$2.defer(function () {
  27803. if (_this.autoFocusStartLine) {
  27804. _this.editor.setPosition({
  27805. lineNumber: _this.autoFocusStartLine,
  27806. column: _this.autoFocusStartColumn
  27807. });
  27808. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27809. }
  27810. _this.editor.focus();
  27811. });
  27812. delete this.autoFocusMethod;
  27813. }
  27814. }
  27815. this.editor.layout();
  27816. },
  27817. initComponent: function () {
  27818. var that = this;
  27819. this.superclass.initComponent.apply(this, arguments);
  27820. this.on({
  27821. resize: function (sender, width, height) {
  27822. if (that.editor) {
  27823. that.editor.layout();
  27824. }
  27825. },
  27826. destory: function () {
  27827. if (that.editor) {
  27828. that.editor.dispose();
  27829. delete that.editor;
  27830. }
  27831. },
  27832. afterrender: function (sender) {
  27833. var $dom = $(that.el.dom).find('.editor');
  27834. attach_117($dom[0], {
  27835. value: that.code
  27836. }).then(function (editor) {
  27837. that.editor = editor;
  27838. that.applyPosition();
  27839. that.editor.onDidChangeModelContent(function (e) {
  27840. that.fireEvent('change', that.editor, e);
  27841. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27842. that.codeChange(that.editor.getValue(), that.name, e);
  27843. }
  27844. that.isChangeFromOuter = false;
  27845. });
  27846. });
  27847. }
  27848. });
  27849. },
  27850. });
  27851. }
  27852. function attach_117(element, opts) {
  27853. return new Promise(function (resolve) {
  27854. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27855. enabled: false
  27856. } }));
  27857. editor.onKeyUp(function (e) {
  27858. // console.log(e)
  27859. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27860. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27861. }
  27862. });
  27863. resolve(editor);
  27864. });
  27865. }
  27866. //# sourceMappingURL=TemplateEditor.js.map
  27867. var DictStore = /** @class */ (function (_super) {
  27868. __extends(DictStore, _super);
  27869. function DictStore() {
  27870. return _super !== null && _super.apply(this, arguments) || this;
  27871. }
  27872. DictStore.prototype.getCacheKey = function (param) {
  27873. return "dict_data.json";
  27874. };
  27875. DictStore.prototype.invokeApi = function (param) {
  27876. return getDict(param);
  27877. };
  27878. DictStore.prototype.getDicts = function () {
  27879. return this.apiResponse.data.dict;
  27880. };
  27881. DictStore.prototype.getDictCodes = function () {
  27882. return new Promise(function (resolve) {
  27883. // reloadIfNeedPromise().then(() => {
  27884. // const result = []
  27885. // _.forEach(this.getDicts(), dictRow => {
  27886. // result.push({
  27887. // id: dictRow.dict_code,
  27888. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27889. // })
  27890. // })
  27891. // resolve(result)
  27892. // })
  27893. });
  27894. };
  27895. DictStore.prototype.saveDict = function (param) {
  27896. return saveDictApi(param);
  27897. };
  27898. DictStore.prototype.saveDictItems = function (param) {
  27899. return saveDictItemsApi(param);
  27900. };
  27901. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27902. var results = [];
  27903. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27904. if (dictItemRow.dict_code === dict_code) {
  27905. results.push(_$2.clone(dictItemRow));
  27906. }
  27907. });
  27908. return results;
  27909. };
  27910. return DictStore;
  27911. }(CacheStore));
  27912. var instance$2 = new DictStore();
  27913. //# sourceMappingURL=DictStore.js.map
  27914. var DictTreeController = /** @class */ (function () {
  27915. function DictTreeController() {
  27916. this._saveStateFlag = true;
  27917. }
  27918. DictTreeController.prototype.dictSave = function () {
  27919. var _this = this;
  27920. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27921. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27922. if (err) {
  27923. // 如果有异常就不保存
  27924. return;
  27925. }
  27926. // 进行业务上的逻辑校验,比如说必填校验等等
  27927. var hasError = false;
  27928. _$2.forEach(rows, function (row, i) {
  27929. if (isEmpty(row.dict_code)) {
  27930. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27931. hasError = true;
  27932. return false;
  27933. }
  27934. });
  27935. if (hasError) {
  27936. return;
  27937. }
  27938. // 设置当前界面为 "保存中..." 状态
  27939. this.view.setLoading(true);
  27940. instance$2.saveDict({
  27941. newRows: newRows,
  27942. modifyRows: modifyRows,
  27943. removeRecords: removeRecords,
  27944. }).then(function (res) {
  27945. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27946. msg$1(res.msg);
  27947. _this.reload();
  27948. }).finally(function () {
  27949. // 无论正常异常,关闭 "保存中..." 状态
  27950. _this.view.setLoading(false);
  27951. });
  27952. };
  27953. DictTreeController.prototype.dictItemSave = function () {
  27954. var _this = this;
  27955. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27956. var currentDictCode = undefined;
  27957. if (record) {
  27958. currentDictCode = record.get('dict_code');
  27959. }
  27960. if (!currentDictCode) {
  27961. msg$1('请选择一个字典');
  27962. return;
  27963. }
  27964. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27965. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27966. if (err) {
  27967. // 如果有异常就不保存
  27968. return;
  27969. }
  27970. // 进行业务上的逻辑校验,比如说必填校验等等
  27971. var hasError = false;
  27972. _$2.forEach(rows, function (row, i) {
  27973. if (!row.dict_value && row.dict_value !== 0) {
  27974. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27975. hasError = true;
  27976. return false;
  27977. }
  27978. });
  27979. if (hasError) {
  27980. return;
  27981. }
  27982. // 设置当前界面为 "保存中..." 状态
  27983. this.view.setLoading(true);
  27984. instance$2.saveDictItems({
  27985. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  27986. newRows: newRows,
  27987. modifyRows: modifyRows,
  27988. removeRecords: removeRecords,
  27989. dict_code: currentDictCode
  27990. }).then(function (res) {
  27991. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27992. msg$1(res.msg);
  27993. _this.reload();
  27994. }).finally(function () {
  27995. // 无论正常异常,关闭 "保存中..." 状态
  27996. _this.view.setLoading(false);
  27997. });
  27998. };
  27999. DictTreeController.prototype.createDictEnum = function () {
  28000. var _this = this;
  28001. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28002. var currentDictCode = undefined;
  28003. if (record) {
  28004. currentDictCode = record.get('dict_code');
  28005. }
  28006. if (!currentDictCode) {
  28007. msg$1('请选择一个字典');
  28008. return;
  28009. }
  28010. // 设置当前界面为 "保存中..." 状态
  28011. this.view.setLoading(true);
  28012. createDictEnum({ dictCode: currentDictCode })
  28013. .then(function () { return _this.reload(); })
  28014. .finally(function () { return _this.view.setLoading(false); });
  28015. };
  28016. DictTreeController.prototype.onLoad = function () {
  28017. setDictTree(this);
  28018. this.grid1 = this.view.lookupReference('grid1');
  28019. this.grid2 = this.view.lookupReference('grid2');
  28020. this.grid1.setData([]);
  28021. this.grid2.setData([]);
  28022. // this.grid1.columns[0].hide()
  28023. this.grid2.columns[0].hide();
  28024. // 找管理器订阅刷新的事件
  28025. instance$2.registe(this.refreshData.bind(this));
  28026. // 非强制性刷新 DbManager
  28027. instance$2.reloadIfNeed(undefined);
  28028. };
  28029. DictTreeController.prototype.onDestory = function () {
  28030. instance$2.unregiste(this.refreshData.bind(this));
  28031. };
  28032. // dictStore 刷新时,会回调到这个方法
  28033. DictTreeController.prototype.refreshData = function (isLoadingState) {
  28034. var me = this;
  28035. if (typeof isLoadingState === 'boolean') {
  28036. me.view.setLoading(isLoadingState);
  28037. return;
  28038. }
  28039. this.grid1.setData(instance$2.getDicts());
  28040. this.restoreState();
  28041. };
  28042. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  28043. var _this = this;
  28044. _$2.defer(function () {
  28045. _this.saveState();
  28046. });
  28047. if (!record) {
  28048. this.grid2.setData([]);
  28049. return;
  28050. }
  28051. var dict_code = record.get('dict_code');
  28052. var data = instance$2.getDictItemByDictcode(dict_code);
  28053. this.grid2.setData(data);
  28054. };
  28055. DictTreeController.prototype.reload = function () {
  28056. var _this = this;
  28057. // 强制刷新 DbManager
  28058. instance$2.reloadForce(undefined).then(function (res) {
  28059. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  28060. });
  28061. };
  28062. DictTreeController.prototype.dictAdd = function () {
  28063. this.grid1.appendEditRow({
  28064. _createFlag: true,
  28065. dict_code: '',
  28066. dict_desc: '',
  28067. }, 0);
  28068. };
  28069. DictTreeController.prototype.dictRemove = function () {
  28070. this.grid1.removeEditRow();
  28071. };
  28072. DictTreeController.prototype.dictItemAdd = function () {
  28073. var _a, _b;
  28074. 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;
  28075. if (!dict_code) {
  28076. msg$1('请先保存字典');
  28077. return;
  28078. }
  28079. this.grid2.appendEditRow({
  28080. dict_code: dict_code,
  28081. dict_text: '',
  28082. dict_value: '',
  28083. }, 0);
  28084. };
  28085. DictTreeController.prototype.dictItemRemove = function () {
  28086. var _this = this;
  28087. var rows = [];
  28088. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  28089. rows.push(r);
  28090. });
  28091. _$2.forEach(rows, function (r) {
  28092. _this.grid2.getStore().remove(r);
  28093. });
  28094. };
  28095. DictTreeController.prototype.clearSearch1 = function () {
  28096. this.grid1.store.clearFilter();
  28097. };
  28098. DictTreeController.prototype.search1 = function (sender) {
  28099. this.grid1.store.clearFilter();
  28100. this.getViewModel().set('grid1.selection', null);
  28101. this.grid1.fireEvent('itemselect');
  28102. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28103. if (!value) {
  28104. return;
  28105. }
  28106. this.grid1.store.filterBy(function (record) {
  28107. if (record.get('_createFlag')) {
  28108. return true;
  28109. }
  28110. var dict_code = _$2.lowerCase(record.get('dict_code'));
  28111. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  28112. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  28113. return (dict_code.includes(value) ||
  28114. dict_desc.includes(value) ||
  28115. dict_desc_py.includes(value));
  28116. });
  28117. };
  28118. DictTreeController.prototype.clearSearch2 = function () {
  28119. this.grid2.store.clearFilter();
  28120. };
  28121. DictTreeController.prototype.search2 = function (sender) {
  28122. this.grid2.store.clearFilter();
  28123. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28124. if (!value) {
  28125. return;
  28126. }
  28127. this.grid2.store.filterBy(function (record) {
  28128. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28129. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28130. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28131. return (dict_text.includes(value) ||
  28132. dict_value === value ||
  28133. dict_text_py.includes(value));
  28134. });
  28135. };
  28136. DictTreeController.prototype.getStateFilename = function () {
  28137. return getCurrentProject().uuid + "/dicttree.json";
  28138. };
  28139. DictTreeController.prototype.restoreState = function () {
  28140. var _this = this;
  28141. var grid = this.grid1;
  28142. native.loadFile(this.getStateFilename(), function (content) {
  28143. if (!content)
  28144. return;
  28145. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28146. _this._saveStateFlag = false;
  28147. if (selection) {
  28148. var idx = grid.store.findExact('dict_code', selection);
  28149. if (idx >= 0) {
  28150. var record = grid.store.getAt(idx);
  28151. if (record) {
  28152. grid.setSelection([record]);
  28153. }
  28154. }
  28155. }
  28156. if (scrollPosition && scrollSize) {
  28157. var size = grid.scrollable.getSize();
  28158. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28159. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28160. }
  28161. }
  28162. setTimeout(function () {
  28163. _this._saveStateFlag = true;
  28164. }, 200);
  28165. });
  28166. };
  28167. DictTreeController.prototype.saveState = function () {
  28168. if (!this._saveStateFlag) {
  28169. return;
  28170. }
  28171. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28172. var selection = undefined;
  28173. if (record) {
  28174. selection = record.get('dict_code');
  28175. }
  28176. var scrollPosition = this.grid1.scrollable.position;
  28177. var scrollSize = this.grid1.scrollable.getSize();
  28178. native.saveFile(this.getStateFilename(), {
  28179. selection: selection,
  28180. scrollPosition: scrollPosition,
  28181. scrollSize: scrollSize
  28182. });
  28183. };
  28184. return DictTreeController;
  28185. }());
  28186. //# sourceMappingURL=DictTreeController.js.map
  28187. function initDict$1 () {
  28188. var controller = new DictTreeController();
  28189. Ext.define('com.yvan.studio.DictTree', {
  28190. extend: 'Ext.panel.Panel',
  28191. xtype: 'dicttree',
  28192. controller: controller,
  28193. scope: controller,
  28194. referenceHolder: true,
  28195. tooltip: '字典',
  28196. iconCls: 'x-fa fa-book',
  28197. rootVisible: false,
  28198. useArrows: true,
  28199. reference: 'dicttree',
  28200. layout: 'border',
  28201. listeners: {
  28202. afterrender: 'onLoad',
  28203. destory: 'onDestory',
  28204. },
  28205. items: [
  28206. {
  28207. region: 'center',
  28208. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28209. _mode: 'select',
  28210. tbar: [
  28211. {
  28212. xtype: 'button',
  28213. tooltip: '刷新',
  28214. iconCls: 'x-fa fa-refresh',
  28215. listeners: {
  28216. click: 'reload'
  28217. }
  28218. },
  28219. {
  28220. xtype: 'button',
  28221. tooltip: '添加',
  28222. iconCls: 'x-fa fa-plus-circle',
  28223. listeners: {
  28224. click: 'dictAdd'
  28225. }
  28226. },
  28227. {
  28228. xtype: 'button',
  28229. tooltip: '删除',
  28230. iconCls: 'x-fa fa-minus-circle',
  28231. bind: {
  28232. disabled: '{!grid1.selection}'
  28233. },
  28234. listeners: {
  28235. click: 'dictRemove'
  28236. }
  28237. },
  28238. {
  28239. xtype: 'button',
  28240. tooltip: '保存',
  28241. iconCls: 'x-fa fa-save',
  28242. bind: {
  28243. disabled: '{!grid1.ischanged}'
  28244. },
  28245. listeners: {
  28246. click: 'dictSave'
  28247. }
  28248. },
  28249. {
  28250. xtype: 'textfield',
  28251. hideClear: true,
  28252. triggers: {
  28253. clear: {
  28254. cls: 'x-form-clear-trigger',
  28255. handler: 'clearSearch1'
  28256. },
  28257. },
  28258. flex: 1,
  28259. emptyText: '搜索过滤',
  28260. enableKeyEvents: true,
  28261. listeners: {
  28262. keyup: {
  28263. fn: 'search1',
  28264. buffer: 50
  28265. }
  28266. }
  28267. },
  28268. ],
  28269. listeners: {
  28270. itemselect: 'grid1Selected',
  28271. },
  28272. idField: 'dict_code',
  28273. columns: [
  28274. {
  28275. text: '字典编号', dataIndex: 'dict_code',
  28276. menuDisabled: true, flex: 1,
  28277. editor: {
  28278. allowBlank: true,
  28279. selectOnFocus: false
  28280. }
  28281. },
  28282. {
  28283. text: '中文描述', dataIndex: 'dict_desc',
  28284. menuDisabled: true, flex: 1,
  28285. editor: {
  28286. allowBlank: true,
  28287. selectOnFocus: false
  28288. }
  28289. },
  28290. ]
  28291. },
  28292. {
  28293. region: 'south', height: '50%',
  28294. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28295. split: true,
  28296. _mode: 'edit1',
  28297. listeners: {},
  28298. tbar: [
  28299. {
  28300. xtype: 'button',
  28301. tooltip: '添加',
  28302. iconCls: 'x-fa fa-plus-circle',
  28303. bind: {
  28304. disabled: '{!grid1.selection}'
  28305. },
  28306. listeners: {
  28307. click: 'dictItemAdd'
  28308. }
  28309. },
  28310. {
  28311. xtype: 'button',
  28312. tooltip: '删除',
  28313. iconCls: 'x-fa fa-minus-circle',
  28314. bind: {
  28315. disabled: '{!grid1.selection}'
  28316. },
  28317. listeners: {
  28318. click: 'dictItemRemove'
  28319. }
  28320. },
  28321. {
  28322. xtype: 'button',
  28323. tooltip: '保存',
  28324. iconCls: 'x-fa fa-save',
  28325. bind: {
  28326. disabled: '{!grid2.ischanged}'
  28327. },
  28328. listeners: {
  28329. click: 'dictItemSave'
  28330. }
  28331. },
  28332. {
  28333. xtype: 'button',
  28334. tooltip: '刷新代码',
  28335. iconCls: 'x-fa fa-code',
  28336. bind: {
  28337. disabled: '{!grid1.selection}'
  28338. },
  28339. listeners: {
  28340. click: 'createDictEnum'
  28341. }
  28342. },
  28343. ],
  28344. columns: [
  28345. {
  28346. text: '字典项', dataIndex: 'dict_text',
  28347. menuDisabled: true, flex: 1,
  28348. editor: {
  28349. allowBlank: true,
  28350. selectOnFocus: false
  28351. }
  28352. },
  28353. {
  28354. text: '字典值', dataIndex: 'dict_value',
  28355. menuDisabled: true, flex: 1,
  28356. dataType: 'int',
  28357. editor: {
  28358. xtype: 'numberfield',
  28359. allowBlank: true,
  28360. selectOnFocus: false
  28361. }
  28362. },
  28363. {
  28364. text: '激活', dataIndex: 'is_enable',
  28365. xtype: 'checkcolumn', menuDisabled: true,
  28366. },
  28367. {
  28368. text: '变量名', dataIndex: 'var_name',
  28369. menuDisabled: true, flex: 1,
  28370. editor: {
  28371. allowBlank: true,
  28372. selectOnFocus: false
  28373. }
  28374. },
  28375. ]
  28376. }
  28377. ]
  28378. });
  28379. }
  28380. //# sourceMappingURL=DictTree.js.map
  28381. var model$g = {
  28382. data: {
  28383. form: {
  28384. path: "",
  28385. requestBody: "",
  28386. responseBody: "",
  28387. }
  28388. }
  28389. };
  28390. var vjson$f = {
  28391. title: '接口信息',
  28392. layout: 'fit',
  28393. width: 800,
  28394. height: 500,
  28395. items: [
  28396. {
  28397. xtype: 'form',
  28398. layout: {
  28399. type: 'vbox',
  28400. pack: 'start',
  28401. align: 'stretch'
  28402. },
  28403. defaults: {
  28404. border: false,
  28405. anchor: '100%',
  28406. margin: '5',
  28407. },
  28408. items: [
  28409. {
  28410. xtype: 'textfield',
  28411. fieldLabel: '接口路径',
  28412. bind: {
  28413. value: "{form.path}",
  28414. },
  28415. },
  28416. {
  28417. xtype: 'textareafield',
  28418. // height: 150,
  28419. flex: 2,
  28420. fieldLabel: '请求数据',
  28421. bind: {
  28422. value: "{form.requestBody}",
  28423. },
  28424. },
  28425. {
  28426. xtype: 'textareafield',
  28427. // height: 150,
  28428. flex: 5,
  28429. fieldLabel: '响应数据',
  28430. bind: {
  28431. value: "{form.responseBody}",
  28432. },
  28433. },
  28434. ]
  28435. }
  28436. ]
  28437. };
  28438. var ApiInfoDialog = /** @class */ (function (_super) {
  28439. __extends(ApiInfoDialog, _super);
  28440. function ApiInfoDialog() {
  28441. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28442. }
  28443. return ApiInfoDialog;
  28444. }(Scope));
  28445. //# sourceMappingURL=apiInfoDialog.js.map
  28446. var model$h = {
  28447. data: {
  28448. query: {
  28449. role_id: '',
  28450. resource_id: '',
  28451. },
  28452. form: {},
  28453. form2: {
  28454. key: "",
  28455. start_at: "",
  28456. end_at: "",
  28457. }
  28458. }
  28459. };
  28460. var vjson$g = {
  28461. title: '接口信息',
  28462. layout: 'fit',
  28463. items: [
  28464. {
  28465. layout: 'border',
  28466. border: false,
  28467. items: [
  28468. {
  28469. region: 'center',
  28470. layout: 'border',
  28471. items: [
  28472. {
  28473. region: 'north',
  28474. bind: {
  28475. title: '{form.title}',
  28476. },
  28477. xtype: 'form',
  28478. scrollable: true,
  28479. layout: {
  28480. type: 'vbox',
  28481. pack: 'start',
  28482. align: 'stretch'
  28483. },
  28484. defaults: {
  28485. border: false,
  28486. anchor: '100%',
  28487. margin: '5',
  28488. },
  28489. tbar: {
  28490. xtype: 'toolbar',
  28491. items: [
  28492. {
  28493. xtype: 'button',
  28494. text: '查询',
  28495. iconCls: 'x-fa fa-search',
  28496. listeners: {
  28497. click: 'scope.requestLogs'
  28498. },
  28499. },
  28500. {
  28501. xtype: 'button',
  28502. text: '保存',
  28503. iconCls: 'x-fa fa-save',
  28504. listeners: {},
  28505. },
  28506. {
  28507. xtype: 'button',
  28508. text: '禁用',
  28509. iconCls: 'x-fa fa-stop-circle',
  28510. bind: {},
  28511. listeners: {},
  28512. },
  28513. {
  28514. xtype: 'button',
  28515. text: '启用',
  28516. iconCls: 'x-fa fa-play-circle',
  28517. bind: {},
  28518. listeners: {},
  28519. },
  28520. ],
  28521. },
  28522. items: [
  28523. {
  28524. xtype: 'cols',
  28525. defaults: { labelWidth: 120 },
  28526. items: [
  28527. {
  28528. xtype: 'textfield',
  28529. fieldLabel: 'URL',
  28530. bind: {
  28531. value: '{form.api_url}',
  28532. },
  28533. readOnly: true,
  28534. },
  28535. {
  28536. xtype: 'textfield',
  28537. fieldLabel: '名称',
  28538. bind: {
  28539. value: '{form.api_name}',
  28540. },
  28541. readOnly: true,
  28542. },
  28543. ],
  28544. },
  28545. {
  28546. xtype: 'cols',
  28547. defaults: { labelWidth: 120 },
  28548. items: [
  28549. {
  28550. xtype: 'textfield',
  28551. fieldLabel: '实现类',
  28552. bind: {
  28553. value: '{form.api_class}',
  28554. },
  28555. readOnly: true,
  28556. },
  28557. {
  28558. border: false,
  28559. flex: 1
  28560. },
  28561. ]
  28562. },
  28563. {
  28564. xtype: 'cols',
  28565. defaults: { labelWidth: 120 },
  28566. items: [
  28567. {
  28568. xtype: 'textfield',
  28569. fieldLabel: '超时时间',
  28570. bind: {
  28571. value: '{form.timeout}',
  28572. },
  28573. readOnly: true,
  28574. },
  28575. {
  28576. border: false,
  28577. flex: 1
  28578. },
  28579. ]
  28580. },
  28581. {
  28582. xtype: 'cols',
  28583. defaults: { labelWidth: 120 },
  28584. items: [
  28585. {
  28586. xtype: 'textfield',
  28587. fieldLabel: 'Remote IP',
  28588. bind: {
  28589. value: '{form.remote_ip}',
  28590. },
  28591. readOnly: true,
  28592. },
  28593. {
  28594. border: false,
  28595. flex: 1
  28596. },
  28597. ]
  28598. },
  28599. {
  28600. xtype: 'cols',
  28601. defaults: { labelWidth: 120 },
  28602. items: [
  28603. {
  28604. xtype: 'textfield',
  28605. fieldLabel: '解析表单',
  28606. bind: {
  28607. value: '{form.chandi}',
  28608. },
  28609. readOnly: true,
  28610. },
  28611. {
  28612. border: false,
  28613. flex: 1
  28614. },
  28615. ]
  28616. },
  28617. ],
  28618. },
  28619. {
  28620. region: 'center',
  28621. // title: 'Request',
  28622. layout: 'border',
  28623. items: [
  28624. {
  28625. region: 'north',
  28626. xtype: 'form',
  28627. reference: 'form2',
  28628. split: true,
  28629. items: [
  28630. {
  28631. xtype: 'cols',
  28632. width: 700,
  28633. items: [
  28634. {
  28635. xtype: 'textfield',
  28636. fieldLabel: '关键字',
  28637. bind: {
  28638. value: "{form2.key}"
  28639. },
  28640. },
  28641. {
  28642. xtype: 'datefield',
  28643. fieldLabel: '开始时间',
  28644. bind: {
  28645. value: "{form2.start_at}"
  28646. },
  28647. },
  28648. {
  28649. xtype: 'datefield',
  28650. fieldLabel: '结束时间',
  28651. bind: {
  28652. value: "{form2.end_at}"
  28653. },
  28654. },
  28655. ]
  28656. }
  28657. ]
  28658. },
  28659. {
  28660. region: 'center',
  28661. xtype: 'yvgrid',
  28662. layout: 'fit',
  28663. reference: 'grid1',
  28664. pagination: true,
  28665. autoLoad: false,
  28666. selModel: {
  28667. selType: 'rowmodel',
  28668. mode: 'SINGLE',
  28669. },
  28670. dataSource: {
  28671. method: 'invoke',
  28672. url: '/sys/api/Api@requestLogs',
  28673. params: {
  28674. formData: '{form2}',
  28675. path: '{form.api_url}',
  28676. },
  28677. },
  28678. listeners: {
  28679. rowdblclick: 'scope.showDialog',
  28680. },
  28681. columns: [
  28682. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28683. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28684. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28685. { dataIndex: "size", header: "大小", width: 80 },
  28686. { dataIndex: "path", header: "path", flex: 1 },
  28687. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28688. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28689. ]
  28690. }
  28691. ]
  28692. },
  28693. ],
  28694. },
  28695. ],
  28696. },
  28697. ],
  28698. referenceHolder: true,
  28699. };
  28700. var Api = /** @class */ (function (_super) {
  28701. __extends(Api, _super);
  28702. function Api() {
  28703. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28704. }
  28705. Api.prototype.onLoad = function () {
  28706. _super.prototype.onLoad.call(this);
  28707. this.requestLogs();
  28708. };
  28709. Api.prototype.selectList = function (sender, selected, eOpts) {
  28710. this.viewModel.set("form", selected.data);
  28711. if (selected.data.api_type === '1') {
  28712. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28713. }
  28714. else {
  28715. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28716. }
  28717. };
  28718. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28719. var sel = [];
  28720. _$2.forEach(records, function (item) {
  28721. if (item.data.flg === 'Y') {
  28722. sel.push(item);
  28723. }
  28724. });
  28725. this.refs.methodGrid.selModel.select(sel);
  28726. };
  28727. Api.prototype.saveAll = function () {
  28728. var _this = this;
  28729. var _a, _b, _c;
  28730. var role_id = this.viewModel.get("query.role_id");
  28731. if (!role_id) {
  28732. msg$1("请先选择一个角色");
  28733. return;
  28734. }
  28735. var wh_id = this.viewModel.get("form.wh_id");
  28736. if (!wh_id) {
  28737. msg$1("请先选择一个仓库");
  28738. return;
  28739. }
  28740. var menus = this.refs.theTree.getChecked();
  28741. var rowsMenus = [];
  28742. _$2.forEach(menus, function (m) {
  28743. if (m.data.resource_id) {
  28744. rowsMenus.push(m.data.resource_id);
  28745. }
  28746. });
  28747. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28748. 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; });
  28749. _$2.remove(mm, function (x) {
  28750. return methodsArry.includes(x.resource_id);
  28751. });
  28752. var rowsBtn = [];
  28753. _$2.forEach(mm, function (m) {
  28754. rowsBtn.push({ resource_id: m.resource_id });
  28755. });
  28756. this.setLoading(true);
  28757. invokeServer$1('/sys/role/Role@saveAll', {
  28758. wh_id: wh_id,
  28759. role_id: role_id,
  28760. rowsMenus: rowsMenus,
  28761. rowsBtn: rowsBtn,
  28762. }).then(function (res) {
  28763. msg$1(res.msg);
  28764. if (res.success) {
  28765. _this.reloadTree();
  28766. // this.viewModel.set('query.role_id', '')
  28767. _this.viewModel.set('query.resource_id', '');
  28768. _this.refs.methodGrid.reload();
  28769. }
  28770. }).finally(function () {
  28771. _this.setLoading(false);
  28772. });
  28773. };
  28774. Api.prototype.editRoleSuccess = function (sender, data) {
  28775. if (data.success) {
  28776. this.refs.roleGrid.reload();
  28777. this.viewModel.set("query.JIAOS_ID", "");
  28778. this.reloadTree();
  28779. this.viewModel.set("query.CAID_ID", "");
  28780. this.refs.methodGrid.reload();
  28781. }
  28782. };
  28783. Api.prototype.deleteRole = function (sender) {
  28784. var _this = this;
  28785. var role_id = this.viewModel.get("query.role_id");
  28786. if (!role_id) {
  28787. msg$1("请先选择一个角色");
  28788. return;
  28789. }
  28790. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28791. if (btn === 'yes') {
  28792. invokeServer$1('/sys/role/Role@deleteRole', {
  28793. role_id: role_id,
  28794. wh_id: window['whId']
  28795. }).then(function (res) {
  28796. msg$1(res.msg);
  28797. if (res.success) {
  28798. _this.refs.roleGrid.reload();
  28799. _this.viewModel.set("query.role_id", "");
  28800. _this.reloadTree();
  28801. _this.refs.methodGrid.reload();
  28802. }
  28803. });
  28804. }
  28805. });
  28806. };
  28807. Api.prototype.reloadTree = function () {
  28808. showErrorDialog$1('reloadTree 不存在');
  28809. };
  28810. Api.prototype.whChange = function (sender, value) {
  28811. this.viewModel.set("form.wh_id", value);
  28812. this.reloadTree();
  28813. this.refs.methodGrid.reload();
  28814. };
  28815. Api.prototype.requestLogs = function () {
  28816. var path = this.viewModel.get("form.api_url");
  28817. if (!path)
  28818. return;
  28819. this.refs.grid1.reload();
  28820. };
  28821. Api.prototype.showDialog = function (sender) {
  28822. var _a, _b;
  28823. 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; });
  28824. if (!rows || rows.length <= 0)
  28825. return;
  28826. var dialog = new ApiInfoDialog();
  28827. dialog.showDialog(null, {}, {
  28828. data: {
  28829. form: __assign({}, rows[0])
  28830. }
  28831. });
  28832. };
  28833. return Api;
  28834. }(Scope));
  28835. //# sourceMappingURL=ApiPage.js.map
  28836. var Controller = /** @class */ (function () {
  28837. function Controller() {
  28838. }
  28839. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28840. var _a, _b, _c, _d, _e, _f, _g, _h;
  28841. // @ts-ignore
  28842. 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; });
  28843. if (!rows || rows.length <= 0)
  28844. return;
  28845. var apiPage = new Api();
  28846. apiPage.showPage({
  28847. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28848. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28849. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28850. }, {
  28851. data: {
  28852. form: __assign({}, rows[0])
  28853. }
  28854. });
  28855. };
  28856. return Controller;
  28857. }());
  28858. var controller = new Controller();
  28859. function initApiTree () {
  28860. Ext.define('com.yvan.studio.ApiGrid', {
  28861. extend: 'Ext.Panel',
  28862. xtype: 'apigrid',
  28863. controller: controller,
  28864. scope: controller,
  28865. referenceHolder: true,
  28866. layout: 'fit',
  28867. items: [
  28868. {
  28869. width: 400,
  28870. split: true,
  28871. xtype: 'yvgrid',
  28872. reference: 'roleGrid',
  28873. border: false,
  28874. pagination: false,
  28875. autoLoad: true,
  28876. remoteFilter: false,
  28877. selModel: {
  28878. selType: 'rowmodel',
  28879. mode: 'SINGLE',
  28880. },
  28881. tbar: {
  28882. xtype: 'toolbar',
  28883. items: [
  28884. {
  28885. xtype: 'button',
  28886. text: '新增',
  28887. iconCls: 'x-fa fa-plus-circle',
  28888. listeners: {},
  28889. },
  28890. {
  28891. xtype: 'button',
  28892. text: '删除',
  28893. iconCls: 'x-fa fa-trash',
  28894. bind: {
  28895. disabled: '{roleGrid.selection==null}',
  28896. },
  28897. listeners: {},
  28898. },
  28899. ],
  28900. },
  28901. dataSource: {
  28902. url: '/sys/api/Api@getApiList',
  28903. method: 'invoke',
  28904. params: {},
  28905. },
  28906. listeners: {
  28907. itemdblclick: "selectList",
  28908. },
  28909. columns: [
  28910. {
  28911. dataIndex: 'api_name',
  28912. header: '接口名称',
  28913. filter: { type: 'string' },
  28914. flex: 1,
  28915. },
  28916. ],
  28917. },
  28918. ]
  28919. });
  28920. }
  28921. //# sourceMappingURL=ApiTree.js.map
  28922. var model$i = {
  28923. data: {
  28924. iframeSrc: ''
  28925. }
  28926. };
  28927. var vjson$h = {
  28928. layout: 'fit',
  28929. border: false,
  28930. iconCls: 'x-fa fa-newspaper-o',
  28931. referenceHolder: true,
  28932. items: [
  28933. {
  28934. // title: 'view.design',
  28935. xtype: 'uxiframe',
  28936. layout: 'fit',
  28937. // cls: 'module_page_iframe',
  28938. reference: 'iframe',
  28939. listeners: {
  28940. afterrender: 'scope.iframeRender'
  28941. }
  28942. },
  28943. ]
  28944. };
  28945. var Iframe = /** @class */ (function (_super) {
  28946. __extends(Iframe, _super);
  28947. function Iframe(path) {
  28948. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28949. _this.path = "";
  28950. _this.path = path;
  28951. return _this;
  28952. }
  28953. Iframe.prototype.iframeRender = function (sender) {
  28954. var $dom = $(sender.el.dom).find('iframe');
  28955. var iframe = $dom[0];
  28956. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28957. iframe.onload = function () {
  28958. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28959. };
  28960. };
  28961. return Iframe;
  28962. }(Scope));
  28963. //# sourceMappingURL=Iframe.js.map
  28964. var Controller$1 = /** @class */ (function () {
  28965. function Controller() {
  28966. }
  28967. Controller.prototype.onDblClick = function (sender, record) {
  28968. var data = record.raw;
  28969. if (data.text === "运行报表") {
  28970. this.openIframe("/xxl-job/index", "运行报表");
  28971. }
  28972. else if (data.text === "任务管理") {
  28973. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28974. }
  28975. else if (data.text === "调度日志") {
  28976. this.openIframe("/xxl-job/joblog", "调度日志");
  28977. }
  28978. else if (data.text === "执行器管理") {
  28979. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28980. }
  28981. };
  28982. Controller.prototype.openIframe = function (path, title) {
  28983. var page = new Iframe(path);
  28984. page.showPage({
  28985. title: title,
  28986. id: 'xxljob__' + path.replaceAll("/", "_"),
  28987. path: 'xxljob__' + path.replaceAll("/", "_"),
  28988. }, {});
  28989. };
  28990. Controller.prototype.onLoad = function () {
  28991. var me = this;
  28992. me.getView().setRootNode({
  28993. expanded: true,
  28994. leaf: false,
  28995. children: [
  28996. { leaf: true, text: '运行报表' },
  28997. { leaf: true, text: '任务管理' },
  28998. { leaf: true, text: '调度日志' },
  28999. { leaf: true, text: '执行器管理' },
  29000. ]
  29001. });
  29002. };
  29003. return Controller;
  29004. }());
  29005. var controller$1 = new Controller$1();
  29006. function initTaskTree () {
  29007. Ext.define('com.yvan.studio.TaskTree', {
  29008. extend: 'Ext.tree.Panel',
  29009. xtype: 'tasktree',
  29010. controller: controller$1,
  29011. scope: controller$1,
  29012. reference: 'roleGrid',
  29013. tooltip: '表单定义',
  29014. iconCls: 'x-fa fa-bar-chart',
  29015. useArrows: true,
  29016. rootVisible: false,
  29017. colspan: 2,
  29018. lines: true,
  29019. multiSelect: false,
  29020. referenceHolder: true,
  29021. // openNode() {
  29022. // const selection = this.getSelection()
  29023. // const [record] = selection
  29024. // if (!record) {
  29025. // return
  29026. // }
  29027. //
  29028. // const {raw} = record;
  29029. // if (raw.type === 'Dir') {
  29030. // return
  29031. // }
  29032. // if (raw.type === "Module" && raw.module) {
  29033. // // eventBus.publish(EventType.ModuleOpen, raw)
  29034. // }
  29035. // },
  29036. listeners: {
  29037. itemdblclick: 'onDblClick',
  29038. afterrender: "onLoad",
  29039. },
  29040. });
  29041. }
  29042. //# sourceMappingURL=TaskTree.js.map
  29043. var model$j = {
  29044. data: {
  29045. form: {
  29046. address: "",
  29047. level: "",
  29048. logger: "",
  29049. message: "",
  29050. nodeName: "",
  29051. serverName: "",
  29052. thread: "",
  29053. whId: "",
  29054. userId: "",
  29055. }
  29056. }
  29057. };
  29058. var vjson$i = {
  29059. title: '接口信息',
  29060. layout: 'fit',
  29061. width: 800,
  29062. height: 600,
  29063. items: [
  29064. {
  29065. xtype: 'form',
  29066. layout: {
  29067. type: 'vbox',
  29068. pack: 'start',
  29069. align: 'stretch'
  29070. },
  29071. defaults: {
  29072. border: false,
  29073. anchor: '100%',
  29074. margin: '5',
  29075. },
  29076. items: [
  29077. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  29078. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  29079. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  29080. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  29081. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  29082. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  29083. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  29084. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  29085. {
  29086. xtype: 'textareafield',
  29087. flex: 5,
  29088. fieldLabel: '响应数据',
  29089. bind: {
  29090. value: "{form.message}",
  29091. },
  29092. },
  29093. ]
  29094. }
  29095. ]
  29096. };
  29097. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  29098. __extends(ApiInfoDialog, _super);
  29099. function ApiInfoDialog() {
  29100. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  29101. }
  29102. return ApiInfoDialog;
  29103. }(Scope));
  29104. //# sourceMappingURL=LogPageDialog.js.map
  29105. var model$k = {
  29106. data: {
  29107. form2: {}
  29108. }
  29109. };
  29110. var vjson$j = {
  29111. title: '日志查询',
  29112. layout: 'fit',
  29113. width: "70%",
  29114. height: "80%",
  29115. items: [
  29116. {
  29117. region: 'center',
  29118. xtype: 'yvgrid',
  29119. layout: 'fit',
  29120. reference: 'grid1',
  29121. pagination: false,
  29122. autoLoad: false,
  29123. selModel: {
  29124. selType: 'rowmodel',
  29125. mode: 'SINGLE',
  29126. },
  29127. dataSource: {
  29128. method: 'invoke',
  29129. url: '/sys/api/Api@aroundLogs',
  29130. params: {
  29131. formData: '{form2}',
  29132. },
  29133. },
  29134. listeners: {
  29135. rowdblclick: 'scope.showDialog2',
  29136. },
  29137. columns: [
  29138. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29139. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29140. { dataIndex: "thread", header: "thread", width: 150 },
  29141. { dataIndex: "message", header: "message", flex: 1 },
  29142. ]
  29143. }
  29144. ]
  29145. };
  29146. var AroundLog = /** @class */ (function (_super) {
  29147. __extends(AroundLog, _super);
  29148. function AroundLog() {
  29149. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29150. }
  29151. AroundLog.prototype.onLoad = function () {
  29152. _super.prototype.onLoad.call(this);
  29153. this.queryLog();
  29154. };
  29155. AroundLog.prototype.queryLog = function () {
  29156. this.refs.grid1.reload();
  29157. };
  29158. AroundLog.prototype.showDialog2 = function () {
  29159. var _a, _b;
  29160. 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; });
  29161. if (!rows || rows.length <= 0)
  29162. return;
  29163. var dialog = new ApiInfoDialog$1();
  29164. dialog.showDialog(null, {}, {
  29165. data: {
  29166. form: __assign({}, rows[0])
  29167. }
  29168. });
  29169. };
  29170. return AroundLog;
  29171. }(Scope));
  29172. //# sourceMappingURL=AroundLog.js.map
  29173. var model$l = {
  29174. data: {
  29175. form2: {
  29176. key: "",
  29177. start_at: "",
  29178. end_at: "",
  29179. }
  29180. }
  29181. };
  29182. var vjson$k = {
  29183. title: '日志查询',
  29184. layout: 'fit',
  29185. tbar: {
  29186. xtype: 'toolbar',
  29187. items: [
  29188. {
  29189. xtype: 'button',
  29190. text: '刷新',
  29191. listeners: {
  29192. click: 'scope.queryLog'
  29193. },
  29194. },
  29195. {
  29196. xtype: 'button',
  29197. text: '周围日志',
  29198. bind: {},
  29199. listeners: {
  29200. click: 'scope.aroundLogs'
  29201. },
  29202. },
  29203. ],
  29204. },
  29205. items: [
  29206. {
  29207. region: 'center',
  29208. xtype: 'yvgrid',
  29209. layout: 'fit',
  29210. reference: 'grid1',
  29211. pagination: true,
  29212. autoLoad: false,
  29213. selModel: {
  29214. selType: 'rowmodel',
  29215. mode: 'SINGLE',
  29216. },
  29217. dataSource: {
  29218. method: 'invoke',
  29219. url: '/sys/api/Api@queryLog',
  29220. params: {
  29221. formData: '{form2}',
  29222. path: '{form.api_url}',
  29223. },
  29224. },
  29225. listeners: {
  29226. rowdblclick: 'scope.showDialog',
  29227. },
  29228. columns: [
  29229. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29230. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29231. { dataIndex: "thread", header: "thread", width: 150 },
  29232. { dataIndex: "message", header: "message", flex: 1 },
  29233. ]
  29234. }
  29235. ]
  29236. };
  29237. var LogPage = /** @class */ (function (_super) {
  29238. __extends(LogPage, _super);
  29239. function LogPage() {
  29240. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29241. }
  29242. LogPage.prototype.onLoad = function () {
  29243. _super.prototype.onLoad.call(this);
  29244. this.queryLog();
  29245. };
  29246. LogPage.prototype.queryLog = function () {
  29247. this.refs.grid1.reload();
  29248. };
  29249. LogPage.prototype.showDialog = function () {
  29250. var _a, _b;
  29251. 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; });
  29252. if (!rows || rows.length <= 0)
  29253. return;
  29254. var dialog = new ApiInfoDialog$1();
  29255. dialog.showDialog(null, {}, {
  29256. data: {
  29257. form: __assign({}, rows[0])
  29258. }
  29259. });
  29260. };
  29261. LogPage.prototype.aroundLogs = function () {
  29262. var _a, _b;
  29263. var rows = (_b = (_a = this.refs.grid1.selModel.selected) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.map(function (r) { return r.data; });
  29264. if (!rows || rows.length <= 0)
  29265. return;
  29266. var dialog = new AroundLog();
  29267. dialog.showDialog(null, {}, {
  29268. data: {
  29269. form2: __assign({}, rows[0])
  29270. }
  29271. });
  29272. };
  29273. return LogPage;
  29274. }(Scope));
  29275. //# sourceMappingURL=LogPage.js.map
  29276. var Controller$2 = /** @class */ (function () {
  29277. function Controller() {
  29278. }
  29279. Controller.prototype.queryLog = function () {
  29280. var form2 = this.getViewModel().get("form2");
  29281. var logPage = new LogPage();
  29282. logPage.showPage({}, {
  29283. data: {
  29284. form2: __assign({}, form2)
  29285. }
  29286. });
  29287. };
  29288. return Controller;
  29289. }());
  29290. var controller$2 = new Controller$2();
  29291. function initLogsTree () {
  29292. Ext.define('com.yvan.studio.LogsTree', {
  29293. extend: 'Ext.panel.Panel',
  29294. xtype: 'logstree',
  29295. controller: controller$2,
  29296. scope: controller$2,
  29297. viewModel: {
  29298. data: {
  29299. form2: {
  29300. key: "",
  29301. start_at: "",
  29302. end_at: "",
  29303. }
  29304. }
  29305. },
  29306. reference: 'logstree',
  29307. tooltip: '表单定义',
  29308. iconCls: 'x-fa fa-bar-chart',
  29309. useArrows: true,
  29310. rootVisible: false,
  29311. colspan: 2,
  29312. lines: true,
  29313. multiSelect: false,
  29314. referenceHolder: true,
  29315. items: [
  29316. {
  29317. region: 'north',
  29318. xtype: 'form',
  29319. reference: 'form2',
  29320. split: true,
  29321. items: [
  29322. {
  29323. xtype: 'textfield',
  29324. fieldLabel: '关键字',
  29325. bind: {
  29326. value: "{form2.key}"
  29327. },
  29328. },
  29329. {
  29330. xtype: 'datefield',
  29331. fieldLabel: '开始时间',
  29332. bind: {
  29333. value: "{form2.start_at}"
  29334. },
  29335. },
  29336. {
  29337. xtype: 'datefield',
  29338. fieldLabel: '结束时间',
  29339. bind: {
  29340. value: "{form2.end_at}"
  29341. },
  29342. },
  29343. ]
  29344. },
  29345. {
  29346. xtype: "cols",
  29347. items: [
  29348. {
  29349. xtype: "box",
  29350. },
  29351. {
  29352. xtype: "button",
  29353. text: '查询',
  29354. listeners: {
  29355. click: 'queryLog'
  29356. },
  29357. },
  29358. {
  29359. xtype: "box",
  29360. },
  29361. ]
  29362. },
  29363. ],
  29364. });
  29365. }
  29366. //# sourceMappingURL=LogsTree.js.map
  29367. var model$m = {
  29368. data: {
  29369. // opsId: "",
  29370. // name: "",
  29371. running: false,
  29372. }
  29373. };
  29374. //# sourceMappingURL=DevOpsTerminal.model.js.map
  29375. var vjson$l = {
  29376. bind: {
  29377. title: '运维-{name}',
  29378. },
  29379. layout: 'fit',
  29380. items: [
  29381. {
  29382. layout: 'border',
  29383. items: [
  29384. {
  29385. region: 'north',
  29386. items: [
  29387. {
  29388. xtype: 'toolbar',
  29389. border: false,
  29390. items: [
  29391. {
  29392. xtype: 'button',
  29393. text: '执行',
  29394. iconCls: 'x-fa fa-play',
  29395. bind: {
  29396. hidden: "{running}",
  29397. },
  29398. listeners: {
  29399. click: 'scope.start'
  29400. }
  29401. },
  29402. {
  29403. xtype: 'button',
  29404. text: '停止',
  29405. iconCls: 'x-fa fa-stop',
  29406. bind: {
  29407. hidden: "{!running}",
  29408. },
  29409. listeners: {
  29410. click: 'scope.stop'
  29411. }
  29412. },
  29413. ],
  29414. },
  29415. ]
  29416. },
  29417. {
  29418. region: 'center',
  29419. reference: 'terminal',
  29420. xtype: 'terminal',
  29421. },
  29422. ],
  29423. },
  29424. ],
  29425. };
  29426. //# sourceMappingURL=DevOpsTerminal.view.js.map
  29427. var DevOpsTerminal = /** @class */ (function (_super) {
  29428. __extends(DevOpsTerminal, _super);
  29429. function DevOpsTerminal() {
  29430. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29431. _this.websocket = undefined;
  29432. return _this;
  29433. }
  29434. DevOpsTerminal.prototype.onLoad = function () {
  29435. this.load();
  29436. };
  29437. DevOpsTerminal.prototype.onDestroy = function () {
  29438. if (this.websocket) {
  29439. this.websocket.close();
  29440. this.websocket = undefined;
  29441. }
  29442. };
  29443. DevOpsTerminal.prototype.load = function () {
  29444. var _this = this;
  29445. var opsId = this.viewModel.get('opsId');
  29446. this.setLoading(true);
  29447. devOpsById(opsId).then(function (res) {
  29448. _this.viewModel.set('devOps', res.data);
  29449. }).finally(function () {
  29450. _this.setLoading(false);
  29451. });
  29452. };
  29453. DevOpsTerminal.prototype.start = function () {
  29454. var me = this;
  29455. var running = this.viewModel.get('running');
  29456. var devOps = this.viewModel.get('devOps');
  29457. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29458. return;
  29459. var devopsServer = "ws://122.9.140.63:9999";
  29460. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29461. this.websocket.addEventListener('open', function () {
  29462. me.viewModel.set('running', true);
  29463. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29464. });
  29465. this.websocket.addEventListener('message', function (event) {
  29466. me.refs.terminal.write(event.data);
  29467. });
  29468. this.websocket.addEventListener('close', function () {
  29469. me.stop();
  29470. });
  29471. this.websocket.addEventListener('error', function () {
  29472. me.stop();
  29473. });
  29474. };
  29475. DevOpsTerminal.prototype.stop = function () {
  29476. if (this.websocket) {
  29477. this.websocket.close();
  29478. this.websocket = undefined;
  29479. }
  29480. this.viewModel.set('running', false);
  29481. };
  29482. return DevOpsTerminal;
  29483. }(Scope));
  29484. //# sourceMappingURL=DevOpsTerminal.js.map
  29485. var Controller$3 = /** @class */ (function () {
  29486. function Controller() {
  29487. }
  29488. Controller.prototype.onLoad = function (sender) {
  29489. this.reload();
  29490. };
  29491. Controller.prototype.reload = function () {
  29492. var me = this;
  29493. // @ts-ignore
  29494. var view = me.getView();
  29495. view.setLoading(true);
  29496. devOpsList().then(function (res) {
  29497. view.setStore(new Ext.data.Store({
  29498. fields: ['ops_id', 'host', 'name'],
  29499. data: res.data,
  29500. }));
  29501. }).finally(function () {
  29502. view.setLoading(false);
  29503. });
  29504. };
  29505. Controller.prototype.onDblClick = function (sender) {
  29506. this.devOpsTerminal();
  29507. };
  29508. Controller.prototype.devOpsTerminal = function () {
  29509. // @ts-ignore
  29510. var view = this.getView();
  29511. var _a = __read(view.getSelection(), 1), record = _a[0];
  29512. if (record) {
  29513. var name = record.get('name');
  29514. var opsId = record.get('ops_id');
  29515. var instance = new DevOpsTerminal();
  29516. instance.showPage({
  29517. id: 'ops_' + opsId,
  29518. path: 'ops_' + opsId,
  29519. }, {
  29520. data: {
  29521. opsId: opsId,
  29522. name: name,
  29523. }
  29524. });
  29525. instance.dialogSuccess = function () {
  29526. };
  29527. }
  29528. };
  29529. return Controller;
  29530. }());
  29531. var controller$3 = new Controller$3();
  29532. function initDevOpsTree () {
  29533. Ext.define('com.yvan.studio.DevOpsGrid', {
  29534. extend: 'Ext.grid.Panel',
  29535. xtype: 'devopsgrid',
  29536. controller: controller$3,
  29537. scope: controller$3,
  29538. referenceHolder: true,
  29539. tooltip: '运维',
  29540. iconCls: 'x-fa fa-terminal',
  29541. useArrows: true,
  29542. reference: 'devopsgrid',
  29543. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29544. listeners: {
  29545. afterrender: 'onLoad',
  29546. itemdblclick: 'onDblClick',
  29547. },
  29548. viewConfig: {
  29549. // listeners: {
  29550. // itemcontextmenu: 'onGridContextMenu',
  29551. // },
  29552. },
  29553. tbar: {
  29554. xtype: 'toolbar',
  29555. items: [
  29556. {
  29557. xtype: 'button',
  29558. tooltip: '刷新',
  29559. iconCls: 'x-fa fa-refresh',
  29560. listeners: {
  29561. click: 'reload'
  29562. }
  29563. },
  29564. {
  29565. xtype: 'textfield',
  29566. flex: 1,
  29567. emptyText: '搜索过滤',
  29568. enableKeyEvents: true,
  29569. listeners: {
  29570. change: {
  29571. fn: 'filterChanged',
  29572. buffer: 50
  29573. }
  29574. }
  29575. },
  29576. ]
  29577. },
  29578. columns: [
  29579. {
  29580. text: 'ID', dataIndex: 'report_id',
  29581. hidden: true,
  29582. },
  29583. {
  29584. text: '服务器',
  29585. dataIndex: 'host',
  29586. width: 100,
  29587. menuDisabled: true,
  29588. },
  29589. {
  29590. text: '操作名称',
  29591. dataIndex: 'name',
  29592. flex: 1,
  29593. menuDisabled: true,
  29594. },
  29595. ]
  29596. });
  29597. }
  29598. //# sourceMappingURL=DevOpsTree.js.map
  29599. function initTerminal () {
  29600. Ext.define('com.yvan.studio.Terminal', {
  29601. extend: 'Ext.panel.Panel',
  29602. alias: 'widget.terminal',
  29603. xtype: 'terminal',
  29604. layout: 'fit',
  29605. border: false,
  29606. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29607. config: {},
  29608. write: function (str) {
  29609. if (this.term) {
  29610. this.term.write(str);
  29611. }
  29612. },
  29613. initComponent: function () {
  29614. var that = this;
  29615. this.superclass.initComponent.call(this, arguments);
  29616. that.on({
  29617. resize: function () {
  29618. var _a;
  29619. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29620. that.fitAddon.fit();
  29621. }
  29622. },
  29623. destory: function () {
  29624. if (that.term) {
  29625. that.term.dispose();
  29626. delete that.term;
  29627. }
  29628. if (that.fitAddon) {
  29629. that.fitAddon.dispose();
  29630. delete that.fitAddon;
  29631. }
  29632. },
  29633. afterrender: function (sender) {
  29634. _.defer(function () {
  29635. var $dom = $(that.el.dom).find('.terminal');
  29636. that.term = new xterm.Terminal({
  29637. // cursorBlink: false,
  29638. // cursorStyle: 'bar', // block underline bar
  29639. // enableBold: false,
  29640. // bellStyle: "sound",
  29641. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29642. // scrollback: 10000,
  29643. // tabStopWidth: 4,
  29644. disableStdin: true,
  29645. theme: {
  29646. // foreground: "#111",
  29647. // background: "#fdfdfd",
  29648. // background: "#fafafa",
  29649. },
  29650. });
  29651. that.fitAddon = new xtermAddonFit.FitAddon();
  29652. that.term.loadAddon(that.fitAddon);
  29653. that.term.open($dom[0]);
  29654. that.fitAddon.fit();
  29655. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29656. });
  29657. }
  29658. });
  29659. }
  29660. });
  29661. }
  29662. //# sourceMappingURL=Terminal.js.map
  29663. var vjson$m = {
  29664. title: '接口统计',
  29665. layout: 'fit',
  29666. items: [
  29667. {
  29668. title: '接口统计',
  29669. xtype: 'yvgrid',
  29670. enableLocking: false,
  29671. reference: 'grid1',
  29672. pagination: false,
  29673. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29674. tbar: {
  29675. xtype: 'form',
  29676. items: [
  29677. {
  29678. xtype: 'cols',
  29679. items: [
  29680. {
  29681. xtype: 'textfield',
  29682. fieldLabel: '搜索',
  29683. listeners: {
  29684. change: 'scope.requestFilterChange'
  29685. }
  29686. },
  29687. ]
  29688. },
  29689. ]
  29690. },
  29691. columns: [
  29692. { text: '地址', dataIndex: 'url', flex: 1 },
  29693. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29694. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29695. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29696. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29697. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29698. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29699. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29700. ],
  29701. leadingBufferZone: 8,
  29702. trailingBufferZone: 8,
  29703. viewConfig: {
  29704. listeners: {
  29705. expandbody: 'scope.onChildExpand'
  29706. }
  29707. },
  29708. listeners: {
  29709. itemdblclick: 'scope.itemClick1'
  29710. },
  29711. plugins: {
  29712. rowwidget: {
  29713. widget: {
  29714. xtype: 'yvgrid',
  29715. hideFootbar: true,
  29716. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29717. listeners: {
  29718. itemdblclick: 'scope.itemClick1'
  29719. },
  29720. columns: [
  29721. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29722. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29723. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29724. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29725. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29726. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29727. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29728. ]
  29729. }
  29730. }
  29731. }
  29732. },
  29733. ]
  29734. };
  29735. //# sourceMappingURL=InterfaceStatistics.view.js.map
  29736. var model$n = {
  29737. data: {
  29738. count: 0,
  29739. dataSourceName: '',
  29740. sql: "",
  29741. histogram: '',
  29742. maxCost: 0,
  29743. minCost: 0,
  29744. avgCost: '',
  29745. sumCost: 0,
  29746. histogramInfos: [
  29747. // count: 1
  29748. // gteCost: 20
  29749. // ltCost: 50
  29750. // 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"
  29751. // topN: [
  29752. // cost: 24
  29753. // occurrenceTime: "1648004895171"
  29754. // 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"
  29755. // ]
  29756. ]
  29757. }
  29758. };
  29759. //# sourceMappingURL=PerformDialog.model.js.map
  29760. var vjson$n = {
  29761. title: '性能统计详情',
  29762. height: 400,
  29763. width: 800,
  29764. modal: true,
  29765. layout: 'fit',
  29766. items: [
  29767. {
  29768. xtype: 'tabpanel',
  29769. items: [
  29770. {
  29771. title: '摘要',
  29772. key: "1",
  29773. layout: 'border',
  29774. items: [
  29775. {
  29776. region: 'north',
  29777. border: false,
  29778. defaults: {
  29779. margin: '8 0 0 0'
  29780. },
  29781. items: [
  29782. {
  29783. xtype: 'cols',
  29784. defaultType: 'displayfield',
  29785. defaults: {
  29786. labelWidth: 70,
  29787. },
  29788. items: [
  29789. {
  29790. fieldLabel: 'count',
  29791. bind: {
  29792. value: '{count}'
  29793. }
  29794. },
  29795. {
  29796. fieldLabel: 'maxCost',
  29797. bind: {
  29798. value: '{maxCost}'
  29799. }
  29800. },
  29801. {
  29802. fieldLabel: 'minCost',
  29803. bind: {
  29804. value: '{minCost}'
  29805. }
  29806. },
  29807. {
  29808. fieldLabel: 'avgCost',
  29809. bind: {
  29810. value: '{avgCost}'
  29811. }
  29812. },
  29813. {
  29814. fieldLabel: 'sumCost',
  29815. bind: {
  29816. value: '{sumCost}'
  29817. }
  29818. },
  29819. ]
  29820. },
  29821. {
  29822. xtype: 'cols',
  29823. items: [
  29824. {
  29825. flex: 5,
  29826. border: false,
  29827. items: [
  29828. {
  29829. xtype: 'segmentedbutton',
  29830. reference: 'histogram',
  29831. allowToggle: false,
  29832. border: false,
  29833. items: []
  29834. }
  29835. ]
  29836. },
  29837. ]
  29838. },
  29839. ],
  29840. },
  29841. {
  29842. region: 'center',
  29843. xtype: 'sqleditor',
  29844. reference: 'sqlEditor',
  29845. },
  29846. ]
  29847. },
  29848. {
  29849. title: '直方图',
  29850. key: "2",
  29851. }
  29852. ]
  29853. }
  29854. ]
  29855. };
  29856. //# sourceMappingURL=PerformDialog.view.js.map
  29857. var PerformDialog = /** @class */ (function (_super) {
  29858. __extends(PerformDialog, _super);
  29859. function PerformDialog() {
  29860. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29861. }
  29862. PerformDialog.prototype.onLoad = function () {
  29863. var _this = this;
  29864. var sql = this.viewModel.get('sql');
  29865. var sql2 = sqlFormat.format(sql, {
  29866. indent: ' ',
  29867. uppercase: true,
  29868. });
  29869. var histogramInfos = this.viewModel.get('histogramInfos');
  29870. var vs = _$2.map(histogramInfos, function (v) {
  29871. if (v.ltCost > 2100000000) {
  29872. return {
  29873. text: "[" + v.gteCost + ", \u221E):" + v.count
  29874. };
  29875. }
  29876. return {
  29877. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29878. };
  29879. });
  29880. this.refs.sqlEditor.setCode(sql2);
  29881. _$2.forEach(vs, function (v) {
  29882. _this.refs.histogram.add(v);
  29883. });
  29884. };
  29885. return PerformDialog;
  29886. }(Scope));
  29887. //# sourceMappingURL=PerformDialog.js.map
  29888. var model$o = {
  29889. data: {}
  29890. };
  29891. var PerformStats = /** @class */ (function (_super) {
  29892. __extends(PerformStats, _super);
  29893. function PerformStats() {
  29894. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29895. _this.requestFilterChange = _.debounce(function (sender, value) {
  29896. var store = _this.refs.grid1.store;
  29897. store.clearFilter();
  29898. if (value) {
  29899. store.filterBy(function (record, id) {
  29900. var text = toString(record.get('url'));
  29901. // 用拼音筛选的方式
  29902. return text.includes(value);
  29903. });
  29904. }
  29905. }, 100);
  29906. return _this;
  29907. }
  29908. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29909. widget.setData(record.data.children);
  29910. };
  29911. PerformStats.prototype.itemClick1 = function (sender, record) {
  29912. console.log('itemClick1', record.data);
  29913. new PerformDialog().showDialog(sender, {}, {
  29914. data: record.data
  29915. });
  29916. };
  29917. PerformStats.prototype.onLoad = function () {
  29918. var _this = this;
  29919. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29920. .then(function (_a) {
  29921. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29922. var resData = reqRes.data;
  29923. var jdbcData = jdbcRes.data;
  29924. _.forEach(jdbcData, function (item) {
  29925. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29926. });
  29927. _.forEach(resData, function (item) {
  29928. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29929. if (_.isArray(item.sqls)) {
  29930. item.children = _.map(item.sqls, function (sql) {
  29931. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29932. }).filter(function (v) { return !!v; });
  29933. }
  29934. item.jdbcCount = _.size(item.children);
  29935. });
  29936. _this.refs.grid1.setData(resData);
  29937. // this.refs.grid2.setData(jdbcData)
  29938. });
  29939. };
  29940. return PerformStats;
  29941. }(Scope));
  29942. //# sourceMappingURL=InterfaceStatistics.js.map
  29943. var vjson$o = {
  29944. title: '性能统计',
  29945. layout: 'fit',
  29946. items: [
  29947. {
  29948. title: '数据库统计',
  29949. xtype: 'yvgrid',
  29950. enableLocking: false,
  29951. reference: 'grid2',
  29952. pagination: false,
  29953. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29954. tbar: {
  29955. xtype: 'form',
  29956. items: [
  29957. {
  29958. xtype: 'cols',
  29959. items: [
  29960. {
  29961. fieldLabel: '搜索',
  29962. listeners: {
  29963. change: 'scope.jdbcFilterChange'
  29964. }
  29965. },
  29966. ]
  29967. },
  29968. ]
  29969. },
  29970. listeners: {
  29971. itemdblclick: 'scope.itemClick1'
  29972. },
  29973. columns: [
  29974. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29975. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29976. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29977. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29978. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29979. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29980. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29981. ]
  29982. },
  29983. ]
  29984. };
  29985. //# sourceMappingURL=DatabaseStatistics.view.js.map
  29986. var model$p = {
  29987. data: {}
  29988. };
  29989. var PerformStats$1 = /** @class */ (function (_super) {
  29990. __extends(PerformStats, _super);
  29991. function PerformStats() {
  29992. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  29993. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  29994. var store = _this.refs.grid2.store;
  29995. store.clearFilter();
  29996. if (value) {
  29997. store.filterBy(function (record, id) {
  29998. var text = toString(record.get('sql'));
  29999. // 用拼音筛选的方式
  30000. return text.includes(value);
  30001. });
  30002. }
  30003. }, 100);
  30004. return _this;
  30005. }
  30006. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  30007. widget.setData(record.data.children);
  30008. };
  30009. PerformStats.prototype.itemClick1 = function (sender, record) {
  30010. console.log('itemClick1', record.data);
  30011. new PerformDialog().showDialog(sender, {}, {
  30012. data: record.data
  30013. });
  30014. };
  30015. PerformStats.prototype.onLoad = function () {
  30016. var _this = this;
  30017. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  30018. .then(function (_a) {
  30019. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  30020. var resData = reqRes.data;
  30021. var jdbcData = jdbcRes.data;
  30022. _.forEach(jdbcData, function (item) {
  30023. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30024. });
  30025. _.forEach(resData, function (item) {
  30026. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30027. if (_.isArray(item.sqls)) {
  30028. item.children = _.map(item.sqls, function (sql) {
  30029. return _.find(jdbcData, function (r) { return r.sql === sql; });
  30030. }).filter(function (v) { return !!v; });
  30031. }
  30032. item.jdbcCount = _.size(item.children);
  30033. });
  30034. _this.refs.grid2.setData(jdbcData);
  30035. });
  30036. };
  30037. return PerformStats;
  30038. }(Scope));
  30039. //# sourceMappingURL=DatabaseStatistics.js.map
  30040. var Controller$4 = /** @class */ (function () {
  30041. function Controller() {
  30042. }
  30043. Controller.prototype.onDblClick = function (sender, record) {
  30044. var data = record.raw;
  30045. if (data.text === "接口统计") {
  30046. var page = new PerformStats();
  30047. page.showPage({
  30048. title: "接口统计",
  30049. id: '_InterfaceStatistics',
  30050. path: '_InterfaceStatistics',
  30051. }, {});
  30052. }
  30053. else if (data.text === "数据库统计") {
  30054. var page = new PerformStats$1();
  30055. page.showPage({
  30056. title: "数据库统计",
  30057. id: '_DatabaseStatistics',
  30058. path: '_DatabaseStatistics',
  30059. }, {});
  30060. }
  30061. };
  30062. Controller.prototype.onLoad = function () {
  30063. var me = this;
  30064. //@ts-ignore
  30065. var view = me.getView();
  30066. view.setRootNode({
  30067. expanded: true,
  30068. leaf: false,
  30069. children: [
  30070. { leaf: true, text: '接口统计' },
  30071. { leaf: true, text: '数据库统计' },
  30072. ]
  30073. });
  30074. };
  30075. return Controller;
  30076. }());
  30077. var controller$4 = new Controller$4();
  30078. function initMonitorTree () {
  30079. Ext.define('com.yvan.studio.MonitorTree', {
  30080. extend: 'Ext.tree.Panel',
  30081. xtype: 'monitortree',
  30082. controller: controller$4,
  30083. scope: controller$4,
  30084. reference: 'roleGrid',
  30085. tooltip: '表单定义',
  30086. iconCls: 'x-fa fa-bar-chart',
  30087. useArrows: true,
  30088. rootVisible: false,
  30089. colspan: 2,
  30090. lines: true,
  30091. multiSelect: false,
  30092. referenceHolder: true,
  30093. // openNode() {
  30094. // const selection = this.getSelection()
  30095. // const [record] = selection
  30096. // if (!record) {
  30097. // return
  30098. // }
  30099. //
  30100. // const {raw} = record;
  30101. // if (raw.type === 'Dir') {
  30102. // return
  30103. // }
  30104. // if (raw.type === "Module" && raw.module) {
  30105. // // eventBus.publish(EventType.ModuleOpen, raw)
  30106. // }
  30107. // },
  30108. listeners: {
  30109. itemdblclick: 'onDblClick',
  30110. afterrender: "onLoad",
  30111. },
  30112. });
  30113. }
  30114. //# sourceMappingURL=MonitorTree.js.map
  30115. var Controller$5 = /** @class */ (function () {
  30116. function Controller() {
  30117. }
  30118. return Controller;
  30119. }());
  30120. var controller$5 = new Controller$5();
  30121. function initHomeTree () {
  30122. Ext.define('com.yvan.studio.HomeTree', {
  30123. extend: 'Ext.Panel',
  30124. xtype: 'hometree',
  30125. controller: controller$5,
  30126. scope: controller$5,
  30127. referenceHolder: true,
  30128. bodyCls: 'home',
  30129. // layout: 'fit',
  30130. tbar: {
  30131. xtype: 'toolbar',
  30132. items: [
  30133. {
  30134. xtype: 'button',
  30135. iconCls: 'x-fa fa-exchange',
  30136. text: '数据结构同步',
  30137. handler: function (sender) {
  30138. handles$1.mainWindow.showDataSync(sender);
  30139. }
  30140. },
  30141. {
  30142. xtype: 'button',
  30143. iconCls: 'x-fa fa-cubes',
  30144. text: '数据域管理',
  30145. handler: function (sender) {
  30146. handles$1.mainWindow.showColumnDomain();
  30147. }
  30148. },
  30149. ],
  30150. },
  30151. // items: [
  30152. //
  30153. // ],
  30154. layout: {
  30155. type: 'vbox',
  30156. pack: 'start',
  30157. align: 'stretch',
  30158. },
  30159. items: [
  30160. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30161. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30162. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30163. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30164. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30165. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30166. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30167. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30168. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30169. ],
  30170. });
  30171. }
  30172. //# sourceMappingURL=HomeTree.js.map
  30173. var WidgetStore = /** @class */ (function (_super) {
  30174. __extends(WidgetStore, _super);
  30175. function WidgetStore() {
  30176. return _super !== null && _super.apply(this, arguments) || this;
  30177. }
  30178. WidgetStore.prototype.getCacheKey = function (param) {
  30179. return "widget_data.json";
  30180. };
  30181. /*invokeApi(param: any): Promise<any> {
  30182. return new Promise<any>(resolve => {
  30183. //@ts-ignore
  30184. require(["../../widget/all"], function (res) {
  30185. const widgetList = res.default
  30186. resolve(widgetList)
  30187. })
  30188. })
  30189. }*/
  30190. WidgetStore.prototype.invokeApi = function (param) {
  30191. return widgetListApi(param);
  30192. };
  30193. return WidgetStore;
  30194. }(CacheStore));
  30195. var instance$3 = new WidgetStore();
  30196. //# sourceMappingURL=WidgetStore.js.map
  30197. var WidgetGridController = /** @class */ (function () {
  30198. function WidgetGridController() {
  30199. }
  30200. WidgetGridController.prototype.onLoad = function (sender) {
  30201. var me = this;
  30202. setWidget(me);
  30203. instance$3.registe(me.reloadData.bind(this));
  30204. instance$3.reloadIfNeed(undefined);
  30205. };
  30206. WidgetGridController.prototype.widgetAdd = function (sender) {
  30207. var me = this;
  30208. var win = new Ext.Window({
  30209. autoDestroy: true,
  30210. title: "新建弹框",
  30211. width: 400,
  30212. height: 220,
  30213. resizable: true,
  30214. closable: true,
  30215. maximizable: true,
  30216. minimizable: true,
  30217. plain: true,
  30218. // constrainHeader: true,
  30219. constrain: true,
  30220. layout: 'fit',
  30221. animateTarget: sender,
  30222. buttonAlign: 'center',
  30223. items: [
  30224. {
  30225. xtype: "form",
  30226. layout: "hbox",
  30227. margin: '10px 20px',
  30228. border: 0,
  30229. items: [
  30230. {
  30231. flex: 1,
  30232. layout: 'vbox',
  30233. items: [
  30234. {
  30235. xtype: "textfield",
  30236. name: "widgetcode",
  30237. fieldLabel: "弹窗文件",
  30238. flex: 1,
  30239. allowBlank: false,
  30240. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30241. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30242. labelWidth: 80,
  30243. width: "100%",
  30244. },
  30245. {
  30246. xtype: "textfield",
  30247. name: "widgetname",
  30248. fieldLabel: "弹窗名称",
  30249. flex: 1,
  30250. allowBlank: false,
  30251. labelWidth: 80,
  30252. width: "100%",
  30253. },
  30254. ]
  30255. },
  30256. ]
  30257. }
  30258. ],
  30259. //窗口按钮
  30260. buttons: [
  30261. {
  30262. xtype: 'button', text: '保存', handler: function (btn) {
  30263. //窗口获取表单
  30264. var form = win.down('form');
  30265. var vaildSuccess = form.isValid();
  30266. if (!vaildSuccess) {
  30267. return;
  30268. }
  30269. var title = form.down('textfield[name="widgetname"]').getValue();
  30270. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30271. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30272. if (res.success) {
  30273. msg$1('添加成功');
  30274. // 添加
  30275. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30276. me.reload();
  30277. });
  30278. win.close();
  30279. }
  30280. });
  30281. }
  30282. },
  30283. {
  30284. xtype: 'button', text: '取消', handler: function (btn) {
  30285. //窗口关闭
  30286. win.close();
  30287. }
  30288. }
  30289. ]
  30290. });
  30291. win.show();
  30292. };
  30293. WidgetGridController.prototype.widgetRemove = function (sender) {
  30294. var _this = this;
  30295. //@ts-ignore
  30296. var record = this.getView().selection.data;
  30297. if (!record) {
  30298. msg$1('请选择一行');
  30299. return;
  30300. }
  30301. var widgetPath = record.widget_path;
  30302. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30303. if (btn === 'yes') {
  30304. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30305. if (res.success) {
  30306. msg$1(res.msg);
  30307. _this.reload();
  30308. }
  30309. });
  30310. }
  30311. });
  30312. };
  30313. WidgetGridController.prototype.widgetEdit = function (record) {
  30314. var _this = this;
  30315. if (record) {
  30316. var widgetPath = record.widget_path;
  30317. var widgetName = record.widget_name;
  30318. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30319. _this.reload();
  30320. });
  30321. }
  30322. };
  30323. WidgetGridController.prototype.onDestory = function (sender) {
  30324. var me = this;
  30325. setWidget(undefined);
  30326. instance$3.unregiste(me.reloadData.bind(this));
  30327. };
  30328. WidgetGridController.prototype.reloadData = function (res) {
  30329. var me = this;
  30330. //@ts-ignore
  30331. var view = me.getView();
  30332. if (typeof res === 'object') {
  30333. // const data = []
  30334. // _.forOwn(res, (v, k) => {
  30335. // data.push({
  30336. // widget_path: k,
  30337. // widget_name: v.title,
  30338. // vjson : v
  30339. // })
  30340. // })
  30341. view.setStore(new Ext.data.Store({
  30342. fields: ['widget_path', 'widget_name'],
  30343. data: res.data,
  30344. }));
  30345. }
  30346. else if (typeof res === 'boolean') {
  30347. view.setLoading(res);
  30348. }
  30349. };
  30350. WidgetGridController.prototype.reload = function () {
  30351. instance$3.reloadForce(undefined);
  30352. };
  30353. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30354. //@ts-ignore
  30355. this.view.store.clearFilter();
  30356. if (value) {
  30357. //@ts-ignore
  30358. this.view.store.filterBy(function (record) {
  30359. var widget_path = record.get('widget_path');
  30360. var widget_name = record.get('widget_name');
  30361. return (window['system'].pinyinMatch(widget_name, value) ||
  30362. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30363. });
  30364. }
  30365. };
  30366. WidgetGridController.prototype.onClearClick = function () {
  30367. var _a, _b;
  30368. //@ts-ignore
  30369. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30370. };
  30371. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30372. this.widgetEdit(record.data);
  30373. };
  30374. return WidgetGridController;
  30375. }());
  30376. //# sourceMappingURL=WidgetGridController.js.map
  30377. function initWidget () {
  30378. var controller = new WidgetGridController();
  30379. Ext.define('com.yvan.studio.WidgetGrid', {
  30380. extend: 'Ext.grid.Panel',
  30381. xtype: 'widgetgrid',
  30382. controller: controller,
  30383. scope: controller,
  30384. referenceHolder: true,
  30385. tooltip: '检索窗口',
  30386. iconCls: 'x-fa fa-search',
  30387. useArrows: true,
  30388. reference: 'widgetgrid',
  30389. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30390. listeners: {
  30391. itemdblclick: 'onDblClick',
  30392. afterrender: 'onLoad',
  30393. destory: 'onDestory',
  30394. },
  30395. viewConfig: {
  30396. listeners: {
  30397. itemcontextmenu: 'onGridContextMenu',
  30398. },
  30399. },
  30400. tbar: [
  30401. {
  30402. xtype: 'button',
  30403. tooltip: '刷新',
  30404. iconCls: 'x-fa fa-refresh',
  30405. listeners: {
  30406. click: 'reload'
  30407. }
  30408. },
  30409. {
  30410. xtype: 'button',
  30411. tooltip: '添加',
  30412. iconCls: 'x-fa fa-plus-circle',
  30413. listeners: {
  30414. click: 'widgetAdd'
  30415. }
  30416. },
  30417. {
  30418. xtype: 'button',
  30419. tooltip: '删除',
  30420. iconCls: 'x-fa fa-minus-circle',
  30421. listeners: {
  30422. click: 'widgetRemove'
  30423. }
  30424. },
  30425. ],
  30426. fbar: [
  30427. {
  30428. xtype: 'textfield',
  30429. flex: 1,
  30430. reference: "txtFilter",
  30431. emptyText: '搜索过滤',
  30432. enableKeyEvents: true,
  30433. listeners: {
  30434. change: {
  30435. fn: 'filterChanged',
  30436. buffer: 50
  30437. }
  30438. }
  30439. },
  30440. ],
  30441. columns: [
  30442. {
  30443. text: '弹窗文件', dataIndex: 'widget_path',
  30444. menuDisabled: true, flex: 1,
  30445. },
  30446. {
  30447. text: '弹窗名称', dataIndex: 'widget_name',
  30448. menuDisabled: true, flex: 1,
  30449. },
  30450. ]
  30451. });
  30452. }
  30453. //# sourceMappingURL=WidgetGrid.js.map
  30454. var WhLayoutController = /** @class */ (function () {
  30455. function WhLayoutController() {
  30456. }
  30457. WhLayoutController.prototype.onLoad = function (sender) {
  30458. var _this = this;
  30459. var me = this;
  30460. setWhLayout(me);
  30461. _$2.defer(function () {
  30462. _this.reload();
  30463. });
  30464. };
  30465. WhLayoutController.prototype.reload = function () {
  30466. //@ts-ignore
  30467. var view = this.getView();
  30468. view.setLoading(true);
  30469. loadWhLayoutAll().then(function (res) {
  30470. view.setStore(new Ext.data.Store({
  30471. fields: ['layout_code', 'layout_name'],
  30472. data: res.data,
  30473. }));
  30474. }).finally(function () {
  30475. view.setLoading(false);
  30476. });
  30477. };
  30478. WhLayoutController.prototype.add = function () {
  30479. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30480. };
  30481. WhLayoutController.prototype.edit = function (data) {
  30482. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30483. };
  30484. WhLayoutController.prototype.remove = function () {
  30485. var _this = this;
  30486. var _a;
  30487. //@ts-ignore
  30488. var view = this.getView();
  30489. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30490. if (!record) {
  30491. msg$1('请选择一行数据');
  30492. return;
  30493. }
  30494. var layoutCode = record.layout_code;
  30495. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30496. if (btn === 'yes') {
  30497. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30498. if (res.success) {
  30499. msg$1(res.msg);
  30500. _this.reload();
  30501. }
  30502. });
  30503. }
  30504. });
  30505. };
  30506. WhLayoutController.prototype.onDblClick = function () {
  30507. var _a;
  30508. //@ts-ignore
  30509. var view = this.getView();
  30510. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30511. if (!record) {
  30512. msg$1('请选择一行数据');
  30513. return;
  30514. }
  30515. this.edit(record);
  30516. };
  30517. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30518. //@ts-ignore
  30519. this.view.store.clearFilter();
  30520. if (value) {
  30521. //@ts-ignore
  30522. this.view.store.filterBy(function (record) {
  30523. var widget_path = record.get('widget_path');
  30524. var widget_name = record.get('widget_name');
  30525. return (window['system'].pinyinMatch(widget_name, value) ||
  30526. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30527. });
  30528. }
  30529. };
  30530. WhLayoutController.prototype.onClearClick = function () {
  30531. var _a, _b;
  30532. //@ts-ignore
  30533. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30534. };
  30535. return WhLayoutController;
  30536. }());
  30537. //# sourceMappingURL=WhLayoutController.js.map
  30538. function initWhLayout () {
  30539. var controller = new WhLayoutController();
  30540. Ext.define('com.yvan.studio.WhLayout', {
  30541. extend: 'Ext.grid.Panel',
  30542. xtype: 'whlayout',
  30543. alias: 'widget.whlayout',
  30544. controller: controller,
  30545. scope: controller,
  30546. referenceHolder: true,
  30547. tooltip: '检索窗口',
  30548. iconCls: 'x-fa fa-search',
  30549. useArrows: true,
  30550. reference: 'whlayout',
  30551. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30552. listeners: {
  30553. itemdblclick: 'onDblClick',
  30554. afterrender: 'onLoad',
  30555. destory: 'onDestory',
  30556. },
  30557. viewConfig: {
  30558. listeners: {
  30559. itemcontextmenu: 'onGridContextMenu',
  30560. },
  30561. },
  30562. tbar: [
  30563. {
  30564. xtype: 'button',
  30565. tooltip: '刷新',
  30566. iconCls: 'x-fa fa-refresh',
  30567. listeners: {
  30568. click: 'reload'
  30569. }
  30570. },
  30571. {
  30572. xtype: 'button',
  30573. tooltip: '添加',
  30574. iconCls: 'x-fa fa-plus-circle',
  30575. listeners: {
  30576. click: 'add'
  30577. }
  30578. },
  30579. {
  30580. xtype: 'button',
  30581. tooltip: '删除',
  30582. iconCls: 'x-fa fa-minus-circle',
  30583. listeners: {
  30584. click: 'remove'
  30585. }
  30586. },
  30587. ],
  30588. fbar: [
  30589. {
  30590. xtype: 'textfield',
  30591. flex: 1,
  30592. reference: "txtFilter",
  30593. emptyText: '搜索过滤',
  30594. enableKeyEvents: true,
  30595. listeners: {
  30596. change: {
  30597. fn: 'filterChanged',
  30598. buffer: 50
  30599. }
  30600. }
  30601. },
  30602. ],
  30603. columns: [
  30604. {
  30605. text: '图编号', dataIndex: 'layout_code',
  30606. menuDisabled: true, flex: 1,
  30607. },
  30608. {
  30609. text: '图名称', dataIndex: 'layout_name',
  30610. menuDisabled: true, flex: 1,
  30611. },
  30612. ]
  30613. });
  30614. }
  30615. //# sourceMappingURL=WhLayout.js.map
  30616. var BpmnTreeController = /** @class */ (function () {
  30617. function BpmnTreeController() {
  30618. }
  30619. BpmnTreeController.prototype.onLoad = function (sender) {
  30620. this.reload();
  30621. };
  30622. BpmnTreeController.prototype.reload = function () {
  30623. var me = this;
  30624. me.getView().setLoading(true);
  30625. exporerList().then(function (res) {
  30626. // handles.mainWindow.modules = res.data
  30627. // const rootNode = modulesToTreeData(res.data)
  30628. var rootNode = res.data.tree;
  30629. me.getView().setRootNode({
  30630. expanded: true,
  30631. leaf: false,
  30632. children: rootNode
  30633. });
  30634. // const lastId = window.location.hash.substring(1);
  30635. // file.selectPath(lastId)
  30636. // if (lastId) {
  30637. // const node = getModuleById(rootNode, lastId)
  30638. // if (node) {
  30639. // showDesign(node.id, node.path, node.text, node.module)
  30640. // }
  30641. // }
  30642. // this.restoreState()
  30643. }).finally(function () {
  30644. me.getView().setLoading(false);
  30645. });
  30646. };
  30647. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30648. var _this = this;
  30649. e.preventDefault();
  30650. var raw = node.raw;
  30651. //const me = sender.up("treepanel").scope
  30652. var option;
  30653. if (raw.exporerType === 1) ;
  30654. else if (raw.exporerType === 21) {
  30655. if (raw.type === 'Dir') {
  30656. option = {
  30657. shadow: 'frame', allowOtherMenus: true,
  30658. items: [
  30659. {
  30660. text: '添加',
  30661. iconCls: 'x-fa fa-plus-circle',
  30662. handler: function (sender) {
  30663. var dirPath = raw.dirPath;
  30664. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30665. }
  30666. },
  30667. '-',
  30668. {
  30669. text: '新建文件夹',
  30670. iconCls: 'x-fa fa-folder-o',
  30671. handler: function (sender) {
  30672. }
  30673. }
  30674. ]
  30675. };
  30676. }
  30677. else if (raw.type === 'Model') {
  30678. option = {
  30679. shadow: 'frame', allowOtherMenus: true,
  30680. items: [
  30681. {
  30682. text: '编辑',
  30683. iconCls: 'x-fa fa-edit',
  30684. handler: function (sender) {
  30685. }
  30686. },
  30687. {
  30688. text: '删除',
  30689. iconCls: 'x-fa fa-minus-circle',
  30690. handler: function (sender) {
  30691. }
  30692. },
  30693. '-',
  30694. {
  30695. text: '注册(至菜单)',
  30696. iconCls: 'x-fa fa-sign-in',
  30697. handler: function (sender) {
  30698. }
  30699. },
  30700. {
  30701. text: '新建文件夹',
  30702. iconCls: 'x-fa fa-folder-o',
  30703. handler: function (sender) {
  30704. }
  30705. }
  30706. ]
  30707. };
  30708. }
  30709. }
  30710. else if (raw.exporerType === 22) {
  30711. if (raw.type === 'Dir') {
  30712. option = {
  30713. shadow: 'frame', allowOtherMenus: true,
  30714. items: [
  30715. {
  30716. text: '添加',
  30717. iconCls: 'x-fa fa-plus-circle',
  30718. handler: function (sender) {
  30719. var dirPath = raw.dirPath;
  30720. handles$1.mainWindow.showFormBill();
  30721. }
  30722. },
  30723. '-',
  30724. {
  30725. text: '新建文件夹',
  30726. iconCls: 'x-fa fa-folder-o',
  30727. handler: function (sender) {
  30728. }
  30729. }
  30730. ]
  30731. };
  30732. }
  30733. else if (raw.type === 'Model') {
  30734. option = {
  30735. shadow: 'frame', allowOtherMenus: true,
  30736. items: [
  30737. {
  30738. text: '编辑',
  30739. iconCls: 'x-fa fa-edit',
  30740. handler: function (sender) {
  30741. }
  30742. },
  30743. {
  30744. text: '删除',
  30745. iconCls: 'x-fa fa-minus-circle',
  30746. handler: function (sender) {
  30747. }
  30748. },
  30749. '-',
  30750. {
  30751. text: '注册(至菜单)',
  30752. iconCls: 'x-fa fa-sign-in',
  30753. handler: function (sender) {
  30754. }
  30755. },
  30756. {
  30757. text: '新建文件夹',
  30758. iconCls: 'x-fa fa-folder-o',
  30759. handler: function (sender) {
  30760. }
  30761. }
  30762. ]
  30763. };
  30764. }
  30765. }
  30766. else if (raw.exporerType === 3) ;
  30767. else if (raw.exporerType === 50) {
  30768. option = {
  30769. shadow: 'frame', allowOtherMenus: true,
  30770. items: [
  30771. {
  30772. text: '新建流程',
  30773. iconCls: 'x-fa fa-new',
  30774. handler: function (sender) {
  30775. _this.bpmnAdd(sender);
  30776. }
  30777. },
  30778. ]
  30779. };
  30780. }
  30781. else if (raw.exporerType === 51) {
  30782. option = {
  30783. shadow: 'frame', allowOtherMenus: true,
  30784. items: [
  30785. {
  30786. text: '新建流程',
  30787. iconCls: 'x-fa fa-new',
  30788. handler: function (sender) {
  30789. _this.bpmnAdd(sender);
  30790. }
  30791. },
  30792. {
  30793. text: '删除',
  30794. iconCls: 'x-fa fa-minus-circle',
  30795. handler: function (sender) {
  30796. _this.bpmnDelete(sender, raw);
  30797. }
  30798. },
  30799. ]
  30800. };
  30801. }
  30802. else {
  30803. throw Error('暂时不支持!');
  30804. }
  30805. if (option) {
  30806. var treeMenu = new Ext.menu.Menu(option);
  30807. treeMenu.showAt(e.getXY());
  30808. }
  30809. };
  30810. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30811. var _this = this;
  30812. prompt$2('输入工作流名称').then(function (name) {
  30813. createBpmn("", name).then(function (res) {
  30814. if (res.success) {
  30815. msg$1('添加成功');
  30816. }
  30817. _this.reload();
  30818. });
  30819. });
  30820. };
  30821. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30822. var _this = this;
  30823. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30824. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30825. if (res.success) {
  30826. msg$1('添加成功');
  30827. }
  30828. _this.reload();
  30829. });
  30830. });
  30831. };
  30832. BpmnTreeController.prototype.reportAdd = function (sender) {
  30833. var _this = this;
  30834. prompt$2('请输入报表名称').then(function (name) {
  30835. createReportApi(name).then(function (res) {
  30836. if (res.success) {
  30837. msg$1('添加成功');
  30838. handles$1.mainWindow.showReport(res.data, name, function () {
  30839. _this.reload();
  30840. });
  30841. }
  30842. _this.reload();
  30843. });
  30844. });
  30845. };
  30846. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30847. if (record) {
  30848. var reportName = record.get('report_name');
  30849. var reportId = record.get('report_id');
  30850. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30851. }
  30852. };
  30853. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30854. var _this = this;
  30855. if (record) {
  30856. var reportName = record.get('report_name');
  30857. var reportId_1 = record.get('report_id');
  30858. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30859. delReportApi(reportId_1).then(function (res) {
  30860. if (res.success) {
  30861. msg$1('删除成功');
  30862. _this.reload();
  30863. }
  30864. });
  30865. });
  30866. }
  30867. };
  30868. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30869. var _this = this;
  30870. if (!record || record.type !== 'Module') {
  30871. return;
  30872. }
  30873. var reportName = record.text;
  30874. var reportId = record.target;
  30875. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30876. _this.reload();
  30877. });
  30878. };
  30879. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30880. var data = record.raw;
  30881. if (data.type !== 'Module' && data.type !== 'Dir') {
  30882. return;
  30883. }
  30884. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30885. if (data.exporerType === 10) { // 表单
  30886. // this.reportEdit(sender, data)
  30887. handles$1.mainWindow.showReport();
  30888. }
  30889. else if (data.exporerType === 21) {
  30890. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30891. }
  30892. else if (data.exporerType === 22) {
  30893. handles$1.mainWindow.showFormBill();
  30894. }
  30895. else if (data.exporerType === 30) {
  30896. handles$1.mainWindow.showWidgetDesign();
  30897. }
  30898. else if (data.exporerType === 51) {
  30899. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30900. }
  30901. else {
  30902. throw Error('暂时不支持!');
  30903. }
  30904. };
  30905. return BpmnTreeController;
  30906. }());
  30907. var controller$6 = new BpmnTreeController();
  30908. function initBpmnTree () {
  30909. Ext.define('com.yvan.studio.BpmnTree', {
  30910. extend: 'Ext.tree.Panel',
  30911. //extend: 'com.yvan.studio.StateTree',
  30912. xtype: 'bpmntree',
  30913. controller: controller$6,
  30914. scope: controller$6,
  30915. tooltip: '表单定义',
  30916. iconCls: 'x-fa fa-random',
  30917. useArrows: true,
  30918. rootVisible: false,
  30919. colspan: 2,
  30920. lines: true,
  30921. multiSelect: true,
  30922. reload: function () {
  30923. this.controller.reload.call(this, arguments);
  30924. },
  30925. openNode: function () {
  30926. var selection = this.getSelection();
  30927. var _a = __read(selection, 1), record = _a[0];
  30928. if (!record) {
  30929. return;
  30930. }
  30931. var raw = record.raw;
  30932. if (raw.type === 'Dir') {
  30933. return;
  30934. }
  30935. if (raw.type === "Module" && raw.module) ;
  30936. },
  30937. listeners: {
  30938. itemdblclick: 'onDblClick',
  30939. afterrender: 'onLoad',
  30940. // itemverify() {
  30941. // this.openNode()
  30942. // },
  30943. itemcontextmenu: 'onLisenContextMenu'
  30944. },
  30945. tbar: {
  30946. xtype: 'toolbar',
  30947. items: [
  30948. {
  30949. xtype: 'button',
  30950. tooltip: '刷新',
  30951. iconCls: 'x-fa fa-refresh',
  30952. listeners: {
  30953. click: 'reload'
  30954. }
  30955. },
  30956. /*{
  30957. xtype: 'button',
  30958. tooltip: '添加',
  30959. iconCls: 'x-fa fa-plus-circle',
  30960. menu: [
  30961. {
  30962. text: '类别',
  30963. listeners: {
  30964. click: 'classAdd'
  30965. }
  30966. },
  30967. {
  30968. text: '查询',
  30969. listeners: {
  30970. click: 'reportAdd'
  30971. }
  30972. },
  30973. '-',
  30974. {
  30975. text: '单表定义',
  30976. listeners: {
  30977. click: 'singleTableAdd'
  30978. }
  30979. },
  30980. {
  30981. text: '多表定义',
  30982. listeners: {
  30983. click: 'complexTableAdd'
  30984. }
  30985. },
  30986. {
  30987. text: '查询窗口定义',
  30988. listeners: {
  30989. click: 'widgetAdd'
  30990. }
  30991. },
  30992. ],
  30993. },
  30994. {
  30995. xtype: 'button',
  30996. tooltip: '删除',
  30997. iconCls: 'x-fa fa-minus-circle',
  30998. listeners: {
  30999. click: 'reportRemove'
  31000. }
  31001. },*/
  31002. {
  31003. xtype: 'textfield',
  31004. flex: 1,
  31005. reference: "txtFilter",
  31006. emptyText: '搜索过滤',
  31007. enableKeyEvents: true,
  31008. listeners: {
  31009. change: {
  31010. fn: 'filterChanged',
  31011. buffer: 50
  31012. }
  31013. }
  31014. },
  31015. ]
  31016. },
  31017. });
  31018. }
  31019. //# sourceMappingURL=BpmnTree.js.map
  31020. function initToolBox () {
  31021. Ext.define('com.yvan.studio.ToolBox', {
  31022. extend: 'Ext.panel.Panel',
  31023. xtype: 'toolbox',
  31024. tooltip: '工具箱',
  31025. layout: 'fit',
  31026. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  31027. border: false,
  31028. beforeRender: function () {
  31029. console.log('beforeRender', this);
  31030. },
  31031. afterRender: function () {
  31032. var $dom = $(this.body.dom).children('div');
  31033. $dom.append(createComponent());
  31034. $dom.css("height", '100%');
  31035. // @ts-ignore
  31036. $('#_toolbox_list').find('li').each(function () {
  31037. var id = $(this).children(':first').attr('drag_id');
  31038. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  31039. setDrag(this, node);
  31040. });
  31041. }
  31042. });
  31043. }
  31044. function setDrag(el, node) {
  31045. new Ext.drag.Source({
  31046. element: el,
  31047. proxy: {
  31048. type: 'placeholder',
  31049. getElement: function (info) {
  31050. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  31051. return Ext.getBody().createChild({
  31052. html: html
  31053. });
  31054. }
  31055. },
  31056. listeners: {
  31057. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  31058. dragend: delegateDragend.bind(getDesignInstance(), node),
  31059. },
  31060. sourceVjson: node.code,
  31061. dragType: node.dragType
  31062. });
  31063. }
  31064. function createComponent() {
  31065. var template = [];
  31066. for (var i = 0; i < codeLines.length; i++) {
  31067. var item = codeLines[i];
  31068. if (!item.dragHtml) {
  31069. continue;
  31070. }
  31071. var $ele = $("<li>" + item.dragHtml + "</li>");
  31072. $ele.children(':first').attr('drag_id', item.id);
  31073. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  31074. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  31075. }
  31076. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  31077. return html;
  31078. }
  31079. var codeLines = [
  31080. {
  31081. id: '$label',
  31082. value: layoutOrXtypeNameMap.label + ' - label',
  31083. icon: "fa fa-font",
  31084. dragType: "col-item",
  31085. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31086. code: {
  31087. xtype: 'label',
  31088. text: '文本' + _$2.uniqueId('_l')
  31089. }
  31090. },
  31091. {
  31092. id: '$text',
  31093. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  31094. icon: "fa fa-edit",
  31095. dragType: "col-item",
  31096. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31097. code: {
  31098. xtype: 'textfield',
  31099. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31100. }
  31101. },
  31102. {
  31103. id: '$textarea',
  31104. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  31105. icon: "fa fa-edit",
  31106. dragType: "col-item",
  31107. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31108. code: {
  31109. xtype: 'textareafield',
  31110. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31111. }
  31112. },
  31113. {
  31114. id: '$number',
  31115. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  31116. icon: "fa fa-edit",
  31117. dragType: "col-item",
  31118. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31119. code: {
  31120. xtype: 'numberfield',
  31121. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31122. }
  31123. },
  31124. {
  31125. id: '$combo',
  31126. value: layoutOrXtypeNameMap.combo + ' - combo',
  31127. icon: "fa fa-angle-double-down",
  31128. dragType: "col-item",
  31129. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31130. code: {
  31131. xtype: 'combo',
  31132. fieldLabel: '请选择',
  31133. data: [
  31134. { id: 'id1', text: '选项1' },
  31135. { id: 'id2', text: '选项2' },
  31136. { id: 'id3', text: '选项3' },
  31137. ],
  31138. }
  31139. },
  31140. {
  31141. id: '$datebox',
  31142. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31143. icon: "fa fa-calendar",
  31144. dragType: "col-item",
  31145. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31146. code: {
  31147. xtype: "datefield",
  31148. fieldLabel: '日期',
  31149. }
  31150. },
  31151. {
  31152. id: '$searchbox',
  31153. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31154. icon: "fa fa-search",
  31155. dragType: "col-item",
  31156. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31157. code: {
  31158. xtype: 'searchfield',
  31159. fieldLabel: '搜索框',
  31160. }
  31161. },
  31162. {
  31163. id: '$combogrid',
  31164. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31165. icon: "fa fa-table",
  31166. dragType: "col-item",
  31167. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31168. code: {
  31169. xtype: 'combogrid',
  31170. fieldLabel: '下拉表'
  31171. }
  31172. },
  31173. {
  31174. id: '$combotree',
  31175. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31176. icon: "fa fa-tree",
  31177. dragType: "col-item",
  31178. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31179. code: {
  31180. xtype: 'combotree',
  31181. fieldLabel: '下拉树',
  31182. displayField: 'text',
  31183. rootVisible: false
  31184. }
  31185. },
  31186. {
  31187. id: '$button',
  31188. value: layoutOrXtypeNameMap.button + ' - button',
  31189. icon: 'fa fa-sign-in',
  31190. dragType: "col-item",
  31191. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31192. code: {
  31193. text: '按钮',
  31194. iconCls: 'x-fa fa-bars',
  31195. xtype: 'button'
  31196. }
  31197. },
  31198. {
  31199. id: '$checkbox',
  31200. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31201. icon: 'fa fa-check-square',
  31202. dragType: "col-item",
  31203. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31204. code: {
  31205. xtype: 'checkbox',
  31206. boxLabel: '勾选框',
  31207. hideLabel: true,
  31208. margin: '0 0 0 15',
  31209. flex: 0,
  31210. }
  31211. },
  31212. {
  31213. id: '$checkboxgroup',
  31214. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31215. icon: 'fa fa-check-square',
  31216. dragType: "col-item",
  31217. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31218. code: {
  31219. xtype: 'checkboxgroup',
  31220. fieldLabel: '勾选组',
  31221. items: [
  31222. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31223. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31224. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31225. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31226. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31227. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31228. ]
  31229. }
  31230. },
  31231. {
  31232. id: '$radio',
  31233. value: layoutOrXtypeNameMap.radio + ' - radio',
  31234. icon: 'fa fa-dot-circle-o',
  31235. dragType: "col-item",
  31236. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31237. code: {
  31238. xtype: "radio",
  31239. fieldLabel: "请选择",
  31240. }
  31241. },
  31242. {
  31243. id: '$radiogroup',
  31244. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31245. icon: 'fa fa-dot-circle-o',
  31246. dragType: "col-item",
  31247. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31248. code: {
  31249. xtype: "radiogroup",
  31250. fieldLabel: "请选择",
  31251. items: [
  31252. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31253. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31254. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31255. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31256. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31257. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31258. ]
  31259. }
  31260. },
  31261. {
  31262. id: '$cols',
  31263. value: layoutOrXtypeNameMap.cols + ' - cols',
  31264. icon: 'fa fa-list-alt',
  31265. dragType: "cols-container",
  31266. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31267. code: {
  31268. xtype: 'cols',
  31269. items: [
  31270. {
  31271. xtype: 'textfield',
  31272. fieldLabel: '输入框',
  31273. },
  31274. ],
  31275. }
  31276. },
  31277. {
  31278. id: '$container',
  31279. value: layoutOrXtypeNameMap.container + ' - container',
  31280. icon: 'fa fa-flag',
  31281. dragType: "col-item",
  31282. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31283. code: {
  31284. xtype: 'container',
  31285. border: false,
  31286. layout: 'hbox',
  31287. }
  31288. },
  31289. {
  31290. id: '$fit',
  31291. value: layoutOrXtypeNameMap.fit + ' - fit',
  31292. icon: 'fa fa-flag',
  31293. dragType: "rows-container",
  31294. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31295. code: {
  31296. border: false,
  31297. layout: 'fit',
  31298. items: [
  31299. {
  31300. xtype: 'container',
  31301. border: false,
  31302. layout: 'hbox',
  31303. }
  31304. ]
  31305. }
  31306. },
  31307. ];
  31308. // @ts-ignore
  31309. // export default ToolBoxCmp
  31310. //# sourceMappingURL=ToolBox.js.map
  31311. var that = undefined;
  31312. function initPropertyDesign () {
  31313. Ext.define('com.yvan.studio.PropertyDesign', {
  31314. extend: 'Ext.panel.Panel',
  31315. xtype: 'propertydesign',
  31316. name: "PropertyDesign",
  31317. tooltip: '属性',
  31318. iconCls: 'x-fa fa-newspaper-o',
  31319. reference: 'propertygrid',
  31320. layout: 'border',
  31321. border: false,
  31322. moduleId: null,
  31323. currentComponentVJson: null,
  31324. currentComponentPropertyEditSource: null,
  31325. vjson: null,
  31326. propertyHandle: null,
  31327. moduleSubscribe: null,
  31328. items: [
  31329. new Ext.grid.property.Grid({
  31330. sortableColumns: false,
  31331. region: 'center',
  31332. listeners: {
  31333. propertychange: function (source, propName, value, oldValue, eOpts) {
  31334. value = _.trim(value);
  31335. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31336. return item.label === propName;
  31337. });
  31338. if (a.type === 'listeners') {
  31339. if (value) {
  31340. if (that.currentComponentVJson.listeners) {
  31341. that.currentComponentVJson.listeners[propName] = value;
  31342. }
  31343. else {
  31344. var t = {};
  31345. t[propName] = value;
  31346. that.currentComponentVJson.listeners = t;
  31347. }
  31348. }
  31349. else {
  31350. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31351. if (!value1) {
  31352. delete that.currentComponentVJson.listeners[key];
  31353. }
  31354. else if (key === propName) {
  31355. delete that.currentComponentVJson.listeners[key];
  31356. }
  31357. });
  31358. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31359. delete that.currentComponentVJson.listeners;
  31360. }
  31361. }
  31362. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31363. vjson: that.vjson,
  31364. from: that.name,
  31365. ignoreRenderUI: true
  31366. });
  31367. }
  31368. else if (a.type === 'fix') {
  31369. if (!value) {
  31370. delete that.currentComponentVJson[propName];
  31371. }
  31372. else {
  31373. that.currentComponentVJson[propName] = value.split("\r\n");
  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 === 'bind') {
  31382. var bind_1 = that.currentComponentVJson.bind;
  31383. if (typeof bind_1 === 'string' && a.id === "value") {
  31384. if (value) {
  31385. that.currentComponentVJson.bind = value;
  31386. }
  31387. else {
  31388. delete that.currentComponentVJson.bind;
  31389. }
  31390. }
  31391. else {
  31392. // 转成bind对象
  31393. if (typeof bind_1 === 'string') {
  31394. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31395. }
  31396. if (value) {
  31397. if (bind_1) {
  31398. bind_1[a.id] = value;
  31399. }
  31400. else {
  31401. var t = {};
  31402. t[a.id] = value;
  31403. that.currentComponentVJson.bind = t;
  31404. }
  31405. }
  31406. else {
  31407. _.forOwn(bind_1, function (value1, key) {
  31408. if (!value1) {
  31409. delete bind_1[key];
  31410. }
  31411. else if (key === a.id) {
  31412. delete bind_1[key];
  31413. }
  31414. });
  31415. if (Object.keys(bind_1).length <= 0) {
  31416. delete that.currentComponentVJson.bind;
  31417. }
  31418. }
  31419. }
  31420. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31421. vjson: that.vjson,
  31422. from: that.name,
  31423. ignoreRenderUI: true
  31424. });
  31425. }
  31426. else if (a.type === 'boolean') {
  31427. if (!value) {
  31428. delete that.currentComponentVJson[propName];
  31429. }
  31430. else if (value === 'false') {
  31431. that.currentComponentVJson[propName] = false;
  31432. }
  31433. else if (value === 'true') {
  31434. that.currentComponentVJson[propName] = true;
  31435. }
  31436. else {
  31437. that.currentComponentVJson[propName] = value;
  31438. }
  31439. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31440. vjson: that.vjson,
  31441. from: that.name
  31442. });
  31443. }
  31444. else {
  31445. that.currentComponentVJson[propName] = value;
  31446. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31447. vjson: that.vjson,
  31448. from: that.name
  31449. });
  31450. }
  31451. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31452. },
  31453. }
  31454. })
  31455. ],
  31456. listeners: {
  31457. // afterrender() {
  31458. // this.propertyHandle.setSource({
  31459. // "(name)": "My Object",
  31460. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31461. // "Available": false, // boolean type
  31462. // "Version": .01, // decimal type
  31463. // "Description": "A test object"
  31464. // });
  31465. // }
  31466. },
  31467. initComponent: function () {
  31468. var _this = this;
  31469. this.propertyHandle = this.items[0];
  31470. setPropertyPanel(this);
  31471. that = this;
  31472. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31473. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31474. _this.setVjson(moduleId, from, ignoreRenderUI);
  31475. });
  31476. return this.superclass.initComponent.apply(this, arguments);
  31477. },
  31478. setVjson: function (moduleId, from, ignoreRenderUI) {
  31479. var _this = this;
  31480. // if (this.moduleId === null && moduleId) {
  31481. // this.moduleId = moduleId
  31482. // }
  31483. if (moduleId !== this.moduleId || from === this.name) {
  31484. return;
  31485. }
  31486. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31487. if (!moduleObj) {
  31488. return;
  31489. }
  31490. this.vjson = moduleObj.moduleObj.vjson;
  31491. this.setPropertyAndEventSource();
  31492. if (this.componentSelectionChangeSubscribe) {
  31493. this.componentSelectionChangeSubscribe.cancel();
  31494. this.componentSelectionChangeSubscribe = null;
  31495. }
  31496. if (this.updateVjsonChangeSubscribe) {
  31497. this.updateVjsonChangeSubscribe.cancel();
  31498. this.updateVjsonChangeSubscribe = null;
  31499. }
  31500. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31501. var id = _a.id, from = _a.from;
  31502. _this.onComponentSelectionChange(id, from);
  31503. });
  31504. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31505. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31506. _this.updateVjson(vjson, from, ignoreRenderUI);
  31507. });
  31508. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31509. this.onComponentSelectionChange(id, from);
  31510. },
  31511. updateVjson: function (vjson, from, ignoreRenderUI) {
  31512. if (!vjson || from === this.name) {
  31513. return;
  31514. }
  31515. this.vjson = vjson;
  31516. this.setPropertyAndEventSource();
  31517. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31518. this.onComponentSelectionChange(id, from);
  31519. },
  31520. onComponentSelectionChange: function (id, from) {
  31521. if (from !== this.name) {
  31522. this.currentComponentVJson = findInCode(this.vjson, id);
  31523. this.setPropertyAndEventSource();
  31524. }
  31525. },
  31526. setPropertyAndEventSource: function () {
  31527. var _this = this;
  31528. this.propertyHandle.setSource({});
  31529. if (!this.currentComponentVJson) {
  31530. return;
  31531. }
  31532. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31533. var v = xtype;
  31534. // 选中的对象可能是组
  31535. if (!v) {
  31536. if (_.has(this.currentComponentVJson, "cols")) {
  31537. v = "cols";
  31538. }
  31539. else if (_.has(this.currentComponentVJson, "rows")) {
  31540. v = "rows";
  31541. }
  31542. }
  31543. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31544. if (!pd) {
  31545. // 这个组件没有属性
  31546. this.propertyHandle.setSource({});
  31547. return;
  31548. }
  31549. var funcArr = this.getAllfuncs();
  31550. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31551. // disabled: true,
  31552. displayField: 'name',
  31553. valueField: 'name',
  31554. store: funcArr,
  31555. }); };
  31556. // ====================== 属性
  31557. var elements = [];
  31558. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31559. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31560. var props = pd.getPropsByGroup(group);
  31561. if (props.length <= 0)
  31562. return; //没有这一组属性
  31563. // 显示 group 的中文名
  31564. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31565. if (caption[i] === '绑定') {
  31566. _.each(props, function (prop) {
  31567. elements.push({
  31568. label: "_" + prop.name,
  31569. type: "bind",
  31570. id: prop.name,
  31571. desc: prop.desc,
  31572. editor: new Ext.form.field.Text()
  31573. });
  31574. });
  31575. }
  31576. else {
  31577. _.each(props, function (prop) {
  31578. if (_.isArray(prop.type)) {
  31579. elements.push({
  31580. label: prop.name,
  31581. type: "combo",
  31582. options: prop.type,
  31583. id: prop.name,
  31584. desc: prop.desc
  31585. });
  31586. return;
  31587. }
  31588. switch (prop.type) {
  31589. case 'boolean': {
  31590. elements.push({
  31591. label: prop.name,
  31592. id: prop.name,
  31593. desc: prop.desc,
  31594. type: 'boolean',
  31595. editor: new Ext.form.field.ComboBox({
  31596. displayField: 'text',
  31597. valueField: 'id',
  31598. store: new Ext.data.Store({
  31599. field: ['id', 'text'],
  31600. data: [
  31601. { id: 'true', text: 'True' },
  31602. { id: 'false', text: 'False' },
  31603. ]
  31604. })
  31605. }),
  31606. });
  31607. break;
  31608. }
  31609. case 'number': {
  31610. elements.push({
  31611. label: prop.name,
  31612. type: "number",
  31613. id: prop.name,
  31614. isNum: true,
  31615. desc: prop.desc,
  31616. editor: new Ext.form.field.Number()
  31617. });
  31618. break;
  31619. }
  31620. case 'string': {
  31621. elements.push({
  31622. label: prop.name,
  31623. type: "string",
  31624. id: prop.name,
  31625. desc: prop.desc,
  31626. editor: new Ext.form.field.Text()
  31627. });
  31628. break;
  31629. }
  31630. case 'listeners': {
  31631. elements.push({
  31632. label: prop.name,
  31633. type: "listeners",
  31634. id: prop.name,
  31635. desc: prop.desc,
  31636. editor: createFuncEditor()
  31637. });
  31638. break;
  31639. }
  31640. case 'fix': {
  31641. elements.push({
  31642. label: prop.name,
  31643. type: "fix",
  31644. id: prop.name,
  31645. desc: prop.desc,
  31646. editor: new Ext.form.field.Text()
  31647. });
  31648. break;
  31649. }
  31650. case 'object': {
  31651. break;
  31652. }
  31653. // case 'dataSource' : {
  31654. // break;
  31655. // }
  31656. case 'valid': {
  31657. break;
  31658. }
  31659. default:
  31660. elements.push({
  31661. label: prop.name,
  31662. type: prop.type,
  31663. id: prop.name,
  31664. desc: prop.desc,
  31665. editor: new Ext.form.field.Text({ disabled: true })
  31666. });
  31667. console.error('不支持的编辑类型', prop);
  31668. }
  31669. });
  31670. }
  31671. });
  31672. this.currentComponentPropertyEditSource = elements;
  31673. var panel1Source = {};
  31674. var panel1SourceConfig = {};
  31675. _.each(elements, function (item) {
  31676. var _a;
  31677. if (item.type === "listeners") {
  31678. var listeners = _this.currentComponentVJson.listeners;
  31679. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31680. }
  31681. else if (item.type === "fix") {
  31682. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31683. }
  31684. else if (item.type === "bind") {
  31685. var bind = _this.currentComponentVJson.bind;
  31686. if (typeof bind === 'string' && item.id === 'value') {
  31687. panel1Source[item.label] = bind;
  31688. }
  31689. else {
  31690. panel1Source[item.label] = bind ? bind[item.id] : '';
  31691. }
  31692. }
  31693. else {
  31694. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31695. }
  31696. panel1Source[item.label] = panel1Source[item.label] || '';
  31697. panel1SourceConfig[item.label] = { editor: item.editor };
  31698. });
  31699. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31700. },
  31701. getAllfuncs: function () {
  31702. var _a, _b;
  31703. 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;
  31704. var scopeFuncs = [];
  31705. _.forEach(arr, function (item) {
  31706. scopeFuncs.push({ name: "scope." + item.name });
  31707. });
  31708. return scopeFuncs;
  31709. }
  31710. });
  31711. }
  31712. //# sourceMappingURL=PropertyDesign.js.map
  31713. function initViewOutlineTree () {
  31714. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31715. extend: 'Ext.tree.Panel',
  31716. xtype: 'viewoutlinetree',
  31717. name: "ViewOutlineTree",
  31718. tooltip: '设计大纲',
  31719. iconCls: 'x-fa fa-list',
  31720. rootVisible: false,
  31721. useArrows: true,
  31722. allowDeselect: true,
  31723. colspan: 2,
  31724. lines: false,
  31725. reference: 'viewoutlinetree',
  31726. multiSelect: true,
  31727. _saveStateFlag: true,
  31728. keyMapEnabled: true,
  31729. moduleId: null,
  31730. vjson: null,
  31731. columns: [
  31732. {
  31733. xtype: 'treecolumn',
  31734. text: '布局',
  31735. dataIndex: 'layoutNameDesc',
  31736. flex: 2,
  31737. sortable: true
  31738. }, {
  31739. text: '组件',
  31740. dataIndex: 'xtype',
  31741. flex: 1,
  31742. sortable: true,
  31743. align: 'center',
  31744. }
  31745. ],
  31746. listeners: {
  31747. itemcontextmenu: function (sender, node, element, idx, e) {
  31748. e.preventDefault();
  31749. this.rightClickTreeNode(sender, node, element, idx, e);
  31750. },
  31751. select: function (sender, node, index, e) {
  31752. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31753. },
  31754. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31755. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31756. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31757. }
  31758. }
  31759. },
  31760. initComponent: function () {
  31761. var _this = this;
  31762. setViewoutlinetree(this);
  31763. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31764. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31765. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31766. });
  31767. return this.superclass.initComponent.apply(this, arguments);
  31768. },
  31769. clear: function () {
  31770. this.setRootNode(null);
  31771. },
  31772. onChangModule: function (moduleId, oldModuleId, from) {
  31773. if (!moduleId || moduleId !== this.moduleId) {
  31774. return;
  31775. }
  31776. if (moduleStore.getModuleObject(moduleId)) {
  31777. this.setVjson(moduleId, from);
  31778. }
  31779. },
  31780. setVjson: function (moduleId, from, ignoreRenderUI) {
  31781. var _this = this;
  31782. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31783. return;
  31784. }
  31785. this.moduleId = moduleId;
  31786. // if (from === this.name) {
  31787. // return
  31788. // }
  31789. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31790. this.setTreeValue();
  31791. if (this.componentSelectionChangeSubscribe) {
  31792. this.componentSelectionChangeSubscribe.cancel();
  31793. this.componentSelectionChangeSubscribe = null;
  31794. }
  31795. if (this.setVjsonChangeSubscribe) {
  31796. this.setVjsonChangeSubscribe.cancel();
  31797. this.setVjsonChangeSubscribe = null;
  31798. }
  31799. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31800. var id = _a.id, from = _a.from;
  31801. return _this.onComponentSelectionChange(id, from);
  31802. });
  31803. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31804. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31805. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31806. });
  31807. },
  31808. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31809. if (!vjson || from === this.name) {
  31810. return;
  31811. }
  31812. this.vjson = vjson;
  31813. this.setTreeValue();
  31814. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31815. if (id) {
  31816. this.selectPath(id);
  31817. }
  31818. },
  31819. onComponentSelectionChange: function (id, from) {
  31820. if (from !== this.name) {
  31821. if (id) {
  31822. this.selectPath(id);
  31823. }
  31824. else {
  31825. this.setTreeValue();
  31826. }
  31827. }
  31828. },
  31829. setTreeValue: function () {
  31830. var outlineVj = {};
  31831. _.forOwn(this.vjson, function (obj, key) {
  31832. if (key !== 'viewModel' && key !== 'store') {
  31833. outlineVj[key] = _.cloneDeep(obj);
  31834. }
  31835. });
  31836. getLayoutOutline(outlineVj);
  31837. this.setRootNode(outlineVj);
  31838. },
  31839. rightClickTreeNode: function (sender, node, element, idx, e) {
  31840. var raw = node.data;
  31841. var option = {};
  31842. // 右键
  31843. option = {
  31844. shadow: 'frame',
  31845. allowOtherMenus: true,
  31846. items: []
  31847. };
  31848. var switchType = raw.layoutName;
  31849. if (raw.layoutName === 'north' ||
  31850. raw.layoutName === 'south' ||
  31851. raw.layoutName === 'west' ||
  31852. raw.layoutName === 'east' ||
  31853. raw.layoutName === 'center' ||
  31854. raw.layoutName === 'tbar' ||
  31855. raw.layoutName === 'fbar') {
  31856. switchType = raw.xtype || raw.layout;
  31857. }
  31858. var itemArr = [];
  31859. var hasTbar = false, hasFbar = false, hasBody = false;
  31860. if (raw.hasOwnProperty("children")) {
  31861. _.forEach(raw.children, function (value) {
  31862. if (value.layoutName === 'tbar') {
  31863. hasTbar = true;
  31864. }
  31865. else if (value.layoutName === 'fbar') {
  31866. hasFbar = true;
  31867. }
  31868. else {
  31869. hasBody = true;
  31870. }
  31871. });
  31872. }
  31873. switch (switchType) {
  31874. case 'fit':
  31875. if (!hasTbar) {
  31876. itemArr.push('tbar');
  31877. }
  31878. if (!hasFbar) {
  31879. itemArr.push('fbar');
  31880. }
  31881. if (!hasBody) {
  31882. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31883. }
  31884. option.items = this.menuNew(itemArr, raw);
  31885. break;
  31886. case 'border':
  31887. if (!hasTbar) {
  31888. itemArr.push('tbar');
  31889. }
  31890. if (!hasFbar) {
  31891. itemArr.push('fbar');
  31892. }
  31893. itemArr.push('cnsew');
  31894. option.items = this.menuNew(itemArr, raw);
  31895. break;
  31896. // case 'tbar':
  31897. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31898. // break;
  31899. // case 'fbar':
  31900. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31901. // break;
  31902. case 'tabpanel':
  31903. if (!hasTbar) {
  31904. itemArr.push('tbar');
  31905. }
  31906. if (!hasFbar) {
  31907. itemArr.push('fbar');
  31908. }
  31909. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31910. option.items = this.menuNew(itemArr, raw);
  31911. break;
  31912. case 'yvgrid':
  31913. if (!hasTbar) {
  31914. itemArr.push('tbar');
  31915. }
  31916. option.items = this.menuNew(itemArr, raw);
  31917. break;
  31918. case 'tree':
  31919. if (!hasTbar) {
  31920. itemArr.push('tbar');
  31921. }
  31922. if (!hasFbar) {
  31923. itemArr.push('fbar');
  31924. }
  31925. option.items = this.menuNew(itemArr, raw);
  31926. break;
  31927. case 'fieldset':
  31928. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31929. break;
  31930. case 'form':
  31931. if (!hasTbar) {
  31932. itemArr.push('tbar');
  31933. }
  31934. if (!hasFbar) {
  31935. itemArr.push('fbar');
  31936. }
  31937. itemArr.push('form', 'fieldset', 'cols');
  31938. option.items = this.menuNew(itemArr, raw);
  31939. break;
  31940. case 'toolbar':
  31941. itemArr.push('button', 'textfield', 'label', 'combo');
  31942. option.items = this.menuNew(itemArr, raw);
  31943. break;
  31944. // case 'fbar':
  31945. // itemArr.push('button', 'textfield', 'label', 'combo')
  31946. // option.items = this.menuNew(itemArr, raw)
  31947. // break
  31948. default:
  31949. option.items = this.menuNew(itemArr, raw);
  31950. break;
  31951. }
  31952. var treeMenu = new Ext.menu.Menu(option);
  31953. treeMenu.showAt(e.getXY());
  31954. },
  31955. newItem: function (viewType, raw, region) {
  31956. var itemVjson = {};
  31957. switch (viewType) {
  31958. case 'fit':
  31959. itemVjson.layout = 'fit';
  31960. itemVjson.items = [];
  31961. break;
  31962. case 'border':
  31963. itemVjson.layout = 'border';
  31964. itemVjson.items = [];
  31965. break;
  31966. case 'toolbar':
  31967. itemVjson.xtype = 'toolbar';
  31968. itemVjson.title = 'toolbar';
  31969. itemVjson.items = [
  31970. {
  31971. xtype: 'button',
  31972. text: 'button'
  31973. }
  31974. ];
  31975. break;
  31976. case 'tabpanel':
  31977. itemVjson.xtype = 'tabpanel';
  31978. itemVjson.layout = 'fit';
  31979. itemVjson.items = [];
  31980. break;
  31981. case 'yvgrid':
  31982. itemVjson.xtype = 'yvgrid';
  31983. itemVjson.layout = 'fit';
  31984. itemVjson.pagination = false;
  31985. itemVjson.columns = [
  31986. {
  31987. dataIndex: "skuId",
  31988. header: "SKU_ID",
  31989. },
  31990. ];
  31991. break;
  31992. case 'tree':
  31993. itemVjson.xtype = 'treepanel';
  31994. itemVjson.layout = 'fit';
  31995. break;
  31996. case 'fieldset':
  31997. case 'form':
  31998. itemVjson.xtype = viewType;
  31999. itemVjson.title = viewType;
  32000. itemVjson.items = [
  32001. {
  32002. xtype: 'cols',
  32003. items: [
  32004. {
  32005. xtype: 'textfield',
  32006. fieldLabel: '输入框'
  32007. }
  32008. ]
  32009. }
  32010. ];
  32011. break;
  32012. case 'cols':
  32013. itemVjson.xtype = 'cols';
  32014. itemVjson.items = [
  32015. {
  32016. xtype: 'textfield',
  32017. fieldLabel: '输入框'
  32018. }
  32019. ];
  32020. break;
  32021. case 'button':
  32022. itemVjson.xtype = 'button';
  32023. itemVjson.text = '按钮';
  32024. itemVjson.iconCls = 'x-fa fa-plus';
  32025. break;
  32026. case 'textfield':
  32027. itemVjson.xtype = 'textfield';
  32028. itemVjson.fieldLabel = '输入框';
  32029. break;
  32030. case 'combo':
  32031. itemVjson.xtype = 'combo';
  32032. itemVjson.fieldLabel = '下拉框';
  32033. break;
  32034. case 'label':
  32035. itemVjson.xtype = 'label';
  32036. itemVjson.text = '文本';
  32037. break;
  32038. }
  32039. var target = findInCode(this.vjson, raw.id);
  32040. if (region) {
  32041. if (region === 'tbar' || region === 'fbar') {
  32042. target[region] = itemVjson;
  32043. }
  32044. else {
  32045. itemVjson.region = region;
  32046. itemVjson.split = true;
  32047. if (region === 'north' || region === 'south') {
  32048. itemVjson.height = '30%';
  32049. itemVjson.collapsible = true;
  32050. }
  32051. else if (region === 'west' || region === 'east') {
  32052. itemVjson.width = '30%';
  32053. itemVjson.collapsible = true;
  32054. }
  32055. target.items.push(itemVjson);
  32056. }
  32057. }
  32058. else {
  32059. if (target.xtype === 'tabpanel') {
  32060. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  32061. }
  32062. target.items.push(itemVjson);
  32063. }
  32064. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32065. },
  32066. menuNew: function (typeArr, raw, region) {
  32067. var that = this;
  32068. var reArr = [];
  32069. typeArr.forEach(function (value) {
  32070. if (value === 'cnsew') {
  32071. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  32072. }
  32073. else if (value === 'tbar' || value === 'fbar') {
  32074. reArr.push(that.menuNewTFBar(value, raw));
  32075. }
  32076. else {
  32077. reArr.push({
  32078. text: '新建' + layoutOrXtypeNameMap[value],
  32079. iconCls: 'x-fa fa-plus',
  32080. handler: function (sender) {
  32081. that.newItem(value, raw, region);
  32082. }
  32083. });
  32084. }
  32085. reArr.push("-");
  32086. });
  32087. if (region) {
  32088. reArr.pop();
  32089. return reArr;
  32090. }
  32091. reArr.push({
  32092. text: '高级属性',
  32093. iconCls: 'x-fa fa-cog',
  32094. handler: function (sender) {
  32095. var vj = findInCode(that.vjson, raw.id);
  32096. that.advancedSettingWindow(vj);
  32097. }
  32098. }, {
  32099. text: '上移',
  32100. iconCls: 'x-fa fa-trash',
  32101. handler: function (sender) {
  32102. that.moveCmp(raw.id, 'up');
  32103. }
  32104. }, {
  32105. text: '置顶',
  32106. iconCls: 'x-fa fa-trash',
  32107. handler: function (sender) {
  32108. that.moveCmp(raw.id, 'top');
  32109. }
  32110. }, {
  32111. text: '置底',
  32112. iconCls: 'x-fa fa-trash',
  32113. handler: function (sender) {
  32114. that.moveCmp(raw.id, 'bottom');
  32115. }
  32116. }, {
  32117. text: '下移',
  32118. iconCls: 'x-fa fa-trash',
  32119. handler: function (sender) {
  32120. that.moveCmp(raw.id, 'down');
  32121. }
  32122. }, {
  32123. text: '删除',
  32124. iconCls: 'x-fa fa-trash',
  32125. handler: function (sender) {
  32126. deletVjsonById(that.vjson, raw.id);
  32127. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32128. }
  32129. });
  32130. return reArr;
  32131. },
  32132. menuNewCNSEW: function (raw) {
  32133. var that = this;
  32134. var arr = ['center', 'north', 'south', 'west', 'east'];
  32135. if (raw.hasOwnProperty("children")) {
  32136. _.forEach(raw.children, function (value) {
  32137. _.remove(arr, function (it) {
  32138. return it === value.layoutName;
  32139. });
  32140. });
  32141. }
  32142. var reArr = [];
  32143. arr.forEach(function (value) {
  32144. reArr.push({
  32145. text: layoutOrXtypeNameMap[value],
  32146. iconCls: 'x-fa fa-plus',
  32147. menu: {
  32148. showSeparator: true,
  32149. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32150. }
  32151. });
  32152. reArr.push("-");
  32153. });
  32154. reArr.pop();
  32155. return reArr;
  32156. },
  32157. menuNewTFBar: function (barType, raw) {
  32158. var that = this;
  32159. var reObj = {
  32160. text: layoutOrXtypeNameMap[barType],
  32161. iconCls: 'x-fa fa-plus',
  32162. menu: {
  32163. showSeparator: true,
  32164. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32165. }
  32166. };
  32167. return reObj;
  32168. },
  32169. moveCmp: function (id, moveType) {
  32170. var arr = findArrayContainer(this.vjson, id);
  32171. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32172. if (index < 0) {
  32173. return;
  32174. }
  32175. switch (moveType) {
  32176. case 'up':
  32177. if (index > 0) {
  32178. var o = arr[index];
  32179. arr[index] = arr[index - 1];
  32180. arr[index - 1] = o;
  32181. }
  32182. else {
  32183. return;
  32184. }
  32185. break;
  32186. case 'down':
  32187. if (index < arr.length - 1) {
  32188. var o = arr[index];
  32189. arr[index] = arr[index + 1];
  32190. arr[index + 1] = o;
  32191. }
  32192. else {
  32193. return;
  32194. }
  32195. break;
  32196. case 'top':
  32197. if (index > 0) {
  32198. var o = arr[index];
  32199. arr[index] = arr[0];
  32200. arr[0] = o;
  32201. }
  32202. else {
  32203. return;
  32204. }
  32205. break;
  32206. case 'bottom':
  32207. if (index < arr.length - 1) {
  32208. var o = arr[index];
  32209. arr[index] = arr[arr.length - 1];
  32210. arr[arr.length - 1] = o;
  32211. }
  32212. else {
  32213. return;
  32214. }
  32215. break;
  32216. }
  32217. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32218. }
  32219. });
  32220. }
  32221. //# sourceMappingURL=ViewOutlineTree.js.map
  32222. function init$2 () {
  32223. window['native'] = native;
  32224. native.init();
  32225. init();
  32226. initStateTree();
  32227. initDashboard();
  32228. initFileTree();
  32229. initDbTree();
  32230. initReportGrid();
  32231. initGroovyEditor();
  32232. initJsEditor$1();
  32233. initJsonEditor$1();
  32234. initSqlEditor$1();
  32235. initTemplateEditor();
  32236. initDict$1();
  32237. initBpmnTree();
  32238. initToolBox();
  32239. initPropertyDesign();
  32240. initViewOutlineTree();
  32241. initWidget();
  32242. initWhLayout();
  32243. initApiTree();
  32244. initTaskTree();
  32245. initLogsTree();
  32246. initDevOpsTree();
  32247. initTerminal();
  32248. initMonitorTree();
  32249. initHomeTree();
  32250. }
  32251. //# sourceMappingURL=init.js.map
  32252. var studio = {
  32253. init: init$2,
  32254. handles: handles$1,
  32255. Workbench: Workbench
  32256. };
  32257. //# sourceMappingURL=index.js.map
  32258. exports.axios = axios;
  32259. exports.qs = Qs;
  32260. exports.lodash = _$2;
  32261. exports.jquery = $$2;
  32262. exports.moment = moment$1;
  32263. exports.recast = recast;
  32264. exports.XLSX = XLSX;
  32265. exports.Defaults = Defaults;
  32266. exports.ExcelImportDialog = ExcelImportDialog;
  32267. exports.Lib = Lib;
  32268. exports.LibParam = LibParam;
  32269. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32270. exports.ReportScope = ReportScope;
  32271. exports.SIMPLE_RE = SIMPLE_RE;
  32272. exports.Scope = Scope;
  32273. exports.ScopeEngine = ScopeEngine;
  32274. exports.SystemEventFu = SystemEventFu;
  32275. exports.ajax = ajax;
  32276. exports.baseConfigProcess = baseConfigProcess;
  32277. exports.baseConfigProcessList = baseConfigProcessList;
  32278. exports.buildPlus = buildPlus;
  32279. exports.buildReportScope = buildReportScope;
  32280. exports.calcExpress = calcExpress;
  32281. exports.calcObject = calcObject;
  32282. exports.calcObjectFlat = calcObjectFlat;
  32283. exports.clearViewModel = clearViewModel;
  32284. exports.clearViewModelByLookup = clearViewModelByLookup;
  32285. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32286. exports.clearViewModelValues = clearViewModelValues;
  32287. exports.commitMe = commitMe;
  32288. exports.confirm = confirm;
  32289. exports.createAjax = createAjax;
  32290. exports.createUUID = createUUID;
  32291. exports.deepTravJson = deepTravJson;
  32292. exports.downLoad = downLoad;
  32293. exports.evalFunction = evalFunction;
  32294. exports.extend = extend;
  32295. exports.flatRow = flatRow;
  32296. exports.getApiConvert = getApiConvert;
  32297. exports.getGridEditRows = getGridEditRows;
  32298. exports.getParentGrid = getParentGrid;
  32299. exports.getPinyin = getPinyin;
  32300. exports.getRegList = getRegList;
  32301. exports.getRegParamList = getRegParamList;
  32302. exports.getScopeOnCreate = getScopeOnCreate;
  32303. exports.init = init$1;
  32304. exports.insertGridRow = insertGridRow;
  32305. exports.invokeServer = invokeServer$1;
  32306. exports.isDesignMode = isDesignMode;
  32307. exports.isEmpty = isEmpty;
  32308. exports.json5 = dist;
  32309. exports.keywordFilter = keywordFilter;
  32310. exports.lookupFn = lookupFn;
  32311. exports.lookupScope = lookupScope;
  32312. exports.mergeViewModel = mergeViewModel;
  32313. exports.moveDownGridRow = moveDownGridRow;
  32314. exports.moveUpGridRow = moveUpGridRow;
  32315. exports.msg = msg$1;
  32316. exports.msgError = msgError;
  32317. exports.normId = normId;
  32318. exports.pinyinMatch = pinyinMatch;
  32319. exports.prompt = prompt$2;
  32320. exports.raiseClick = raiseClick;
  32321. exports.reloadGrid = reloadGrid;
  32322. exports.removeGridRow = removeGridRow;
  32323. exports.replaceNA = replaceNA;
  32324. exports.saveGridRow = saveGridRow;
  32325. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32326. exports.setComboStore = setComboStore;
  32327. exports.showErrorDialog = showErrorDialog$1;
  32328. exports.showInfoDialog = showInfoDialog;
  32329. exports.showWidget = showWidget;
  32330. exports.sqlUrlTransform = sqlUrlTransform;
  32331. exports.stopEvent = stopEvent;
  32332. exports.studio = studio;
  32333. exports.toPlainObject = toPlainObject;
  32334. exports.toString = toString;
  32335. exports.tryEnable = tryEnable;
  32336. exports.tryVarSimple = tryVarSimple;
  32337. exports.tryWriteByExpress = tryWriteByExpress;
  32338. exports.tryWriteObject = tryWriteObject;
  32339. exports.watch = watch;
  32340. Object.defineProperty(exports, '__esModule', { value: true });
  32341. });
  32342. //# sourceMappingURL=yvan-ext.js.map