yvan-ext.js 1.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter', 'modeler', 'bpmn-js-properties-panel', 'lay-excel'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, handlebars, xterm, xtermAddonFit, sqlFormat, BpmnModeler, bpmnJsPropertiesPanel, LAY_EXCEL) { '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. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  10. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  11. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  12. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. };
  50. var comboGrid = {
  51. selectOnTab: true,
  52. pickerHeight: 500,
  53. pickerWidth: 850,
  54. editEnable: null,
  55. };
  56. var comboGridPicker = {
  57. xtype: 'yvgrid',
  58. layout: 'fit',
  59. selModel: {
  60. selType: 'rowmodel',
  61. mode: 'SINGLE'
  62. },
  63. };
  64. var comboGridMulti = {
  65. selectOnTab: true,
  66. pickerHeight: 500,
  67. pickerWidth: 850,
  68. editEnable: null,
  69. splitChar: ',',
  70. displayField: 'text',
  71. valueField: 'id',
  72. autoLoad: true,
  73. };
  74. var comboGridMultiPicker = {
  75. selType: 'checkboxmodel',
  76. selModel: {
  77. type: 'checkboxmodel',
  78. checkOnly: false
  79. },
  80. };
  81. var numberfield = {
  82. labelAlign: 'right',
  83. decimalPrecision: 6,
  84. labelWidth: labelWidth,
  85. };
  86. var checkbox = {
  87. labelAlign: 'right',
  88. labelWidth: labelWidth,
  89. checkedValue: true,
  90. uncheckedValue: false,
  91. };
  92. var checkboxgroup = {
  93. labelAlign: 'right',
  94. labelWidth: labelWidth,
  95. };
  96. var radio = {
  97. labelAlign: 'right',
  98. labelWidth: labelWidth,
  99. };
  100. var radiogroup = {
  101. labelAlign: 'right',
  102. labelWidth: labelWidth,
  103. simpleValue: true,
  104. layout: 'hbox',
  105. defaults: {
  106. xtype: 'radio',
  107. name: 'type',
  108. margin: '0 15 0 0'
  109. },
  110. };
  111. var form = {
  112. margin: '5 5 0 0',
  113. border: false,
  114. defaults: {
  115. margin: '0 0 5 0',
  116. border: false,
  117. },
  118. };
  119. var column = {
  120. filter: { type: 'string' },
  121. };
  122. var grid = {
  123. border: true,
  124. columnLines: true,
  125. rowLines: true,
  126. plugins: {
  127. cellediting: {
  128. clicksToEdit: 1,
  129. },
  130. gridfilters: true
  131. },
  132. multiColumnSort: true,
  133. viewConfig: {
  134. enableTextSelection: true,
  135. sortOnClick: false,
  136. emptyText: '没有数据'
  137. },
  138. selModel: {
  139. type: 'checkboxmodel',
  140. checkOnly: false
  141. },
  142. pagination: true,
  143. pageSize: 50,
  144. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  145. hideFootbar: false,
  146. hideRefresh: false,
  147. hideExport: false,
  148. hideAutoSize: false,
  149. hideClearFilter: false,
  150. hideSaveGridUIConfig: false,
  151. hideClearGridUIConfig: false,
  152. autoLoad: true,
  153. remoteSort: false,
  154. remoteFilter: false,
  155. enableLocking: true,
  156. syncRowHeight: false,
  157. enableColumnMove: true,
  158. enableColumnHide: true,
  159. enableColumnResize: true,
  160. hidden: false,
  161. disabled: false,
  162. exportExcelPageSize: 100,
  163. exportExcelCurrentPage: 1,
  164. exportExcelTotal: 0,
  165. cellTip: false,
  166. };
  167. var fieldContainer = {
  168. labelAlign: 'right',
  169. labelWidth: labelWidth,
  170. layout: 'hbox',
  171. defaults: {
  172. flex: 1,
  173. }
  174. };
  175. var tree = {
  176. autoLoad: true,
  177. hideFilter: false,
  178. hideToolbar: false,
  179. hideRefresh: false,
  180. hideExpand: false,
  181. hideCollapse: false,
  182. root: [],
  183. rootVisible: false,
  184. };
  185. var search = {
  186. labelAlign: 'right',
  187. labelWidth: labelWidth,
  188. };
  189. var text = {
  190. labelAlign: 'right',
  191. labelWidth: labelWidth,
  192. msgTarget: 'qtip',
  193. };
  194. var toolbar = {
  195. overflowHandler: 'menu',
  196. };
  197. var tbfill = {};
  198. var tbseparator = {};
  199. var button = {};
  200. var fieldSet = {
  201. margin: '5 5 0 0',
  202. border: false,
  203. defaults: {
  204. margin: '0 0 5 0',
  205. border: false,
  206. },
  207. };
  208. var storeAjax = {
  209. timeout: 60000
  210. };
  211. var panel = {};
  212. var splitter = {};
  213. var maintab = {};
  214. var rows = {};
  215. var cols = {
  216. defaults: {
  217. flex: 1
  218. },
  219. };
  220. var bpmn = {
  221. hideRefresh: false,
  222. autoLoad: true,
  223. dataSource: '',
  224. bpmnConfig: {}
  225. };
  226. //# sourceMappingURL=Defaults.js.map
  227. var Defaults = /*#__PURE__*/Object.freeze({
  228. __proto__: null,
  229. windows: windows,
  230. date: date,
  231. tagfield: tagfield,
  232. combo: combo,
  233. comboGrid: comboGrid,
  234. comboGridPicker: comboGridPicker,
  235. comboGridMulti: comboGridMulti,
  236. comboGridMultiPicker: comboGridMultiPicker,
  237. numberfield: numberfield,
  238. checkbox: checkbox,
  239. checkboxgroup: checkboxgroup,
  240. radio: radio,
  241. radiogroup: radiogroup,
  242. form: form,
  243. column: column,
  244. grid: grid,
  245. fieldContainer: fieldContainer,
  246. tree: tree,
  247. search: search,
  248. text: text,
  249. toolbar: toolbar,
  250. tbfill: tbfill,
  251. tbseparator: tbseparator,
  252. button: button,
  253. fieldSet: fieldSet,
  254. storeAjax: storeAjax,
  255. panel: panel,
  256. splitter: splitter,
  257. maintab: maintab,
  258. rows: rows,
  259. cols: cols,
  260. bpmn: bpmn
  261. });
  262. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  263. function createCommonjsModule(fn, module) {
  264. return module = { exports: {} }, fn(module, module.exports), module.exports;
  265. }
  266. var dist = createCommonjsModule(function (module, exports) {
  267. (function (global, factory) {
  268. module.exports = factory() ;
  269. }(commonjsGlobal, (function () {
  270. function createCommonjsModule(fn, module) {
  271. return module = { exports: {} }, fn(module, module.exports), module.exports;
  272. }
  273. var _global = createCommonjsModule(function (module) {
  274. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  275. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  276. ? window : typeof self != 'undefined' && self.Math == Math ? self
  277. // eslint-disable-next-line no-new-func
  278. : Function('return this')();
  279. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  280. });
  281. var _core = createCommonjsModule(function (module) {
  282. var core = module.exports = { version: '2.6.5' };
  283. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  284. });
  285. var _core_1 = _core.version;
  286. var _isObject = function (it) {
  287. return typeof it === 'object' ? it !== null : typeof it === 'function';
  288. };
  289. var _anObject = function (it) {
  290. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  291. return it;
  292. };
  293. var _fails = function (exec) {
  294. try {
  295. return !!exec();
  296. } catch (e) {
  297. return true;
  298. }
  299. };
  300. // Thank's IE8 for his funny defineProperty
  301. var _descriptors = !_fails(function () {
  302. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  303. });
  304. var document = _global.document;
  305. // typeof document.createElement is 'object' in old IE
  306. var is = _isObject(document) && _isObject(document.createElement);
  307. var _domCreate = function (it) {
  308. return is ? document.createElement(it) : {};
  309. };
  310. var _ie8DomDefine = !_descriptors && !_fails(function () {
  311. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  312. });
  313. // 7.1.1 ToPrimitive(input [, PreferredType])
  314. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  315. // and the second argument - flag - preferred type is a string
  316. var _toPrimitive = function (it, S) {
  317. if (!_isObject(it)) { return it; }
  318. var fn, val;
  319. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  320. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  321. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. throw TypeError("Can't convert object to primitive value");
  323. };
  324. var dP = Object.defineProperty;
  325. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  326. _anObject(O);
  327. P = _toPrimitive(P, true);
  328. _anObject(Attributes);
  329. if (_ie8DomDefine) { try {
  330. return dP(O, P, Attributes);
  331. } catch (e) { /* empty */ } }
  332. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  333. if ('value' in Attributes) { O[P] = Attributes.value; }
  334. return O;
  335. };
  336. var _objectDp = {
  337. f: f
  338. };
  339. var _propertyDesc = function (bitmap, value) {
  340. return {
  341. enumerable: !(bitmap & 1),
  342. configurable: !(bitmap & 2),
  343. writable: !(bitmap & 4),
  344. value: value
  345. };
  346. };
  347. var _hide = _descriptors ? function (object, key, value) {
  348. return _objectDp.f(object, key, _propertyDesc(1, value));
  349. } : function (object, key, value) {
  350. object[key] = value;
  351. return object;
  352. };
  353. var hasOwnProperty = {}.hasOwnProperty;
  354. var _has = function (it, key) {
  355. return hasOwnProperty.call(it, key);
  356. };
  357. var id = 0;
  358. var px = Math.random();
  359. var _uid = function (key) {
  360. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  361. };
  362. var _shared = createCommonjsModule(function (module) {
  363. var SHARED = '__core-js_shared__';
  364. var store = _global[SHARED] || (_global[SHARED] = {});
  365. (module.exports = function (key, value) {
  366. return store[key] || (store[key] = value !== undefined ? value : {});
  367. })('versions', []).push({
  368. version: _core.version,
  369. mode: 'global',
  370. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  371. });
  372. });
  373. var _functionToString = _shared('native-function-to-string', Function.toString);
  374. var _redefine = createCommonjsModule(function (module) {
  375. var SRC = _uid('src');
  376. var TO_STRING = 'toString';
  377. var TPL = ('' + _functionToString).split(TO_STRING);
  378. _core.inspectSource = function (it) {
  379. return _functionToString.call(it);
  380. };
  381. (module.exports = function (O, key, val, safe) {
  382. var isFunction = typeof val == 'function';
  383. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  384. if (O[key] === val) { return; }
  385. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  386. if (O === _global) {
  387. O[key] = val;
  388. } else if (!safe) {
  389. delete O[key];
  390. _hide(O, key, val);
  391. } else if (O[key]) {
  392. O[key] = val;
  393. } else {
  394. _hide(O, key, val);
  395. }
  396. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  397. })(Function.prototype, TO_STRING, function toString() {
  398. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  399. });
  400. });
  401. var _aFunction = function (it) {
  402. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  403. return it;
  404. };
  405. // optional / simple context binding
  406. var _ctx = function (fn, that, length) {
  407. _aFunction(fn);
  408. if (that === undefined) { return fn; }
  409. switch (length) {
  410. case 1: return function (a) {
  411. return fn.call(that, a);
  412. };
  413. case 2: return function (a, b) {
  414. return fn.call(that, a, b);
  415. };
  416. case 3: return function (a, b, c) {
  417. return fn.call(that, a, b, c);
  418. };
  419. }
  420. return function (/* ...args */) {
  421. return fn.apply(that, arguments);
  422. };
  423. };
  424. var PROTOTYPE = 'prototype';
  425. var $export = function (type, name, source) {
  426. var IS_FORCED = type & $export.F;
  427. var IS_GLOBAL = type & $export.G;
  428. var IS_STATIC = type & $export.S;
  429. var IS_PROTO = type & $export.P;
  430. var IS_BIND = type & $export.B;
  431. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  432. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  433. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  434. var key, own, out, exp;
  435. if (IS_GLOBAL) { source = name; }
  436. for (key in source) {
  437. // contains in native
  438. own = !IS_FORCED && target && target[key] !== undefined;
  439. // export native or passed
  440. out = (own ? target : source)[key];
  441. // bind timers to global for call from export context
  442. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  443. // extend global
  444. if (target) { _redefine(target, key, out, type & $export.U); }
  445. // export
  446. if (exports[key] != out) { _hide(exports, key, exp); }
  447. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  448. }
  449. };
  450. _global.core = _core;
  451. // type bitmap
  452. $export.F = 1; // forced
  453. $export.G = 2; // global
  454. $export.S = 4; // static
  455. $export.P = 8; // proto
  456. $export.B = 16; // bind
  457. $export.W = 32; // wrap
  458. $export.U = 64; // safe
  459. $export.R = 128; // real proto method for `library`
  460. var _export = $export;
  461. // 7.1.4 ToInteger
  462. var ceil = Math.ceil;
  463. var floor = Math.floor;
  464. var _toInteger = function (it) {
  465. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  466. };
  467. // 7.2.1 RequireObjectCoercible(argument)
  468. var _defined = function (it) {
  469. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  470. return it;
  471. };
  472. // true -> String#at
  473. // false -> String#codePointAt
  474. var _stringAt = function (TO_STRING) {
  475. return function (that, pos) {
  476. var s = String(_defined(that));
  477. var i = _toInteger(pos);
  478. var l = s.length;
  479. var a, b;
  480. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  481. a = s.charCodeAt(i);
  482. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  483. ? TO_STRING ? s.charAt(i) : a
  484. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  485. };
  486. };
  487. var $at = _stringAt(false);
  488. _export(_export.P, 'String', {
  489. // 21.1.3.3 String.prototype.codePointAt(pos)
  490. codePointAt: function codePointAt(pos) {
  491. return $at(this, pos);
  492. }
  493. });
  494. var codePointAt = _core.String.codePointAt;
  495. var max = Math.max;
  496. var min = Math.min;
  497. var _toAbsoluteIndex = function (index, length) {
  498. index = _toInteger(index);
  499. return index < 0 ? max(index + length, 0) : min(index, length);
  500. };
  501. var fromCharCode = String.fromCharCode;
  502. var $fromCodePoint = String.fromCodePoint;
  503. // length should be 1, old FF problem
  504. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  505. // 21.1.2.2 String.fromCodePoint(...codePoints)
  506. fromCodePoint: function fromCodePoint(x) {
  507. var arguments$1 = arguments;
  508. // eslint-disable-line no-unused-vars
  509. var res = [];
  510. var aLen = arguments.length;
  511. var i = 0;
  512. var code;
  513. while (aLen > i) {
  514. code = +arguments$1[i++];
  515. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  516. res.push(code < 0x10000
  517. ? fromCharCode(code)
  518. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  519. );
  520. } return res.join('');
  521. }
  522. });
  523. var fromCodePoint = _core.String.fromCodePoint;
  524. // This is a generated file. Do not edit.
  525. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  526. var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  527. var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  528. var unicode = {
  529. Space_Separator: Space_Separator,
  530. ID_Start: ID_Start,
  531. ID_Continue: ID_Continue
  532. };
  533. var util = {
  534. isSpaceSeparator: function isSpaceSeparator (c) {
  535. return typeof c === 'string' && unicode.Space_Separator.test(c)
  536. },
  537. isIdStartChar: function isIdStartChar (c) {
  538. return typeof c === 'string' && (
  539. (c >= 'a' && c <= 'z') ||
  540. (c >= 'A' && c <= 'Z') ||
  541. (c === '$') || (c === '_') ||
  542. unicode.ID_Start.test(c)
  543. )
  544. },
  545. isIdContinueChar: function isIdContinueChar (c) {
  546. return typeof c === 'string' && (
  547. (c >= 'a' && c <= 'z') ||
  548. (c >= 'A' && c <= 'Z') ||
  549. (c >= '0' && c <= '9') ||
  550. (c === '$') || (c === '_') ||
  551. (c === '\u200C') || (c === '\u200D') ||
  552. unicode.ID_Continue.test(c)
  553. )
  554. },
  555. isDigit: function isDigit (c) {
  556. return typeof c === 'string' && /[0-9]/.test(c)
  557. },
  558. isHexDigit: function isHexDigit (c) {
  559. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  560. },
  561. };
  562. var source;
  563. var parseState;
  564. var stack;
  565. var pos;
  566. var line;
  567. var column;
  568. var token;
  569. var key;
  570. var root;
  571. var parse = function parse (text, reviver) {
  572. source = String(text);
  573. parseState = 'start';
  574. stack = [];
  575. pos = 0;
  576. line = 1;
  577. column = 0;
  578. token = undefined;
  579. key = undefined;
  580. root = undefined;
  581. do {
  582. token = lex();
  583. // This code is unreachable.
  584. // if (!parseStates[parseState]) {
  585. // throw invalidParseState()
  586. // }
  587. parseStates[parseState]();
  588. } while (token.type !== 'eof')
  589. if (typeof reviver === 'function') {
  590. return internalize({'': root}, '', reviver)
  591. }
  592. return root
  593. };
  594. function internalize (holder, name, reviver) {
  595. var value = holder[name];
  596. if (value != null && typeof value === 'object') {
  597. for (var key in value) {
  598. var replacement = internalize(value, key, reviver);
  599. if (replacement === undefined) {
  600. delete value[key];
  601. } else {
  602. value[key] = replacement;
  603. }
  604. }
  605. }
  606. return reviver.call(holder, name, value)
  607. }
  608. var lexState;
  609. var buffer;
  610. var doubleQuote;
  611. var sign;
  612. var c;
  613. function lex () {
  614. lexState = 'default';
  615. buffer = '';
  616. doubleQuote = false;
  617. sign = 1;
  618. for (;;) {
  619. c = peek();
  620. // This code is unreachable.
  621. // if (!lexStates[lexState]) {
  622. // throw invalidLexState(lexState)
  623. // }
  624. var token = lexStates[lexState]();
  625. if (token) {
  626. return token
  627. }
  628. }
  629. }
  630. function peek () {
  631. if (source[pos]) {
  632. return String.fromCodePoint(source.codePointAt(pos))
  633. }
  634. }
  635. function read () {
  636. var c = peek();
  637. if (c === '\n') {
  638. line++;
  639. column = 0;
  640. } else if (c) {
  641. column += c.length;
  642. } else {
  643. column++;
  644. }
  645. if (c) {
  646. pos += c.length;
  647. }
  648. return c
  649. }
  650. var lexStates = {
  651. default: function default$1 () {
  652. switch (c) {
  653. case '\t':
  654. case '\v':
  655. case '\f':
  656. case ' ':
  657. case '\u00A0':
  658. case '\uFEFF':
  659. case '\n':
  660. case '\r':
  661. case '\u2028':
  662. case '\u2029':
  663. read();
  664. return
  665. case '/':
  666. read();
  667. lexState = 'comment';
  668. return
  669. case undefined:
  670. read();
  671. return newToken('eof')
  672. }
  673. if (util.isSpaceSeparator(c)) {
  674. read();
  675. return
  676. }
  677. // This code is unreachable.
  678. // if (!lexStates[parseState]) {
  679. // throw invalidLexState(parseState)
  680. // }
  681. return lexStates[parseState]()
  682. },
  683. comment: function comment () {
  684. switch (c) {
  685. case '*':
  686. read();
  687. lexState = 'multiLineComment';
  688. return
  689. case '/':
  690. read();
  691. lexState = 'singleLineComment';
  692. return
  693. }
  694. throw invalidChar(read())
  695. },
  696. multiLineComment: function multiLineComment () {
  697. switch (c) {
  698. case '*':
  699. read();
  700. lexState = 'multiLineCommentAsterisk';
  701. return
  702. case undefined:
  703. throw invalidChar(read())
  704. }
  705. read();
  706. },
  707. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  708. switch (c) {
  709. case '*':
  710. read();
  711. return
  712. case '/':
  713. read();
  714. lexState = 'default';
  715. return
  716. case undefined:
  717. throw invalidChar(read())
  718. }
  719. read();
  720. lexState = 'multiLineComment';
  721. },
  722. singleLineComment: function singleLineComment () {
  723. switch (c) {
  724. case '\n':
  725. case '\r':
  726. case '\u2028':
  727. case '\u2029':
  728. read();
  729. lexState = 'default';
  730. return
  731. case undefined:
  732. read();
  733. return newToken('eof')
  734. }
  735. read();
  736. },
  737. value: function value () {
  738. switch (c) {
  739. case '{':
  740. case '[':
  741. return newToken('punctuator', read())
  742. case 'n':
  743. read();
  744. literal('ull');
  745. return newToken('null', null)
  746. case 't':
  747. read();
  748. literal('rue');
  749. return newToken('boolean', true)
  750. case 'f':
  751. read();
  752. literal('alse');
  753. return newToken('boolean', false)
  754. case '-':
  755. case '+':
  756. if (read() === '-') {
  757. sign = -1;
  758. }
  759. lexState = 'sign';
  760. return
  761. case '.':
  762. buffer = read();
  763. lexState = 'decimalPointLeading';
  764. return
  765. case '0':
  766. buffer = read();
  767. lexState = 'zero';
  768. return
  769. case '1':
  770. case '2':
  771. case '3':
  772. case '4':
  773. case '5':
  774. case '6':
  775. case '7':
  776. case '8':
  777. case '9':
  778. buffer = read();
  779. lexState = 'decimalInteger';
  780. return
  781. case 'I':
  782. read();
  783. literal('nfinity');
  784. return newToken('numeric', Infinity)
  785. case 'N':
  786. read();
  787. literal('aN');
  788. return newToken('numeric', NaN)
  789. case '"':
  790. case "'":
  791. doubleQuote = (read() === '"');
  792. buffer = '';
  793. lexState = 'string';
  794. return
  795. }
  796. throw invalidChar(read())
  797. },
  798. identifierNameStartEscape: function identifierNameStartEscape () {
  799. if (c !== 'u') {
  800. throw invalidChar(read())
  801. }
  802. read();
  803. var u = unicodeEscape();
  804. switch (u) {
  805. case '$':
  806. case '_':
  807. break
  808. default:
  809. if (!util.isIdStartChar(u)) {
  810. throw invalidIdentifier()
  811. }
  812. break
  813. }
  814. buffer += u;
  815. lexState = 'identifierName';
  816. },
  817. identifierName: function identifierName () {
  818. switch (c) {
  819. case '$':
  820. case '_':
  821. case '\u200C':
  822. case '\u200D':
  823. buffer += read();
  824. return
  825. case '\\':
  826. read();
  827. lexState = 'identifierNameEscape';
  828. return
  829. }
  830. if (util.isIdContinueChar(c)) {
  831. buffer += read();
  832. return
  833. }
  834. return newToken('identifier', buffer)
  835. },
  836. identifierNameEscape: function identifierNameEscape () {
  837. if (c !== 'u') {
  838. throw invalidChar(read())
  839. }
  840. read();
  841. var u = unicodeEscape();
  842. switch (u) {
  843. case '$':
  844. case '_':
  845. case '\u200C':
  846. case '\u200D':
  847. break
  848. default:
  849. if (!util.isIdContinueChar(u)) {
  850. throw invalidIdentifier()
  851. }
  852. break
  853. }
  854. buffer += u;
  855. lexState = 'identifierName';
  856. },
  857. sign: function sign$1 () {
  858. switch (c) {
  859. case '.':
  860. buffer = read();
  861. lexState = 'decimalPointLeading';
  862. return
  863. case '0':
  864. buffer = read();
  865. lexState = 'zero';
  866. return
  867. case '1':
  868. case '2':
  869. case '3':
  870. case '4':
  871. case '5':
  872. case '6':
  873. case '7':
  874. case '8':
  875. case '9':
  876. buffer = read();
  877. lexState = 'decimalInteger';
  878. return
  879. case 'I':
  880. read();
  881. literal('nfinity');
  882. return newToken('numeric', sign * Infinity)
  883. case 'N':
  884. read();
  885. literal('aN');
  886. return newToken('numeric', NaN)
  887. }
  888. throw invalidChar(read())
  889. },
  890. zero: function zero () {
  891. switch (c) {
  892. case '.':
  893. buffer += read();
  894. lexState = 'decimalPoint';
  895. return
  896. case 'e':
  897. case 'E':
  898. buffer += read();
  899. lexState = 'decimalExponent';
  900. return
  901. case 'x':
  902. case 'X':
  903. buffer += read();
  904. lexState = 'hexadecimal';
  905. return
  906. }
  907. return newToken('numeric', sign * 0)
  908. },
  909. decimalInteger: function decimalInteger () {
  910. switch (c) {
  911. case '.':
  912. buffer += read();
  913. lexState = 'decimalPoint';
  914. return
  915. case 'e':
  916. case 'E':
  917. buffer += read();
  918. lexState = 'decimalExponent';
  919. return
  920. }
  921. if (util.isDigit(c)) {
  922. buffer += read();
  923. return
  924. }
  925. return newToken('numeric', sign * Number(buffer))
  926. },
  927. decimalPointLeading: function decimalPointLeading () {
  928. if (util.isDigit(c)) {
  929. buffer += read();
  930. lexState = 'decimalFraction';
  931. return
  932. }
  933. throw invalidChar(read())
  934. },
  935. decimalPoint: function decimalPoint () {
  936. switch (c) {
  937. case 'e':
  938. case 'E':
  939. buffer += read();
  940. lexState = 'decimalExponent';
  941. return
  942. }
  943. if (util.isDigit(c)) {
  944. buffer += read();
  945. lexState = 'decimalFraction';
  946. return
  947. }
  948. return newToken('numeric', sign * Number(buffer))
  949. },
  950. decimalFraction: function decimalFraction () {
  951. switch (c) {
  952. case 'e':
  953. case 'E':
  954. buffer += read();
  955. lexState = 'decimalExponent';
  956. return
  957. }
  958. if (util.isDigit(c)) {
  959. buffer += read();
  960. return
  961. }
  962. return newToken('numeric', sign * Number(buffer))
  963. },
  964. decimalExponent: function decimalExponent () {
  965. switch (c) {
  966. case '+':
  967. case '-':
  968. buffer += read();
  969. lexState = 'decimalExponentSign';
  970. return
  971. }
  972. if (util.isDigit(c)) {
  973. buffer += read();
  974. lexState = 'decimalExponentInteger';
  975. return
  976. }
  977. throw invalidChar(read())
  978. },
  979. decimalExponentSign: function decimalExponentSign () {
  980. if (util.isDigit(c)) {
  981. buffer += read();
  982. lexState = 'decimalExponentInteger';
  983. return
  984. }
  985. throw invalidChar(read())
  986. },
  987. decimalExponentInteger: function decimalExponentInteger () {
  988. if (util.isDigit(c)) {
  989. buffer += read();
  990. return
  991. }
  992. return newToken('numeric', sign * Number(buffer))
  993. },
  994. hexadecimal: function hexadecimal () {
  995. if (util.isHexDigit(c)) {
  996. buffer += read();
  997. lexState = 'hexadecimalInteger';
  998. return
  999. }
  1000. throw invalidChar(read())
  1001. },
  1002. hexadecimalInteger: function hexadecimalInteger () {
  1003. if (util.isHexDigit(c)) {
  1004. buffer += read();
  1005. return
  1006. }
  1007. return newToken('numeric', sign * Number(buffer))
  1008. },
  1009. string: function string () {
  1010. switch (c) {
  1011. case '\\':
  1012. read();
  1013. buffer += escape();
  1014. return
  1015. case '"':
  1016. if (doubleQuote) {
  1017. read();
  1018. return newToken('string', buffer)
  1019. }
  1020. buffer += read();
  1021. return
  1022. case "'":
  1023. if (!doubleQuote) {
  1024. read();
  1025. return newToken('string', buffer)
  1026. }
  1027. buffer += read();
  1028. return
  1029. case '\n':
  1030. case '\r':
  1031. throw invalidChar(read())
  1032. case '\u2028':
  1033. case '\u2029':
  1034. separatorChar(c);
  1035. break
  1036. case undefined:
  1037. throw invalidChar(read())
  1038. }
  1039. buffer += read();
  1040. },
  1041. start: function start () {
  1042. switch (c) {
  1043. case '{':
  1044. case '[':
  1045. return newToken('punctuator', read())
  1046. // This code is unreachable since the default lexState handles eof.
  1047. // case undefined:
  1048. // return newToken('eof')
  1049. }
  1050. lexState = 'value';
  1051. },
  1052. beforePropertyName: function beforePropertyName () {
  1053. switch (c) {
  1054. case '$':
  1055. case '_':
  1056. buffer = read();
  1057. lexState = 'identifierName';
  1058. return
  1059. case '\\':
  1060. read();
  1061. lexState = 'identifierNameStartEscape';
  1062. return
  1063. case '}':
  1064. return newToken('punctuator', read())
  1065. case '"':
  1066. case "'":
  1067. doubleQuote = (read() === '"');
  1068. lexState = 'string';
  1069. return
  1070. }
  1071. if (util.isIdStartChar(c)) {
  1072. buffer += read();
  1073. lexState = 'identifierName';
  1074. return
  1075. }
  1076. throw invalidChar(read())
  1077. },
  1078. afterPropertyName: function afterPropertyName () {
  1079. if (c === ':') {
  1080. return newToken('punctuator', read())
  1081. }
  1082. throw invalidChar(read())
  1083. },
  1084. beforePropertyValue: function beforePropertyValue () {
  1085. lexState = 'value';
  1086. },
  1087. afterPropertyValue: function afterPropertyValue () {
  1088. switch (c) {
  1089. case ',':
  1090. case '}':
  1091. return newToken('punctuator', read())
  1092. }
  1093. throw invalidChar(read())
  1094. },
  1095. beforeArrayValue: function beforeArrayValue () {
  1096. if (c === ']') {
  1097. return newToken('punctuator', read())
  1098. }
  1099. lexState = 'value';
  1100. },
  1101. afterArrayValue: function afterArrayValue () {
  1102. switch (c) {
  1103. case ',':
  1104. case ']':
  1105. return newToken('punctuator', read())
  1106. }
  1107. throw invalidChar(read())
  1108. },
  1109. end: function end () {
  1110. // This code is unreachable since it's handled by the default lexState.
  1111. // if (c === undefined) {
  1112. // read()
  1113. // return newToken('eof')
  1114. // }
  1115. throw invalidChar(read())
  1116. },
  1117. };
  1118. function newToken (type, value) {
  1119. return {
  1120. type: type,
  1121. value: value,
  1122. line: line,
  1123. column: column,
  1124. }
  1125. }
  1126. function literal (s) {
  1127. for (var i = 0, list = s; i < list.length; i += 1) {
  1128. var c = list[i];
  1129. var p = peek();
  1130. if (p !== c) {
  1131. throw invalidChar(read())
  1132. }
  1133. read();
  1134. }
  1135. }
  1136. function escape () {
  1137. var c = peek();
  1138. switch (c) {
  1139. case 'b':
  1140. read();
  1141. return '\b'
  1142. case 'f':
  1143. read();
  1144. return '\f'
  1145. case 'n':
  1146. read();
  1147. return '\n'
  1148. case 'r':
  1149. read();
  1150. return '\r'
  1151. case 't':
  1152. read();
  1153. return '\t'
  1154. case 'v':
  1155. read();
  1156. return '\v'
  1157. case '0':
  1158. read();
  1159. if (util.isDigit(peek())) {
  1160. throw invalidChar(read())
  1161. }
  1162. return '\0'
  1163. case 'x':
  1164. read();
  1165. return hexEscape()
  1166. case 'u':
  1167. read();
  1168. return unicodeEscape()
  1169. case '\n':
  1170. case '\u2028':
  1171. case '\u2029':
  1172. read();
  1173. return ''
  1174. case '\r':
  1175. read();
  1176. if (peek() === '\n') {
  1177. read();
  1178. }
  1179. return ''
  1180. case '1':
  1181. case '2':
  1182. case '3':
  1183. case '4':
  1184. case '5':
  1185. case '6':
  1186. case '7':
  1187. case '8':
  1188. case '9':
  1189. throw invalidChar(read())
  1190. case undefined:
  1191. throw invalidChar(read())
  1192. }
  1193. return read()
  1194. }
  1195. function hexEscape () {
  1196. var buffer = '';
  1197. var c = peek();
  1198. if (!util.isHexDigit(c)) {
  1199. throw invalidChar(read())
  1200. }
  1201. buffer += read();
  1202. c = peek();
  1203. if (!util.isHexDigit(c)) {
  1204. throw invalidChar(read())
  1205. }
  1206. buffer += read();
  1207. return String.fromCodePoint(parseInt(buffer, 16))
  1208. }
  1209. function unicodeEscape () {
  1210. var buffer = '';
  1211. var count = 4;
  1212. while (count-- > 0) {
  1213. var c = peek();
  1214. if (!util.isHexDigit(c)) {
  1215. throw invalidChar(read())
  1216. }
  1217. buffer += read();
  1218. }
  1219. return String.fromCodePoint(parseInt(buffer, 16))
  1220. }
  1221. var parseStates = {
  1222. start: function start () {
  1223. if (token.type === 'eof') {
  1224. throw invalidEOF()
  1225. }
  1226. push();
  1227. },
  1228. beforePropertyName: function beforePropertyName () {
  1229. switch (token.type) {
  1230. case 'identifier':
  1231. case 'string':
  1232. key = token.value;
  1233. parseState = 'afterPropertyName';
  1234. return
  1235. case 'punctuator':
  1236. // This code is unreachable since it's handled by the lexState.
  1237. // if (token.value !== '}') {
  1238. // throw invalidToken()
  1239. // }
  1240. pop();
  1241. return
  1242. case 'eof':
  1243. throw invalidEOF()
  1244. }
  1245. // This code is unreachable since it's handled by the lexState.
  1246. // throw invalidToken()
  1247. },
  1248. afterPropertyName: function afterPropertyName () {
  1249. // This code is unreachable since it's handled by the lexState.
  1250. // if (token.type !== 'punctuator' || token.value !== ':') {
  1251. // throw invalidToken()
  1252. // }
  1253. if (token.type === 'eof') {
  1254. throw invalidEOF()
  1255. }
  1256. parseState = 'beforePropertyValue';
  1257. },
  1258. beforePropertyValue: function beforePropertyValue () {
  1259. if (token.type === 'eof') {
  1260. throw invalidEOF()
  1261. }
  1262. push();
  1263. },
  1264. beforeArrayValue: function beforeArrayValue () {
  1265. if (token.type === 'eof') {
  1266. throw invalidEOF()
  1267. }
  1268. if (token.type === 'punctuator' && token.value === ']') {
  1269. pop();
  1270. return
  1271. }
  1272. push();
  1273. },
  1274. afterPropertyValue: function afterPropertyValue () {
  1275. // This code is unreachable since it's handled by the lexState.
  1276. // if (token.type !== 'punctuator') {
  1277. // throw invalidToken()
  1278. // }
  1279. if (token.type === 'eof') {
  1280. throw invalidEOF()
  1281. }
  1282. switch (token.value) {
  1283. case ',':
  1284. parseState = 'beforePropertyName';
  1285. return
  1286. case '}':
  1287. pop();
  1288. }
  1289. // This code is unreachable since it's handled by the lexState.
  1290. // throw invalidToken()
  1291. },
  1292. afterArrayValue: function afterArrayValue () {
  1293. // This code is unreachable since it's handled by the lexState.
  1294. // if (token.type !== 'punctuator') {
  1295. // throw invalidToken()
  1296. // }
  1297. if (token.type === 'eof') {
  1298. throw invalidEOF()
  1299. }
  1300. switch (token.value) {
  1301. case ',':
  1302. parseState = 'beforeArrayValue';
  1303. return
  1304. case ']':
  1305. pop();
  1306. }
  1307. // This code is unreachable since it's handled by the lexState.
  1308. // throw invalidToken()
  1309. },
  1310. end: function end () {
  1311. // This code is unreachable since it's handled by the lexState.
  1312. // if (token.type !== 'eof') {
  1313. // throw invalidToken()
  1314. // }
  1315. },
  1316. };
  1317. function push () {
  1318. var value;
  1319. switch (token.type) {
  1320. case 'punctuator':
  1321. switch (token.value) {
  1322. case '{':
  1323. value = {};
  1324. break
  1325. case '[':
  1326. value = [];
  1327. break
  1328. }
  1329. break
  1330. case 'null':
  1331. case 'boolean':
  1332. case 'numeric':
  1333. case 'string':
  1334. value = token.value;
  1335. break
  1336. // This code is unreachable.
  1337. // default:
  1338. // throw invalidToken()
  1339. }
  1340. if (root === undefined) {
  1341. root = value;
  1342. } else {
  1343. var parent = stack[stack.length - 1];
  1344. if (Array.isArray(parent)) {
  1345. parent.push(value);
  1346. } else {
  1347. parent[key] = value;
  1348. }
  1349. }
  1350. if (value !== null && typeof value === 'object') {
  1351. stack.push(value);
  1352. if (Array.isArray(value)) {
  1353. parseState = 'beforeArrayValue';
  1354. } else {
  1355. parseState = 'beforePropertyName';
  1356. }
  1357. } else {
  1358. var current = stack[stack.length - 1];
  1359. if (current == null) {
  1360. parseState = 'end';
  1361. } else if (Array.isArray(current)) {
  1362. parseState = 'afterArrayValue';
  1363. } else {
  1364. parseState = 'afterPropertyValue';
  1365. }
  1366. }
  1367. }
  1368. function pop () {
  1369. stack.pop();
  1370. var current = stack[stack.length - 1];
  1371. if (current == null) {
  1372. parseState = 'end';
  1373. } else if (Array.isArray(current)) {
  1374. parseState = 'afterArrayValue';
  1375. } else {
  1376. parseState = 'afterPropertyValue';
  1377. }
  1378. }
  1379. // This code is unreachable.
  1380. // function invalidParseState () {
  1381. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1382. // }
  1383. // This code is unreachable.
  1384. // function invalidLexState (state) {
  1385. // return new Error(`JSON5: invalid lex state '${state}'`)
  1386. // }
  1387. function invalidChar (c) {
  1388. if (c === undefined) {
  1389. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1390. }
  1391. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1392. }
  1393. function invalidEOF () {
  1394. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1395. }
  1396. // This code is unreachable.
  1397. // function invalidToken () {
  1398. // if (token.type === 'eof') {
  1399. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1400. // }
  1401. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1402. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1403. // }
  1404. function invalidIdentifier () {
  1405. column -= 5;
  1406. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1407. }
  1408. function separatorChar (c) {
  1409. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1410. }
  1411. function formatChar (c) {
  1412. var replacements = {
  1413. "'": "\\'",
  1414. '"': '\\"',
  1415. '\\': '\\\\',
  1416. '\b': '\\b',
  1417. '\f': '\\f',
  1418. '\n': '\\n',
  1419. '\r': '\\r',
  1420. '\t': '\\t',
  1421. '\v': '\\v',
  1422. '\0': '\\0',
  1423. '\u2028': '\\u2028',
  1424. '\u2029': '\\u2029',
  1425. };
  1426. if (replacements[c]) {
  1427. return replacements[c]
  1428. }
  1429. if (c < ' ') {
  1430. var hexString = c.charCodeAt(0).toString(16);
  1431. return '\\x' + ('00' + hexString).substring(hexString.length)
  1432. }
  1433. return c
  1434. }
  1435. function syntaxError (message) {
  1436. var err = new SyntaxError(message);
  1437. err.lineNumber = line;
  1438. err.columnNumber = column;
  1439. return err
  1440. }
  1441. var stringify = function stringify (value, replacer, space) {
  1442. var stack = [];
  1443. var indent = '';
  1444. var propertyList;
  1445. var replacerFunc;
  1446. var gap = '';
  1447. var quote;
  1448. if (
  1449. replacer != null &&
  1450. typeof replacer === 'object' &&
  1451. !Array.isArray(replacer)
  1452. ) {
  1453. space = replacer.space;
  1454. quote = replacer.quote;
  1455. replacer = replacer.replacer;
  1456. }
  1457. if (typeof replacer === 'function') {
  1458. replacerFunc = replacer;
  1459. } else if (Array.isArray(replacer)) {
  1460. propertyList = [];
  1461. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1462. var v = list[i];
  1463. var item = (void 0);
  1464. if (typeof v === 'string') {
  1465. item = v;
  1466. } else if (
  1467. typeof v === 'number' ||
  1468. v instanceof String ||
  1469. v instanceof Number
  1470. ) {
  1471. item = String(v);
  1472. }
  1473. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1474. propertyList.push(item);
  1475. }
  1476. }
  1477. }
  1478. if (space instanceof Number) {
  1479. space = Number(space);
  1480. } else if (space instanceof String) {
  1481. space = String(space);
  1482. }
  1483. if (typeof space === 'number') {
  1484. if (space > 0) {
  1485. space = Math.min(10, Math.floor(space));
  1486. gap = ' '.substr(0, space);
  1487. }
  1488. } else if (typeof space === 'string') {
  1489. gap = space.substr(0, 10);
  1490. }
  1491. return serializeProperty('', {'': value})
  1492. function serializeProperty (key, holder) {
  1493. var value = holder[key];
  1494. if (value != null) {
  1495. if (typeof value.toJSON5 === 'function') {
  1496. value = value.toJSON5(key);
  1497. } else if (typeof value.toJSON === 'function') {
  1498. value = value.toJSON(key);
  1499. }
  1500. }
  1501. if (replacerFunc) {
  1502. value = replacerFunc.call(holder, key, value);
  1503. }
  1504. if (value instanceof Number) {
  1505. value = Number(value);
  1506. } else if (value instanceof String) {
  1507. value = String(value);
  1508. } else if (value instanceof Boolean) {
  1509. value = value.valueOf();
  1510. }
  1511. switch (value) {
  1512. case null: return 'null'
  1513. case true: return 'true'
  1514. case false: return 'false'
  1515. }
  1516. if (typeof value === 'string') {
  1517. return quoteString(value)
  1518. }
  1519. if (typeof value === 'number') {
  1520. return String(value)
  1521. }
  1522. if (typeof value === 'object') {
  1523. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1524. }
  1525. return undefined
  1526. }
  1527. function quoteString (value) {
  1528. var quotes = {
  1529. "'": 0.1,
  1530. '"': 0.2,
  1531. };
  1532. var replacements = {
  1533. "'": "\\'",
  1534. '"': '\\"',
  1535. '\\': '\\\\',
  1536. '\b': '\\b',
  1537. '\f': '\\f',
  1538. '\n': '\\n',
  1539. '\r': '\\r',
  1540. '\t': '\\t',
  1541. '\v': '\\v',
  1542. '\0': '\\0',
  1543. '\u2028': '\\u2028',
  1544. '\u2029': '\\u2029',
  1545. };
  1546. var product = '';
  1547. for (var i = 0; i < value.length; i++) {
  1548. var c = value[i];
  1549. switch (c) {
  1550. case "'":
  1551. case '"':
  1552. quotes[c]++;
  1553. product += c;
  1554. continue
  1555. case '\0':
  1556. if (util.isDigit(value[i + 1])) {
  1557. product += '\\x00';
  1558. continue
  1559. }
  1560. }
  1561. if (replacements[c]) {
  1562. product += replacements[c];
  1563. continue
  1564. }
  1565. if (c < ' ') {
  1566. var hexString = c.charCodeAt(0).toString(16);
  1567. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1568. continue
  1569. }
  1570. product += c;
  1571. }
  1572. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1573. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1574. return quoteChar + product + quoteChar
  1575. }
  1576. function serializeObject (value) {
  1577. if (stack.indexOf(value) >= 0) {
  1578. throw TypeError('Converting circular structure to JSON5')
  1579. }
  1580. stack.push(value);
  1581. var stepback = indent;
  1582. indent = indent + gap;
  1583. var keys = propertyList || Object.keys(value);
  1584. var partial = [];
  1585. for (var i = 0, list = keys; i < list.length; i += 1) {
  1586. var key = list[i];
  1587. var propertyString = serializeProperty(key, value);
  1588. if (propertyString !== undefined) {
  1589. var member = serializeKey(key) + ':';
  1590. if (gap !== '') {
  1591. member += ' ';
  1592. }
  1593. member += propertyString;
  1594. partial.push(member);
  1595. }
  1596. }
  1597. var final;
  1598. if (partial.length === 0) {
  1599. final = '{}';
  1600. } else {
  1601. var properties;
  1602. if (gap === '') {
  1603. properties = partial.join(',');
  1604. final = '{' + properties + '}';
  1605. } else {
  1606. var separator = ',\n' + indent;
  1607. properties = partial.join(separator);
  1608. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1609. }
  1610. }
  1611. stack.pop();
  1612. indent = stepback;
  1613. return final
  1614. }
  1615. function serializeKey (key) {
  1616. if (key.length === 0) {
  1617. return quoteString(key)
  1618. }
  1619. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1620. if (!util.isIdStartChar(firstChar)) {
  1621. return quoteString(key)
  1622. }
  1623. for (var i = firstChar.length; i < key.length; i++) {
  1624. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1625. return quoteString(key)
  1626. }
  1627. }
  1628. return key
  1629. }
  1630. function serializeArray (value) {
  1631. if (stack.indexOf(value) >= 0) {
  1632. throw TypeError('Converting circular structure to JSON5')
  1633. }
  1634. stack.push(value);
  1635. var stepback = indent;
  1636. indent = indent + gap;
  1637. var partial = [];
  1638. for (var i = 0; i < value.length; i++) {
  1639. var propertyString = serializeProperty(String(i), value);
  1640. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1641. }
  1642. var final;
  1643. if (partial.length === 0) {
  1644. final = '[]';
  1645. } else {
  1646. if (gap === '') {
  1647. var properties = partial.join(',');
  1648. final = '[' + properties + ']';
  1649. } else {
  1650. var separator = ',\n' + indent;
  1651. var properties$1 = partial.join(separator);
  1652. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1653. }
  1654. }
  1655. stack.pop();
  1656. indent = stepback;
  1657. return final
  1658. }
  1659. };
  1660. var JSON5 = {
  1661. parse: parse,
  1662. stringify: stringify,
  1663. };
  1664. var lib = JSON5;
  1665. var es5 = lib;
  1666. return es5;
  1667. })));
  1668. });
  1669. /*! *****************************************************************************
  1670. Copyright (c) Microsoft Corporation.
  1671. Permission to use, copy, modify, and/or distribute this software for any
  1672. purpose with or without fee is hereby granted.
  1673. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1674. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1675. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1676. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1677. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1678. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1679. PERFORMANCE OF THIS SOFTWARE.
  1680. ***************************************************************************** */
  1681. /* global Reflect, Promise */
  1682. var extendStatics = function(d, b) {
  1683. extendStatics = Object.setPrototypeOf ||
  1684. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1685. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1686. return extendStatics(d, b);
  1687. };
  1688. function __extends(d, b) {
  1689. extendStatics(d, b);
  1690. function __() { this.constructor = d; }
  1691. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1692. }
  1693. var __assign = function() {
  1694. __assign = Object.assign || function __assign(t) {
  1695. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1696. s = arguments[i];
  1697. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1698. }
  1699. return t;
  1700. };
  1701. return __assign.apply(this, arguments);
  1702. };
  1703. function __decorate(decorators, target, key, desc) {
  1704. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1705. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1706. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  1707. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1708. }
  1709. function __param(paramIndex, decorator) {
  1710. return function (target, key) { decorator(target, key, paramIndex); }
  1711. }
  1712. function __metadata(metadataKey, metadataValue) {
  1713. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1714. }
  1715. function __values(o) {
  1716. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1717. if (m) return m.call(o);
  1718. if (o && typeof o.length === "number") return {
  1719. next: function () {
  1720. if (o && i >= o.length) o = void 0;
  1721. return { value: o && o[i++], done: !o };
  1722. }
  1723. };
  1724. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1725. }
  1726. function __read(o, n) {
  1727. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1728. if (!m) return o;
  1729. var i = m.call(o), r, ar = [], e;
  1730. try {
  1731. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1732. }
  1733. catch (error) { e = { error: error }; }
  1734. finally {
  1735. try {
  1736. if (r && !r.done && (m = i["return"])) m.call(i);
  1737. }
  1738. finally { if (e) throw e.error; }
  1739. }
  1740. return ar;
  1741. }
  1742. function __spread() {
  1743. for (var ar = [], i = 0; i < arguments.length; i++)
  1744. ar = ar.concat(__read(arguments[i]));
  1745. return ar;
  1746. }
  1747. var PropertyDescription = /** @class */ (function () {
  1748. function PropertyDescription() {
  1749. var _this = this;
  1750. var args = [];
  1751. for (var _i = 0; _i < arguments.length; _i++) {
  1752. args[_i] = arguments[_i];
  1753. }
  1754. this.propertyes = {
  1755. props: [],
  1756. events: []
  1757. };
  1758. _$2.each(args, function (arg) {
  1759. _this.merge(arg);
  1760. });
  1761. }
  1762. PropertyDescription.prototype.merge = function (pd) {
  1763. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1764. if (pd.events) {
  1765. if (this.propertyes.events) {
  1766. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1767. }
  1768. else {
  1769. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1770. }
  1771. }
  1772. };
  1773. /**
  1774. * 根据分组名 获取属性定义
  1775. */
  1776. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1777. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1778. };
  1779. /**
  1780. * 获取全部事件
  1781. */
  1782. PropertyDescription.prototype.getEvents = function () {
  1783. return this.propertyes.events;
  1784. };
  1785. return PropertyDescription;
  1786. }());
  1787. //# sourceMappingURL=PropertyDescription.js.map
  1788. var PropertyDescriptionTable = new Map();
  1789. var width = {
  1790. name: 'width',
  1791. default: '',
  1792. group: 'common',
  1793. desc: '宽',
  1794. type: 'string'
  1795. };
  1796. var height = {
  1797. name: 'height',
  1798. default: '',
  1799. group: 'common',
  1800. desc: '高',
  1801. type: 'string'
  1802. };
  1803. var fieldLabel = {
  1804. name: 'fieldLabel',
  1805. default: '',
  1806. group: 'common',
  1807. desc: '文本描述',
  1808. type: 'string',
  1809. expr: true,
  1810. };
  1811. var text$1 = {
  1812. name: 'text',
  1813. default: '',
  1814. group: 'common',
  1815. desc: '文本描述',
  1816. type: 'string',
  1817. expr: true,
  1818. };
  1819. var iconCls = {
  1820. name: 'iconCls',
  1821. default: '',
  1822. group: 'common',
  1823. desc: '图标',
  1824. type: 'string',
  1825. expr: true,
  1826. };
  1827. var disabled = {
  1828. name: 'disabled',
  1829. default: false,
  1830. group: 'common',
  1831. desc: '禁用',
  1832. type: 'boolean',
  1833. expr: true,
  1834. };
  1835. var value = {
  1836. name: 'value',
  1837. default: '',
  1838. group: 'common',
  1839. desc: '字段值',
  1840. type: 'string',
  1841. expr: true,
  1842. };
  1843. var template = {
  1844. name: 'template',
  1845. default: '',
  1846. group: 'common',
  1847. desc: 'HTML内容',
  1848. type: 'string',
  1849. expr: true,
  1850. };
  1851. var reference = {
  1852. name: 'reference',
  1853. default: '',
  1854. group: 'common',
  1855. desc: '组件句柄',
  1856. type: 'string',
  1857. expr: true,
  1858. };
  1859. var tooltip = {
  1860. name: 'tooltip',
  1861. default: '',
  1862. group: 'common',
  1863. desc: '悬停提示',
  1864. type: 'string'
  1865. };
  1866. // =============事件 ==============
  1867. var click = {
  1868. name: 'click',
  1869. default: '',
  1870. group: 'listeners',
  1871. desc: '点击事件',
  1872. eventParamter: [
  1873. 'sender',
  1874. 'e: any'
  1875. ],
  1876. type: 'listeners'
  1877. };
  1878. var change = {
  1879. name: 'change',
  1880. default: '',
  1881. group: 'listeners',
  1882. desc: 'value change事件',
  1883. eventParamter: [
  1884. 'sender',
  1885. 'e: any'
  1886. ],
  1887. type: 'listeners'
  1888. };
  1889. var keyup = {
  1890. name: 'keyup',
  1891. default: '',
  1892. group: 'listeners',
  1893. desc: '键盘按键抬起事件',
  1894. eventParamter: [
  1895. 'sender',
  1896. 'e'
  1897. ],
  1898. type: 'listeners'
  1899. };
  1900. var afterrender = {
  1901. name: 'afterrender',
  1902. default: '',
  1903. group: 'listeners',
  1904. desc: '控件渲染后触发',
  1905. eventParamter: [
  1906. 'sender',
  1907. 'e'
  1908. ],
  1909. type: 'listeners'
  1910. };
  1911. // =============特性 ==============
  1912. var fix = {
  1913. name: 'fix',
  1914. default: '',
  1915. group: 'fix',
  1916. desc: '特性',
  1917. type: 'fix',
  1918. expr: true,
  1919. };
  1920. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1921. props: [
  1922. height
  1923. ]
  1924. }));
  1925. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1926. props: [
  1927. {
  1928. name: 'borderless',
  1929. default: true,
  1930. group: 'css',
  1931. desc: '有无边框',
  1932. type: 'boolean'
  1933. },
  1934. {
  1935. name: 'type',
  1936. default: '',
  1937. group: 'css',
  1938. desc: '布局类型',
  1939. type: ['line', 'clean', 'wide', 'space', 'form']
  1940. },
  1941. {
  1942. name: '_designMode',
  1943. default: 'module',
  1944. group: 'common',
  1945. desc: '设计类型',
  1946. type: ['none', 'module', 'scroll-module']
  1947. }
  1948. ]
  1949. }));
  1950. var YvBase = {
  1951. props: [
  1952. width, height, reference, afterrender, fix
  1953. ],
  1954. events: [
  1955. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1956. ]
  1957. };
  1958. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1959. props: [
  1960. template
  1961. ]
  1962. }));
  1963. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1964. props: [
  1965. {
  1966. name: 'label',
  1967. default: '',
  1968. group: 'common',
  1969. desc: '字段组标题',
  1970. type: 'string'
  1971. }
  1972. ]
  1973. }));
  1974. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1975. props: [
  1976. {
  1977. name: 'src',
  1978. default: '',
  1979. group: 'common',
  1980. desc: '地址路径',
  1981. type: 'string'
  1982. }
  1983. ]
  1984. }));
  1985. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1986. props: [
  1987. width, height,
  1988. {
  1989. name: 'value',
  1990. default: '上传',
  1991. group: 'common',
  1992. desc: '文本描述',
  1993. type: 'string'
  1994. },
  1995. {
  1996. name: 'upload',
  1997. default: '/upload',
  1998. group: 'common',
  1999. desc: '上传地址',
  2000. type: 'string'
  2001. },
  2002. ],
  2003. events: [
  2004. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2005. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2006. ]
  2007. }));
  2008. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2009. props: [
  2010. value,
  2011. {
  2012. name: 'imgWidth',
  2013. default: '',
  2014. group: 'common',
  2015. desc: '图片宽',
  2016. type: 'string'
  2017. },
  2018. {
  2019. name: 'imgHeight',
  2020. default: '',
  2021. group: 'common',
  2022. desc: '图片高',
  2023. type: 'string'
  2024. }
  2025. ]
  2026. }));
  2027. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2028. props: [
  2029. value,
  2030. {
  2031. name: 'imgWidth',
  2032. default: '',
  2033. group: 'common',
  2034. desc: '图片宽',
  2035. type: 'string'
  2036. },
  2037. {
  2038. name: 'imgHeight',
  2039. default: '',
  2040. group: 'common',
  2041. desc: '图片高',
  2042. type: 'string'
  2043. }
  2044. ]
  2045. }));
  2046. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2047. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2048. }));
  2049. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2050. props: [
  2051. fieldLabel, value, disabled,
  2052. tooltip, width, height
  2053. ],
  2054. }));
  2055. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2056. props: [
  2057. fieldLabel, value, disabled,
  2058. tooltip, width, height, keyup, afterrender, change
  2059. ],
  2060. }));
  2061. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2062. props: [
  2063. fieldLabel, value, disabled,
  2064. tooltip, width, height, keyup, afterrender, change
  2065. ],
  2066. }));
  2067. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2068. props: [
  2069. fieldLabel, value, disabled,
  2070. tooltip, width, height, keyup, afterrender, change
  2071. ],
  2072. }));
  2073. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2074. props: [
  2075. fieldLabel, value, disabled,
  2076. tooltip, width, height, keyup, afterrender, change
  2077. ],
  2078. }));
  2079. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2080. props: [
  2081. fieldLabel, value, disabled,
  2082. tooltip, width, height, keyup, afterrender, change
  2083. ],
  2084. }));
  2085. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2086. props: [
  2087. fieldLabel, value, disabled,
  2088. tooltip, width, height, keyup, afterrender, change
  2089. ],
  2090. }));
  2091. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2092. props: [
  2093. fieldLabel, value, disabled,
  2094. tooltip, width, height, keyup, afterrender, change
  2095. ],
  2096. }));
  2097. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2098. props: [
  2099. fieldLabel, value, disabled,
  2100. tooltip, width, height, keyup, afterrender, change
  2101. ],
  2102. }));
  2103. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2104. props: [
  2105. fieldLabel, value, disabled,
  2106. tooltip, width, height
  2107. ],
  2108. }));
  2109. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2110. props: [
  2111. fieldLabel, value, disabled,
  2112. tooltip, width, height, keyup, afterrender, change
  2113. ],
  2114. }));
  2115. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2116. props: [
  2117. fieldLabel, value, disabled,
  2118. tooltip, width, height, keyup, afterrender, change
  2119. ],
  2120. }));
  2121. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2122. props: [
  2123. fieldLabel, value, disabled,
  2124. tooltip, width, height, keyup, afterrender, change
  2125. ],
  2126. }));
  2127. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2128. props: [
  2129. fieldLabel, value, disabled,
  2130. tooltip, width, height, afterrender, change
  2131. ],
  2132. }));
  2133. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2134. /**
  2135. * 弹出输入框,输入文字
  2136. * @param message 提示文字
  2137. * @param defaultValue 默认值
  2138. * @param multiLine 是否多行输入
  2139. */
  2140. function prompt$1(message, defaultValue, multiLine) {
  2141. if (defaultValue === void 0) { defaultValue = ""; }
  2142. if (multiLine === void 0) { multiLine = false; }
  2143. return new Promise(function (resolve) {
  2144. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2145. if (button === 'ok') {
  2146. resolve(value);
  2147. }
  2148. }, null, multiLine, defaultValue);
  2149. });
  2150. }
  2151. /**
  2152. * 显示错误异常信息
  2153. * @param msg 错误内容
  2154. * @param sender 发送者按钮(可以为空)
  2155. */
  2156. function showErrorDialog(msg, sender) {
  2157. console.error(msg);
  2158. Ext.MessageBox.show({
  2159. title: '错误',
  2160. msg: msg,
  2161. buttons: Ext.MessageBox.OK,
  2162. animateTarget: sender,
  2163. icon: 'error',
  2164. cls: 'show-icon-messagebox',
  2165. });
  2166. }
  2167. /**
  2168. * 显示错误异常信息
  2169. * @param msg 错误内容
  2170. * @param sender 发送者按钮(可以为空)
  2171. */
  2172. function showInfoDialogSimple(msg, sender) {
  2173. console.info(msg);
  2174. Ext.MessageBox.show({
  2175. title: '提示',
  2176. msg: msg,
  2177. buttons: Ext.MessageBox.OK,
  2178. animateTarget: sender,
  2179. icon: 'info',
  2180. cls: 'show-icon-messagebox',
  2181. });
  2182. }
  2183. function msgError(msg, sender) {
  2184. showErrorDialog(msg, sender);
  2185. }
  2186. /**
  2187. * 中间灰底白字提示
  2188. */
  2189. function msg(message) {
  2190. console.log(message);
  2191. var $body = $$2('body');
  2192. $body.find('[xtype=tooltip]').remove();
  2193. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2194. ' <div class="yvan-msg-content">' +
  2195. _$2.escape(message) +
  2196. '</div></div>');
  2197. $body.append($w);
  2198. var iframeWidth = $w.parent().width();
  2199. var iframeHeight = $w.parent().height();
  2200. var windowWidth = $w.width();
  2201. var windowHeight = $w.height();
  2202. var setWidth = (iframeWidth - windowWidth) / 2;
  2203. var setHeight = (iframeHeight - windowHeight) / 2;
  2204. if (iframeHeight < windowHeight || setHeight < 0) {
  2205. setHeight = 0;
  2206. }
  2207. if (iframeWidth < windowWidth || setWidth < 0) {
  2208. setWidth = 0;
  2209. }
  2210. $w.css({ left: setWidth, top: setHeight });
  2211. setTimeout(function () {
  2212. $w.remove();
  2213. }, 3000);
  2214. }
  2215. //# sourceMappingURL=message.js.map
  2216. localforage.config({
  2217. name: "studio",
  2218. storeName: "item",
  2219. });
  2220. function getItem(key, callback) {
  2221. localforage.getItem(key).then(function (value) {
  2222. if (callback) {
  2223. callback(value);
  2224. }
  2225. });
  2226. }
  2227. function setItem(key, value, callback) {
  2228. localforage.setItem(key, value).then(function (val) {
  2229. if (callback) {
  2230. callback();
  2231. }
  2232. });
  2233. }
  2234. var native = {
  2235. /**
  2236. * 读取文件
  2237. */
  2238. loadFile: function (fileName, callback) {
  2239. console.log('loadFile', fileName);
  2240. getItem('NATIVE_' + fileName, callback);
  2241. },
  2242. /**
  2243. * 保存文件
  2244. */
  2245. saveFile: function (fileName, content) {
  2246. console.log('saveFile', fileName, content);
  2247. setItem('NATIVE_' + fileName, content);
  2248. },
  2249. openInIdea: function (path) {
  2250. msg(path);
  2251. },
  2252. /**
  2253. * 初始化 native 工具类
  2254. */
  2255. init: function () {
  2256. var ClipboardJS = window['ClipboardJS'];
  2257. if (!ClipboardJS) {
  2258. msg('没有引入 ClipboardJS');
  2259. return;
  2260. }
  2261. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2262. var clipboard = new ClipboardJS('.__btnClipboard');
  2263. },
  2264. /**
  2265. * 设置剪切板
  2266. */
  2267. clipboardSet: function (c) {
  2268. var $btn = $('.__btnClipboard');
  2269. $btn.attr('data-clipboard-text', c);
  2270. $btn.trigger("click");
  2271. },
  2272. };
  2273. /**
  2274. * 判断变量是否有值 value === null || value === undefined
  2275. * @param value 目标变量
  2276. */
  2277. var noValue = function (value) {
  2278. return value === null || value === undefined;
  2279. };
  2280. //# sourceMappingURL=Utils.js.map
  2281. function initStateTree () {
  2282. Ext.define('com.yvan.studio.StateTree', {
  2283. extend: 'Ext.tree.Panel',
  2284. _saveStateFlag: true,
  2285. _filterText: '',
  2286. fbar: [
  2287. {
  2288. xtype: 'textfield',
  2289. flex: 1,
  2290. emptyText: '搜索过滤',
  2291. enableKeyEvents: true,
  2292. listeners: {
  2293. change: function (sender) {
  2294. var tree = sender.up("treepanel");
  2295. tree.filterByText(this.getRawValue());
  2296. },
  2297. keyup: function (sender, e) {
  2298. var tree = sender.up("treepanel");
  2299. if (e.ESC === e.getKey()) {
  2300. sender.setValue('');
  2301. tree.filterByText('');
  2302. }
  2303. }
  2304. }
  2305. },
  2306. ],
  2307. getStateFilename: function () {
  2308. throw Error('没有实现这个函数');
  2309. },
  2310. initComponent: function () {
  2311. var me = this;
  2312. this.on({
  2313. afterrender: function () {
  2314. var _this = this;
  2315. // 回车后打开节点
  2316. $(me.el.dom).keydown(function (event) {
  2317. if (event.keyCode === 13) {
  2318. event.preventDefault();
  2319. _this.fireEvent('itemverify');
  2320. return;
  2321. }
  2322. });
  2323. },
  2324. afteritemexpand: {
  2325. fn: function (node, index, item, eOpts) {
  2326. this.saveState();
  2327. },
  2328. buffer: 100,
  2329. },
  2330. afteritemcollapse: {
  2331. fn: function (node, index, item, eOpts) {
  2332. this.saveState();
  2333. },
  2334. buffer: 100,
  2335. },
  2336. itemdblclick: function (sender, record) {
  2337. this.fireEvent('itemverify');
  2338. },
  2339. itemclick: {
  2340. fn: function (node, index, item, eOpts) {
  2341. this.saveState();
  2342. },
  2343. buffer: 100,
  2344. }
  2345. });
  2346. this.superclass.superclass.initComponent.apply(this, arguments);
  2347. },
  2348. restoreState: function () {
  2349. var _this = this;
  2350. native.loadFile(this.getStateFilename(), function (content) {
  2351. if (!content)
  2352. return;
  2353. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2354. _this._saveStateFlag = false;
  2355. if (_.isArray(expands)) {
  2356. _.forEach(expands, function (p) {
  2357. _this.expandPath(p);
  2358. });
  2359. }
  2360. if (_.isArray(selections) && selections[0]) {
  2361. try {
  2362. _this.selectPath(selections[0]);
  2363. }
  2364. catch (e) {
  2365. }
  2366. }
  2367. if (scrollPosition && scrollSize) {
  2368. var size = _this.scrollable.getSize();
  2369. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2370. try {
  2371. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2372. }
  2373. catch (e) {
  2374. }
  2375. }
  2376. }
  2377. setTimeout(function () {
  2378. _this._saveStateFlag = true;
  2379. }, 200);
  2380. });
  2381. },
  2382. saveState: function () {
  2383. if (!this._saveStateFlag) {
  2384. return;
  2385. }
  2386. if (this._filterText) {
  2387. // 有筛选,不保存展开状态
  2388. return;
  2389. }
  2390. var expands = [];
  2391. var selections = [];
  2392. var selection = this.getSelection();
  2393. _.forEach(selection, function (item) {
  2394. selections.push(item.getPath());
  2395. });
  2396. var data = this.getStore().data;
  2397. _.forEach(data.items, function (item) {
  2398. if (item.data.expanded === true) {
  2399. expands.push(item.getPath());
  2400. }
  2401. });
  2402. var scrollPosition = this.scrollable.position;
  2403. var scrollSize = this.scrollable.getSize();
  2404. native.saveFile(this.getStateFilename(), {
  2405. selections: selections,
  2406. expands: expands,
  2407. scrollPosition: scrollPosition,
  2408. scrollSize: scrollSize
  2409. });
  2410. },
  2411. filterByText: function (text) {
  2412. this._filterText = text;
  2413. this._filterBy(this, text, 'text');
  2414. },
  2415. _filterBy: _.debounce(function (me, text, by) {
  2416. var view = me.getView();
  2417. me.store.clearFilter();
  2418. if (!me._filterText) {
  2419. // 没有筛选内容,还原状态
  2420. var selections = me.getSelection();
  2421. var selectionPaths_1 = [];
  2422. _.forEach(me.getSelection(), function (item) {
  2423. selectionPaths_1.push(item.getPath());
  2424. });
  2425. me.collapseAll();
  2426. me.restoreState();
  2427. _.forEach(selectionPaths_1, function (path) {
  2428. me.expandPath(path);
  2429. });
  2430. me.setSelection(selections);
  2431. return;
  2432. }
  2433. // 递归查找所有需要可见的节点 id 数组
  2434. var nodesAndParents = [];
  2435. var expandPaths = [];
  2436. me.getRootNode().cascadeBy(function (tree, view) {
  2437. var currNode = this;
  2438. currNode.collapse();
  2439. if (currNode && currNode.data[by] &&
  2440. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2441. // 展开到匹配的路径
  2442. // me.expandPath(currNode.getPath());
  2443. expandPaths.push(currNode.getPath());
  2444. // 沿途父节点全部设定为可见
  2445. while (currNode.parentNode) {
  2446. nodesAndParents.push(currNode.id);
  2447. currNode = currNode.parentNode;
  2448. }
  2449. }
  2450. }, null, [me, view]);
  2451. me.store.filterBy(function (r) {
  2452. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2453. });
  2454. _.forEach(expandPaths, function (path) {
  2455. me.expandPath(path);
  2456. });
  2457. }, 1000),
  2458. });
  2459. }
  2460. //# sourceMappingURL=StateTree.js.map
  2461. function initDashboard () {
  2462. Ext.define('com.yvan.studio.Dashboard', {
  2463. extend: 'Ext.panel.Panel',
  2464. alias: 'widget.dashboard',
  2465. xtype: 'dashboard',
  2466. html: ''
  2467. });
  2468. }
  2469. //# sourceMappingURL=dashboard.js.map
  2470. var handles$1 = {
  2471. mainWindow: undefined,
  2472. fileTree: undefined,
  2473. dbTree: undefined,
  2474. viewoutlinetree: undefined,
  2475. statusbar: undefined,
  2476. dictTree: undefined,
  2477. property: undefined,
  2478. dbcode: undefined,
  2479. report: undefined,
  2480. widget: undefined,
  2481. whLayout: undefined,
  2482. };
  2483. window['handles'] = handles$1;
  2484. function setDictTree(value) {
  2485. handles$1.dictTree = value;
  2486. }
  2487. function setMainWindow(value) {
  2488. handles$1.mainWindow = value;
  2489. }
  2490. function setReport(value) {
  2491. handles$1.report = value;
  2492. }
  2493. function setStatusbar(statusbar) {
  2494. handles$1.statusbar = statusbar;
  2495. }
  2496. function setFileTree(value) {
  2497. handles$1.fileTree = value;
  2498. }
  2499. function setDbTree(value) {
  2500. handles$1.dbTree = value;
  2501. }
  2502. function setWidget(value) {
  2503. handles$1.widget = value;
  2504. }
  2505. function setWhLayout(value) {
  2506. handles$1.whLayout = value;
  2507. }
  2508. function setViewoutlinetree(value) {
  2509. handles$1.viewoutlinetree = value;
  2510. }
  2511. function setPropertyPanel(value) {
  2512. handles$1.property = value;
  2513. }
  2514. function setDbCode(value) {
  2515. handles$1.dbcode = value;
  2516. }
  2517. //# sourceMappingURL=Handles.js.map
  2518. /**
  2519. * 获取当前打开的项目资料
  2520. */
  2521. function getCurrentProject() {
  2522. // const value = sessionStorage.getItem('CurrentProject');
  2523. // if (value) {
  2524. // project = JSON.parse(value)
  2525. // if (!project.url) {
  2526. // project = undefined
  2527. // }
  2528. // }
  2529. // return project
  2530. return {
  2531. uuid: '00000000',
  2532. name: '本服项目',
  2533. url: '',
  2534. };
  2535. }
  2536. /**
  2537. * 设置当前打开的项目资料(全局)
  2538. */
  2539. function setCurrentProject(value) {
  2540. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  2541. }
  2542. //# sourceMappingURL=Project.js.map
  2543. var CacheStore = /** @class */ (function () {
  2544. function CacheStore() {
  2545. // 订阅
  2546. this.subscribeList = [];
  2547. this.apiResponse = undefined;
  2548. }
  2549. /**
  2550. * 订阅结果集
  2551. */
  2552. CacheStore.prototype.registe = function (fn) {
  2553. this.subscribeList.push(fn);
  2554. };
  2555. /**
  2556. * 取消订阅
  2557. */
  2558. CacheStore.prototype.unregiste = function (fn) {
  2559. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  2560. };
  2561. /**
  2562. * 尝试取数据(先读缓存)
  2563. */
  2564. CacheStore.prototype.reloadIfNeed = function (param) {
  2565. var _this = this;
  2566. if (typeof this.apiResponse === 'undefined') {
  2567. // 从未有获取过值
  2568. var cacheKey = this.getCacheKey(param);
  2569. if (cacheKey) {
  2570. // 可以从缓存读
  2571. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2572. native.loadFile(fileName, function (res) {
  2573. if (res) {
  2574. // 缓存有值
  2575. _this.apiResponse = res;
  2576. _this.notifyRefresh();
  2577. }
  2578. else {
  2579. // 缓存没值
  2580. _this.reloadForce(param).then(function (res) {
  2581. });
  2582. }
  2583. });
  2584. }
  2585. else {
  2586. // 不能从缓存读
  2587. this.reloadForce(param).then(function (res) {
  2588. });
  2589. }
  2590. return true;
  2591. }
  2592. return false;
  2593. };
  2594. /**
  2595. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  2596. */
  2597. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  2598. var _this = this;
  2599. return new Promise(function (resolve, reject) {
  2600. if (typeof _this.apiResponse === 'undefined') {
  2601. // 从未有获取过值
  2602. var cacheKey = _this.getCacheKey(param);
  2603. if (cacheKey) {
  2604. // 可以从缓存读
  2605. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2606. native.loadFile(fileName, function (res) {
  2607. if (res) {
  2608. // 缓存有值
  2609. _this.apiResponse = res;
  2610. _this.notifyRefresh();
  2611. resolve(_this.apiResponse);
  2612. }
  2613. else {
  2614. // 缓存没值
  2615. _this.reloadForce(param).then(function (res) {
  2616. resolve(_this.apiResponse);
  2617. });
  2618. }
  2619. });
  2620. }
  2621. else {
  2622. // 不能从缓存读
  2623. _this.reloadForce(param).then(function (res) {
  2624. resolve(_this.apiResponse);
  2625. });
  2626. }
  2627. }
  2628. else {
  2629. // 有值,获取过
  2630. resolve(_this.apiResponse);
  2631. }
  2632. });
  2633. };
  2634. /**
  2635. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  2636. */
  2637. CacheStore.prototype.reloadForce = function (param) {
  2638. var _this = this;
  2639. _$2.forEach(this.subscribeList, function (fn) {
  2640. fn(true);
  2641. });
  2642. return this.invokeApi(param)
  2643. .then(function (res) {
  2644. _this.apiResponse = res;
  2645. var cacheKey = _this.getCacheKey(param);
  2646. if (cacheKey) {
  2647. // 可以保存到缓存
  2648. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  2649. native.saveFile(fileName, res);
  2650. }
  2651. // 通知订阅者刷新
  2652. _this.notifyRefresh();
  2653. })
  2654. .finally(function () {
  2655. _$2.forEach(_this.subscribeList, function (fn) {
  2656. fn(false);
  2657. });
  2658. });
  2659. };
  2660. /**
  2661. * 通知组件,isLoading状态被更改
  2662. */
  2663. CacheStore.prototype.notifyLoading = function (isLoading) {
  2664. var _this = this;
  2665. _$2.forEach(this.subscribeList, function (fn) {
  2666. fn(_this.apiResponse);
  2667. });
  2668. };
  2669. /**
  2670. * 通知数据更改,需要刷新
  2671. */
  2672. CacheStore.prototype.notifyRefresh = function () {
  2673. var _this = this;
  2674. _$2.forEach(this.subscribeList, function (fn) {
  2675. fn(_this.apiResponse);
  2676. });
  2677. };
  2678. return CacheStore;
  2679. }());
  2680. //# sourceMappingURL=CacheStore.js.map
  2681. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  2682. function createEmptyModule(path, filename) {
  2683. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  2684. }
  2685. function createFolder(parentPath, filename) {
  2686. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  2687. }
  2688. function getModuleFileContent(module) {
  2689. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  2690. }
  2691. function saveFile(fileFullPath, fileContent) {
  2692. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  2693. // @ts-ignore
  2694. system.msg("保存成功");
  2695. return res;
  2696. });
  2697. }
  2698. function getQueryDslInfo(tableName) {
  2699. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  2700. args: [
  2701. { tableName: tableName }
  2702. ]
  2703. }).catch(function (e) {
  2704. var _a, _b;
  2705. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  2706. showErrorDialog(msg);
  2707. console.error(msg, e);
  2708. });
  2709. }
  2710. function invokeServer(url, param) {
  2711. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  2712. return request.post(url, {
  2713. args: [
  2714. param
  2715. ]
  2716. }).catch(function (e) {
  2717. var _a, _b;
  2718. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  2719. showErrorDialog(msg);
  2720. console.error(msg, e);
  2721. });
  2722. }
  2723. function parseSqlApi(sql) {
  2724. return request.post(getBaseUrl() + "@parseSqlApi", {
  2725. args: [sql]
  2726. }).catch(function (e) {
  2727. var _a, _b;
  2728. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  2729. showErrorDialog(msg);
  2730. console.error(msg, e);
  2731. });
  2732. }
  2733. function saveModuleFiles(param) {
  2734. return request.post(getBaseUrl() + "@saveModuleFiles", {
  2735. args: [
  2736. param
  2737. ]
  2738. }).catch(function (e) {
  2739. var _a, _b;
  2740. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  2741. showErrorDialog(msg);
  2742. console.error(msg, e);
  2743. });
  2744. }
  2745. function createQueryDSLFile(_a) {
  2746. var schema_name = _a.schema_name, table_name = _a.table_name;
  2747. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  2748. args: [{ schema_name: schema_name, table_name: table_name }]
  2749. }).catch(function (e) {
  2750. var _a, _b;
  2751. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  2752. showErrorDialog(msg);
  2753. console.error(msg, e);
  2754. });
  2755. }
  2756. function dbToMeta(param) {
  2757. if (typeof param === 'undefined') {
  2758. param = { datasource: 'master' };
  2759. }
  2760. else if (typeof param.datasource === 'undefined') {
  2761. param.datasource = 'master';
  2762. }
  2763. return request.post(getBaseUrl() + "@dbToMeta", {
  2764. args: [
  2765. param
  2766. ]
  2767. }).catch(function (e) {
  2768. var _a, _b;
  2769. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  2770. showErrorDialog(msg);
  2771. console.error(msg, e);
  2772. });
  2773. }
  2774. function getColumnDomainApi(param) {
  2775. if (typeof param === 'undefined') {
  2776. param = { datasource: 'master' };
  2777. }
  2778. else if (typeof param.datasource === 'undefined') {
  2779. param.datasource = 'master';
  2780. }
  2781. return request.post(getBaseUrl() + "@getColumnDomain", {
  2782. args: [
  2783. param
  2784. ]
  2785. }).catch(function (e) {
  2786. var _a, _b;
  2787. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  2788. showErrorDialog(msg);
  2789. console.error(msg, e);
  2790. });
  2791. }
  2792. function getMateData(param) {
  2793. if (typeof param === 'undefined') {
  2794. param = { datasource: 'master' };
  2795. }
  2796. else if (typeof param.datasource === 'undefined') {
  2797. param.datasource = 'master';
  2798. }
  2799. return request.post(getBaseUrl() + "@getMateData", {
  2800. args: [
  2801. param
  2802. ]
  2803. }).catch(function (e) {
  2804. var _a, _b;
  2805. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  2806. showErrorDialog(msg);
  2807. console.error(msg, e);
  2808. });
  2809. }
  2810. function getMateDataByTableName(param) {
  2811. if (typeof param === 'undefined') {
  2812. param = { datasource: 'master' };
  2813. }
  2814. else if (typeof param.datasource === 'undefined') {
  2815. param.datasource = 'master';
  2816. }
  2817. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  2818. args: [
  2819. param
  2820. ]
  2821. }).catch(function (e) {
  2822. var _a, _b;
  2823. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  2824. showErrorDialog(msg);
  2825. console.error(msg, e);
  2826. });
  2827. }
  2828. function saveMetaTableChanges(param) {
  2829. if (typeof param === 'undefined') {
  2830. param = { datasource: 'master' };
  2831. }
  2832. else if (typeof param.datasource === 'undefined') {
  2833. param.datasource = 'master';
  2834. }
  2835. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  2836. args: [
  2837. param
  2838. ]
  2839. }).catch(function (e) {
  2840. var _a, _b;
  2841. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  2842. showErrorDialog(msg);
  2843. console.error(msg, e);
  2844. });
  2845. }
  2846. function getModifyTableDDL(param) {
  2847. if (typeof param === 'undefined') {
  2848. param = { datasource: 'master' };
  2849. }
  2850. else if (typeof param.datasource === 'undefined') {
  2851. param.datasource = 'master';
  2852. }
  2853. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  2854. args: [
  2855. param
  2856. ]
  2857. }).catch(function (e) {
  2858. var _a, _b;
  2859. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  2860. showErrorDialog(msg);
  2861. console.error(msg, e);
  2862. });
  2863. }
  2864. function pushToDbCommitApi(param) {
  2865. if (typeof param === 'undefined') {
  2866. param = { datasource: 'master' };
  2867. }
  2868. else if (typeof param.datasource === 'undefined') {
  2869. param.datasource = 'master';
  2870. }
  2871. return request.post(getBaseUrl() + "@pushToDbCommit", {
  2872. args: [
  2873. param
  2874. ]
  2875. }).catch(function (e) {
  2876. var _a, _b;
  2877. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  2878. showErrorDialog(msg);
  2879. console.error(msg, e);
  2880. });
  2881. }
  2882. /**
  2883. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  2884. */
  2885. function saveMetaExBuildDDL(param) {
  2886. if (typeof param === 'undefined') {
  2887. param = { datasource: 'master' };
  2888. }
  2889. else if (typeof param.datasource === 'undefined') {
  2890. param.datasource = 'master';
  2891. }
  2892. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  2893. args: [
  2894. param
  2895. ]
  2896. }).catch(function (e) {
  2897. var _a, _b;
  2898. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  2899. showErrorDialog(msg);
  2900. console.error(msg, e);
  2901. });
  2902. }
  2903. function registerResource(params) {
  2904. return request.post(getBaseUrl() + "@registerResource", {
  2905. args: [params]
  2906. }).catch(function (e) {
  2907. var _a, _b;
  2908. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  2909. showErrorDialog(msg);
  2910. console.error(msg, e);
  2911. });
  2912. }
  2913. function getMenuTree(params) {
  2914. return request.post(getBaseUrl() + "@getMenuTree", {
  2915. args: [params]
  2916. }).catch(function (e) {
  2917. var _a, _b;
  2918. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  2919. showErrorDialog(msg);
  2920. console.error(msg, e);
  2921. });
  2922. }
  2923. function moduleTree() {
  2924. return request.post(getBaseUrl() + "@moduleTree")
  2925. .catch(function (e) {
  2926. var _a, _b;
  2927. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  2928. showErrorDialog(msg);
  2929. console.error(msg, e);
  2930. });
  2931. }
  2932. function dropTableDDL(schemaName, tableName) {
  2933. return request.post(getBaseUrl() + "@dropTableDDL", {
  2934. args: [
  2935. { schemaName: schemaName, tableName: tableName },
  2936. ]
  2937. }).catch(function (e) {
  2938. var _a, _b;
  2939. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  2940. showErrorDialog(msg);
  2941. console.error(msg, e);
  2942. });
  2943. }
  2944. function renameTableDDL(schemaName, tableName, reTableName) {
  2945. return request.post(getBaseUrl() + "@renameTableDDL", {
  2946. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  2947. }).catch(function (e) {
  2948. var _a, _b;
  2949. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  2950. showErrorDialog(msg);
  2951. console.error(msg, e);
  2952. });
  2953. }
  2954. function executeModifyProcedureSQL(param) {
  2955. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  2956. args: [
  2957. param,
  2958. ]
  2959. }).catch(function (e) {
  2960. var _a, _b;
  2961. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  2962. showErrorDialog(msg);
  2963. console.error(msg, e);
  2964. });
  2965. }
  2966. function parseDynamicSqlApi(sql, dataSource) {
  2967. return request.post(getBaseUrl() + "@parseDynamicSql", {
  2968. args: [
  2969. { sql: sql, dataSource: dataSource },
  2970. ]
  2971. }).catch(function (e) {
  2972. var _a, _b;
  2973. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  2974. showErrorDialog(msg);
  2975. console.error(msg, e);
  2976. });
  2977. }
  2978. function exporerList() {
  2979. return request.post(getBaseUrl() + "@exporerList", {
  2980. args: [{}]
  2981. }).catch(function (e) {
  2982. var _a, _b;
  2983. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  2984. showErrorDialog(msg);
  2985. console.error(msg, e);
  2986. });
  2987. }
  2988. function reportListApi() {
  2989. return request.post(getBaseUrl() + "@reportList", {
  2990. args: []
  2991. }).catch(function (e) {
  2992. var _a, _b;
  2993. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  2994. showErrorDialog(msg);
  2995. console.error(msg, e);
  2996. });
  2997. }
  2998. function reportByIdApi(reportId) {
  2999. return request.post(getBaseUrl() + "@reportById", {
  3000. args: [
  3001. { reportId: reportId },
  3002. ]
  3003. }).catch(function (e) {
  3004. var _a, _b;
  3005. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  3006. showErrorDialog(msg);
  3007. console.error(msg, e);
  3008. });
  3009. }
  3010. function createReportApi(reportName) {
  3011. return request.post(getBaseUrl() + "@createReport", {
  3012. args: [
  3013. { reportName: reportName },
  3014. ]
  3015. }).catch(function (e) {
  3016. var _a, _b;
  3017. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  3018. showErrorDialog(msg);
  3019. console.error(msg, e);
  3020. });
  3021. }
  3022. function saveReportApi(param) {
  3023. return request.post(getBaseUrl() + "@saveReport", {
  3024. args: [
  3025. param,
  3026. ]
  3027. }).catch(function (e) {
  3028. var _a, _b;
  3029. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  3030. showErrorDialog(msg);
  3031. console.error(msg, e);
  3032. });
  3033. }
  3034. function delReportApi(report_id) {
  3035. return request.post(getBaseUrl() + "@delReport", {
  3036. args: [{ report_id: report_id },]
  3037. }).catch(function (e) {
  3038. var _a, _b;
  3039. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  3040. showErrorDialog(msg);
  3041. console.error(msg, e);
  3042. });
  3043. }
  3044. function getDict(param) {
  3045. if (typeof param === 'undefined') {
  3046. param = { datasource: 'master' };
  3047. }
  3048. else if (typeof param.datasource === 'undefined') {
  3049. param.datasource = 'master';
  3050. }
  3051. return request.post(getBaseUrl() + "@getDict", {
  3052. args: [
  3053. param
  3054. ]
  3055. });
  3056. }
  3057. function saveDictApi(param) {
  3058. if (typeof param === 'undefined') {
  3059. param = { datasource: 'master' };
  3060. }
  3061. else if (typeof param.datasource === 'undefined') {
  3062. param.datasource = 'master';
  3063. }
  3064. return request.post(getBaseUrl() + "@saveDict", {
  3065. args: [
  3066. param
  3067. ]
  3068. }).catch(function (e) {
  3069. var _a, _b;
  3070. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  3071. showErrorDialog(msg);
  3072. console.error(msg, e);
  3073. });
  3074. }
  3075. function saveDictItemsApi(param) {
  3076. if (typeof param === 'undefined') {
  3077. param = { datasource: 'master' };
  3078. }
  3079. else if (typeof param.datasource === 'undefined') {
  3080. param.datasource = 'master';
  3081. }
  3082. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  3083. args: [
  3084. param
  3085. ]
  3086. }).catch(function (e) {
  3087. var _a, _b;
  3088. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  3089. showErrorDialog(msg);
  3090. console.error(msg, e);
  3091. });
  3092. }
  3093. function createDictEnum(param) {
  3094. return request.post(getBaseUrl() + "@createDictEnum", {
  3095. args: [
  3096. param
  3097. ]
  3098. }).catch(function (e) {
  3099. var _a, _b;
  3100. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  3101. showErrorDialog(msg);
  3102. console.error(msg, e);
  3103. });
  3104. }
  3105. function loadSqlContentApi(url) {
  3106. return request.post(getBaseUrl() + "@loadSqlContent", {
  3107. args: [
  3108. {
  3109. url: GLOBAL_NAMESPACE_PREFIX + url,
  3110. }
  3111. ]
  3112. }).catch(function (e) {
  3113. var _a, _b;
  3114. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  3115. showErrorDialog(msg);
  3116. console.error(msg, e);
  3117. });
  3118. }
  3119. function saveSqlContentApi(url, content) {
  3120. return request.post(getBaseUrl() + "@saveSqlContent", {
  3121. args: [
  3122. {
  3123. url: GLOBAL_NAMESPACE_PREFIX + url,
  3124. content: content,
  3125. }
  3126. ]
  3127. }).catch(function (e) {
  3128. var _a, _b;
  3129. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  3130. showErrorDialog(msg);
  3131. console.error(msg, e);
  3132. });
  3133. }
  3134. function readBpmn(param) {
  3135. return request.post(getBaseUrl() + "@readBpmn", {
  3136. args: [param]
  3137. }).catch(function (e) {
  3138. var _a, _b;
  3139. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3140. showErrorDialog(msg);
  3141. console.error(msg, e);
  3142. });
  3143. }
  3144. function createBpmn(path, filename) {
  3145. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3146. var _a, _b;
  3147. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  3148. showErrorDialog(msg);
  3149. console.error(msg, e);
  3150. });
  3151. }
  3152. function saveBpmn(fileFullPath, fileContent) {
  3153. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  3154. // @ts-ignore
  3155. system.msg("保存成功");
  3156. return res;
  3157. });
  3158. }
  3159. function deleteBpmn(path, filename) {
  3160. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3161. var _a, _b;
  3162. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  3163. showErrorDialog(msg);
  3164. console.error(msg, e);
  3165. });
  3166. }
  3167. function createDevForm(param) {
  3168. return request.post(getBaseUrl() + "@createDevForm", {
  3169. args: [param]
  3170. }).catch(function (e) {
  3171. var _a, _b;
  3172. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3173. showErrorDialog(msg);
  3174. console.error(msg, e);
  3175. });
  3176. }
  3177. function readDevForm(param) {
  3178. return request.post(getBaseUrl() + "@readDevForm", {
  3179. args: [param]
  3180. }).catch(function (e) {
  3181. var _a, _b;
  3182. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3183. showErrorDialog(msg);
  3184. console.error(msg, e);
  3185. });
  3186. }
  3187. function calcColumnForm(param) {
  3188. return request.post(getBaseUrl() + "@calcColumnForm", {
  3189. args: [param]
  3190. }).catch(function (e) {
  3191. var _a, _b;
  3192. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  3193. showErrorDialog(msg);
  3194. console.error(msg, e);
  3195. });
  3196. }
  3197. function widgetListApi(param) {
  3198. return request.post(getBaseUrl() + "@widgetListApi", {
  3199. args: [param]
  3200. }).catch(function (e) {
  3201. var _a, _b;
  3202. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  3203. showErrorDialog(msg);
  3204. console.error(msg, e);
  3205. });
  3206. }
  3207. function readWidget(param) {
  3208. return request.post(getBaseUrl() + "@readWidget", {
  3209. args: [param]
  3210. }).catch(function (e) {
  3211. var _a, _b;
  3212. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3213. showErrorDialog(msg);
  3214. console.error(msg, e);
  3215. });
  3216. }
  3217. function saveWidget(param) {
  3218. return request.post(getBaseUrl() + "@saveWidget", {
  3219. args: [param]
  3220. }).catch(function (e) {
  3221. var _a, _b;
  3222. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  3223. showErrorDialog(msg);
  3224. console.error(msg, e);
  3225. });
  3226. }
  3227. function deleteWidget(param) {
  3228. return request.post(getBaseUrl() + "@deleteWidget", {
  3229. args: [param]
  3230. }).catch(function (e) {
  3231. var _a, _b;
  3232. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  3233. showErrorDialog(msg);
  3234. console.error(msg, e);
  3235. });
  3236. }
  3237. function getDataBaseNameApi() {
  3238. return request.post(getBaseUrl() + "@getDataBaseName", {
  3239. args: []
  3240. }).catch(function (e) {
  3241. var _a, _b;
  3242. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3243. showErrorDialog(msg);
  3244. console.error(msg, e);
  3245. });
  3246. }
  3247. function getDiffDDLApi(param) {
  3248. return request.post(getBaseUrl() + "@getDiffDDL", {
  3249. args: [
  3250. param
  3251. ]
  3252. }).catch(function (e) {
  3253. var _a, _b;
  3254. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  3255. showErrorDialog(msg);
  3256. console.error(msg, e);
  3257. });
  3258. }
  3259. function dataSyncApi(param) {
  3260. return request.post(getBaseUrl() + "@dataSync", {
  3261. args: [
  3262. param
  3263. ]
  3264. }).catch(function (e) {
  3265. var _a, _b;
  3266. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  3267. showErrorDialog(msg);
  3268. console.error(msg, e);
  3269. });
  3270. }
  3271. function dataSyncInfoApi(param) {
  3272. return request.post(getBaseUrl() + "@dataSyncInfo", {
  3273. args: [
  3274. param
  3275. ]
  3276. }).catch(function (e) {
  3277. var _a, _b;
  3278. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  3279. showErrorDialog(msg);
  3280. console.error(msg, e);
  3281. });
  3282. }
  3283. function saveColumnDomain(param) {
  3284. if (typeof param === 'undefined') {
  3285. param = { datasource: 'master' };
  3286. }
  3287. else if (typeof param.datasource === 'undefined') {
  3288. param.datasource = 'master';
  3289. }
  3290. return request.post(getBaseUrl() + "@saveColumnDomain", {
  3291. args: [
  3292. param
  3293. ]
  3294. }).catch(function (e) {
  3295. var _a, _b;
  3296. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  3297. showErrorDialog('发生错误:' + msg);
  3298. console.error(msg, e);
  3299. });
  3300. }
  3301. function devOpsList() {
  3302. return request.post(getBaseUrl() + "@devOpsList", {
  3303. args: [{}]
  3304. }).catch(function (e) {
  3305. var _a, _b;
  3306. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  3307. showErrorDialog('发生错误:' + msg);
  3308. console.error(msg, e);
  3309. });
  3310. }
  3311. function devOpsById(opsId) {
  3312. return request.post(getBaseUrl() + "@devOpsById", {
  3313. args: [{ opsId: opsId }]
  3314. }).catch(function (e) {
  3315. var _a, _b;
  3316. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  3317. showErrorDialog('发生错误:' + msg);
  3318. console.error(msg, e);
  3319. });
  3320. }
  3321. function metricsRequestApi() {
  3322. return request.get("/api/metrics/request")
  3323. .catch(function (e) {
  3324. var _a, _b;
  3325. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  3326. showErrorDialog('发生错误:' + msg);
  3327. console.error(msg, e);
  3328. });
  3329. }
  3330. function metricsJdbcApi() {
  3331. return request.get("/api/metrics/jdbc")
  3332. .catch(function (e) {
  3333. var _a, _b;
  3334. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  3335. showErrorDialog('发生错误:' + msg);
  3336. console.error(msg, e);
  3337. });
  3338. }
  3339. function executeDDL(param) {
  3340. return request.post(getBaseUrl() + "@executeDDL", {
  3341. args: [
  3342. param,
  3343. ]
  3344. }).catch(function (e) {
  3345. var _a, _b;
  3346. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  3347. showErrorDialog('发生错误:' + msg);
  3348. console.error(msg, e);
  3349. });
  3350. }
  3351. function getModifyIdxDDL(param) {
  3352. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  3353. args: [
  3354. param,
  3355. ]
  3356. }).catch(function (e) {
  3357. var _a, _b;
  3358. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  3359. showErrorDialog('发生错误:' + msg);
  3360. console.error(msg, e);
  3361. });
  3362. }
  3363. function getModifyProcedureSQL(param) {
  3364. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  3365. args: [
  3366. param,
  3367. ]
  3368. }).catch(function (e) {
  3369. var _a, _b;
  3370. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  3371. showErrorDialog('发生错误:' + msg);
  3372. console.error(msg, e);
  3373. });
  3374. }
  3375. function saveWhLayout(param) {
  3376. return request.post(getLayoutUrl() + "@saveWhLayout", {
  3377. args: [
  3378. param,
  3379. ]
  3380. }).catch(function (e) {
  3381. var _a, _b;
  3382. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  3383. showErrorDialog('发生错误:' + msg);
  3384. console.error(msg, e);
  3385. });
  3386. }
  3387. function deleteWhLayout(param) {
  3388. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  3389. args: [
  3390. param,
  3391. ]
  3392. }).catch(function (e) {
  3393. var _a, _b;
  3394. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  3395. showErrorDialog('发生错误:' + msg);
  3396. console.error(msg, e);
  3397. });
  3398. }
  3399. function loadWhLayoutAll() {
  3400. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  3401. args: []
  3402. }).catch(function (e) {
  3403. var _a, _b;
  3404. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  3405. showErrorDialog('发生错误:' + msg);
  3406. console.error(msg, e);
  3407. });
  3408. }
  3409. function loadWhLayout(param) {
  3410. return request.post(getLayoutUrl() + "@loadWhLayout", {
  3411. args: [
  3412. param,
  3413. ]
  3414. }).catch(function (e) {
  3415. var _a, _b;
  3416. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  3417. showErrorDialog('发生错误:' + msg);
  3418. console.error(msg, e);
  3419. });
  3420. }
  3421. var baseUrl = "/api/com/yvan/studio/FileManager";
  3422. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  3423. function getBaseUrl() {
  3424. // return getCurrentProject().url + baseUrl
  3425. return baseUrl;
  3426. }
  3427. function getLayoutUrl() {
  3428. // return getCurrentProject().url + baseUrl
  3429. return layoutUrl;
  3430. }
  3431. var Request = /** @class */ (function () {
  3432. function Request(axiosInstance) {
  3433. this.axiosInstance = axiosInstance;
  3434. }
  3435. // 全局响应数据转换处理
  3436. Request.transformResponse = function (response) {
  3437. var _a;
  3438. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  3439. };
  3440. Request.prototype.get = function (url, config) {
  3441. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  3442. };
  3443. Request.prototype.delete = function (url, config) {
  3444. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  3445. };
  3446. Request.prototype.head = function (url, config) {
  3447. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  3448. };
  3449. Request.prototype.options = function (url, config) {
  3450. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  3451. };
  3452. Request.prototype.post = function (url, data, config) {
  3453. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3454. };
  3455. Request.prototype.put = function (url, data, config) {
  3456. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3457. };
  3458. Request.prototype.patch = function (url, data, config) {
  3459. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3460. };
  3461. Request.prototype.request = function (config) {
  3462. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  3463. };
  3464. return Request;
  3465. }());
  3466. /** 创建一个axios实例对象 */
  3467. function axiosCreate(config) {
  3468. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  3469. }
  3470. var axiosInstance;
  3471. function init() {
  3472. axiosInstance = axiosCreate({
  3473. validateStatus: function (status) { return (status >= 200 && status < 400); },
  3474. });
  3475. request = new Request(axiosInstance);
  3476. }
  3477. var request;
  3478. //# sourceMappingURL=Api.js.map
  3479. // ------------------------------------------------------------------------------------------ types
  3480. /** 订阅消息key类型 */
  3481. var EventType;
  3482. (function (EventType) {
  3483. /** FileTree打开Module */
  3484. EventType["ModuleOpen"] = "ModuleOpen";
  3485. /** ModulePage 创建 */
  3486. EventType["ModulePageCreate"] = "ModulePageCreate";
  3487. /** ModuleItem内容变化 */
  3488. EventType["ModuleItemChange"] = "ModuleItemChange";
  3489. /** ModuleItem的 jsView 内容变化 */
  3490. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3491. /** 设置 vjson */
  3492. EventType["SetVjson"] = "SetVjson";
  3493. /** 更新 vjson */
  3494. EventType["UpdateVjson"] = "UpdateVjson";
  3495. /** 更新 组件vjson */
  3496. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3497. /** Component 选中内容变化 */
  3498. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3499. /** Component 选中内容变化 */
  3500. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3501. /** Component 删除事件 */
  3502. EventType["ComponentDelete"] = "ComponentDelete";
  3503. /** MainTab 选中改变事件 */
  3504. EventType["MainTabChange"] = "MainTabChange";
  3505. /** ModuleTab 选中改变事件 */
  3506. EventType["ModuleTabChange"] = "ModuleTabChange";
  3507. /** 保存事件 */
  3508. EventType["SaveCall"] = "SaveCall";
  3509. /** 撤销 */
  3510. EventType["Undo"] = "Undo";
  3511. /** 还原 */
  3512. EventType["Redo"] = "Redo";
  3513. /** 剪切 */
  3514. EventType["Cut"] = "Cut";
  3515. /** 复制 */
  3516. EventType["Copy"] = "Copy";
  3517. /** 粘贴 */
  3518. EventType["Paste"] = "Paste";
  3519. /** 全选 */
  3520. EventType["SelectAll"] = "SelectAll";
  3521. /** 读取剪切板 */
  3522. EventType["ClipboardRead"] = "ClipboardRead";
  3523. /** 检查模块更新 */
  3524. EventType["RunCheckModule"] = "RunCheckModule";
  3525. /** 停止检查模块更新 */
  3526. EventType["StopCheckModule"] = "StopCheckModule";
  3527. })(EventType || (EventType = {}));
  3528. // ------------------------------------------------------------------------------------------ impls
  3529. var EventBus = /** @class */ (function () {
  3530. function EventBus() {
  3531. /** 事件数据 */
  3532. this.store = {};
  3533. /** 事件订阅者注册表 */
  3534. this.observeStoreTable = {};
  3535. this.init();
  3536. }
  3537. EventBus.prototype.init = function () {
  3538. var _this = this;
  3539. // 更改store值就会自动publish消息 - 实现
  3540. this.store = new Proxy({}, {
  3541. get: function (target, key) {
  3542. return target[key];
  3543. },
  3544. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3545. set: function (target, key, data) {
  3546. if (noValue(key))
  3547. return false;
  3548. target[key] = data;
  3549. // 消息通知订阅者
  3550. var observerArr = _this.observeStoreTable[key];
  3551. if (noValue(observerArr) || observerArr.length <= 0)
  3552. return true;
  3553. observerArr.forEach(function (handler) {
  3554. //try {
  3555. handler(data, key);
  3556. // } catch (err) {
  3557. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3558. // }
  3559. });
  3560. return true;
  3561. },
  3562. });
  3563. };
  3564. /** 取消注册订阅者 */
  3565. EventBus.prototype.unregisterObserver = function (key, handler) {
  3566. var _this = this;
  3567. var observerArr = this.observeStoreTable[key];
  3568. if (noValue(observerArr) || observerArr.length <= 0)
  3569. return;
  3570. if (noValue(handler)) {
  3571. this.observeStoreTable[key] = [];
  3572. }
  3573. else {
  3574. observerArr.forEach(function (obsHandler, index) {
  3575. if (obsHandler !== handler)
  3576. return;
  3577. _this.observeStoreTable[key].splice(index, 1);
  3578. });
  3579. }
  3580. };
  3581. /** 注册订阅者 */
  3582. EventBus.prototype.registerObserver = function (key, handler) {
  3583. var observerArr = this.observeStoreTable[key];
  3584. if (noValue(observerArr) || observerArr.length <= 0) {
  3585. observerArr = [];
  3586. this.observeStoreTable[key] = observerArr;
  3587. }
  3588. observerArr.push(handler);
  3589. // if (noValue(key)) return;
  3590. // const sourceValue = this.store[key];
  3591. // if (noValue(sourceValue)) return;
  3592. // handler(sourceValue, key);
  3593. };
  3594. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3595. EventBus.prototype.getStore = function () {
  3596. return this.store;
  3597. };
  3598. /**
  3599. * 取消订阅
  3600. * @param key 订阅的消息key
  3601. * @param handler 指定取消的监听函数
  3602. */
  3603. EventBus.prototype.unsubscribe = function (key, handler) {
  3604. var _this = this;
  3605. if (key instanceof Array) {
  3606. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3607. }
  3608. else {
  3609. this.unregisterObserver(key, handler);
  3610. }
  3611. };
  3612. /**
  3613. * 消息订阅
  3614. * @param key 订阅的消息key
  3615. * @param handler 监听函数
  3616. */
  3617. EventBus.prototype.subscribe = function (key, handler) {
  3618. var _this = this;
  3619. var cancelSubscribe = {
  3620. key: key,
  3621. cancel: function () {
  3622. },
  3623. };
  3624. if (key instanceof Array) {
  3625. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3626. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3627. }
  3628. else {
  3629. this.registerObserver(key, handler);
  3630. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3631. }
  3632. return cancelSubscribe;
  3633. };
  3634. /**
  3635. * 消息订阅(只订阅一次)
  3636. * @param key 订阅的消息key
  3637. * @param handler 监听函数
  3638. */
  3639. EventBus.prototype.subscribeOnce = function (key, handler) {
  3640. var cancelSubscribe = this.subscribe(key, function (data) {
  3641. // try {
  3642. handler(data, key);
  3643. // } catch (err) {
  3644. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3645. // }
  3646. cancelSubscribe.cancel();
  3647. });
  3648. };
  3649. /**
  3650. * 发送消息(触发订阅监听函数)
  3651. * @param key 消息key
  3652. * @param eventData 消息值
  3653. */
  3654. EventBus.prototype.publish = function (key, eventData) {
  3655. var _this = this;
  3656. if (key instanceof Array) {
  3657. key.forEach(function (k) { return _this.store[k] = eventData; });
  3658. }
  3659. else {
  3660. this.store[key] = eventData;
  3661. }
  3662. };
  3663. return EventBus;
  3664. }());
  3665. // ------------------------------------------------------------------------------------------ use
  3666. var eventBus = new EventBus();
  3667. //# sourceMappingURL=EventBus.js.map
  3668. var idPrefix = "_ds_";
  3669. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  3670. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  3671. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  3672. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  3673. var layoutOrXtypeNameMap = {
  3674. fit: 'fit布局',
  3675. border: 'border布局',
  3676. center: '中部',
  3677. north: '上部',
  3678. south: '下部',
  3679. west: '左部',
  3680. east: '右部',
  3681. yvgrid: '表格',
  3682. tree: '树',
  3683. tabpanel: '标签页',
  3684. form: '表单',
  3685. fieldset: '字段组',
  3686. tbar: '顶部工具栏',
  3687. fbar: '底部工具栏',
  3688. toolbar: '工具栏',
  3689. cols: '列容器',
  3690. rows: '行容器',
  3691. textfield: '文本框',
  3692. textareafield: '长文本框',
  3693. numberfield: '数字框',
  3694. label: "文本",
  3695. combo: "下拉框",
  3696. combobox: "下拉框",
  3697. combotree: "下拉树",
  3698. combogrid: "下拉表",
  3699. datefield: "日期框",
  3700. searchfield: "搜索框",
  3701. button: "按钮",
  3702. checkbox: "勾选",
  3703. checkboxgroup: "勾选组",
  3704. radio: "点选",
  3705. radiogroup: "点选组",
  3706. container: "占位"
  3707. };
  3708. /**
  3709. * 从 VJSON 中找到 rows/cols 的数组
  3710. */
  3711. function findArrayContainer(vjson, id) {
  3712. var parentVJson = getSuperVjson(vjson, id);
  3713. if (_$2.isArray(parentVJson)) {
  3714. return parentVJson;
  3715. }
  3716. if (parentVJson.hasOwnProperty('items')) {
  3717. return parentVJson.items;
  3718. }
  3719. }
  3720. /**
  3721. * 根据id查找上级vjson
  3722. * @param vjson 原始 vjson 视图
  3723. * @param targetId 子元素的id
  3724. */
  3725. function getSuperVjson(vjson, targetId) {
  3726. return deepTravFindSuper(vjson, vjson, targetId);
  3727. }
  3728. /**
  3729. * 根据id查找上级vjson id
  3730. * @param vjson 原始 vjson 视图
  3731. * @param targetId 子元素的id
  3732. */
  3733. function getSuperVjsonId(vjson, targetId) {
  3734. var vj = getSuperVjson(vjson, targetId);
  3735. return vj.id;
  3736. }
  3737. function deepTravFindSuper(superVjson, vjson, targetId) {
  3738. var rObj = null;
  3739. _$2.forOwn(vjson, function (value, key) {
  3740. if (rObj) {
  3741. return;
  3742. }
  3743. if (typeof value !== "object") {
  3744. return;
  3745. }
  3746. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  3747. if (key !== 'items') {
  3748. return;
  3749. }
  3750. }
  3751. else {
  3752. // 模型、数据、数据源不扫描
  3753. if (key === 'data' ||
  3754. key === 'dataSource' ||
  3755. key === 'suggest' ||
  3756. key === 'options' ||
  3757. key === 'config' ||
  3758. key === 'columns' ||
  3759. key === 'viewModel' ||
  3760. key === 'store') {
  3761. return;
  3762. }
  3763. }
  3764. //事件不扫描
  3765. if (key === "on" && _$2.isObject(value)) {
  3766. return;
  3767. }
  3768. if (key.startsWith("on") && _$2.size(key) > 2) {
  3769. return;
  3770. }
  3771. if (value.id === targetId) {
  3772. if (_$2.isArray(vjson)) {
  3773. rObj = superVjson;
  3774. }
  3775. else {
  3776. rObj = vjson;
  3777. }
  3778. return;
  3779. }
  3780. rObj = deepTravFindSuper(vjson, value, targetId);
  3781. });
  3782. return rObj;
  3783. }
  3784. /**
  3785. * 深度遍历 vjson
  3786. * @param vjson 视图JSON
  3787. * @param resolver 分析函数
  3788. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  3789. */
  3790. function deepTravVJson(vjson, resolver, propDeep) {
  3791. if (propDeep === void 0) { propDeep = false; }
  3792. var markerList = [];
  3793. deepTrav1(vjson, resolver, markerList, propDeep);
  3794. return markerList;
  3795. }
  3796. function deepTrav1(obj, resolver, marker, propDeep) {
  3797. if (propDeep === void 0) { propDeep = false; }
  3798. var isMarker = resolver(obj);
  3799. if (marker && isMarker === true) {
  3800. marker.unshift({ id: 0, keyName: '', object: obj });
  3801. }
  3802. _$2.forOwn(obj, function (value, key) {
  3803. if (typeof value !== 'object') {
  3804. return;
  3805. }
  3806. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3807. if (key !== 'items' && key !== 'children') {
  3808. return;
  3809. }
  3810. }
  3811. else {
  3812. // 模型、数据、数据源不扫描
  3813. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3814. return;
  3815. }
  3816. if (!propDeep &&
  3817. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3818. key === 'listeners' || key === 'bind')) {
  3819. return;
  3820. }
  3821. }
  3822. //事件不扫描
  3823. if (key === 'on' && _$2.isObject(value)) {
  3824. return;
  3825. }
  3826. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3827. return;
  3828. }
  3829. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3830. if (marker && isMarkerChild === true) {
  3831. isMarker = true;
  3832. marker.unshift({ id: obj.id, keyName: key, object: value });
  3833. }
  3834. });
  3835. // @ts-ignore 删除作废对象
  3836. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3837. return isMarker;
  3838. }
  3839. /**
  3840. * 在代码中找到 reference 对应的对象
  3841. */
  3842. function findInCode(code, id) {
  3843. try {
  3844. deepTravVJson(code, function (child) {
  3845. if (child.id === id) {
  3846. throw child;
  3847. }
  3848. });
  3849. return undefined;
  3850. }
  3851. catch (err) {
  3852. return err;
  3853. }
  3854. }
  3855. function replaceVjsonById(vjson, itemVjson, itemId) {
  3856. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3857. msgError('无法定位组件!');
  3858. debugger;
  3859. return;
  3860. }
  3861. var id = itemId || itemVjson.id;
  3862. deepTravVJson(vjson, function (obj) {
  3863. if (obj.id == id) {
  3864. _$2.assign(obj, itemVjson, { id: id });
  3865. }
  3866. });
  3867. }
  3868. function deepTravDeleteVjson(obj, targetId) {
  3869. var isDelete = false;
  3870. _$2.forOwn(obj, function (value, key) {
  3871. if (isDelete) {
  3872. return;
  3873. }
  3874. if (typeof value !== 'object') {
  3875. return;
  3876. }
  3877. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3878. if (key !== 'items') {
  3879. return;
  3880. }
  3881. }
  3882. else {
  3883. // 模型、数据、数据源不扫描
  3884. if (key === 'data' ||
  3885. key === 'dataSource' ||
  3886. key === 'suggest' ||
  3887. key === 'options' ||
  3888. key === 'config' ||
  3889. key === 'columns' ||
  3890. key === 'viewModel' ||
  3891. key === 'store') {
  3892. return;
  3893. }
  3894. }
  3895. //事件不扫描
  3896. if (key === 'on' && _$2.isObject(value)) {
  3897. return;
  3898. }
  3899. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3900. return;
  3901. }
  3902. if (value.id === targetId) {
  3903. isDelete = true;
  3904. /** 如果是数组的元素*/
  3905. if (_$2.isArray(obj)) {
  3906. obj.splice(key, 1);
  3907. }
  3908. else {
  3909. delete obj[key];
  3910. }
  3911. return;
  3912. }
  3913. isDelete = deepTravDeleteVjson(value, targetId);
  3914. });
  3915. return isDelete;
  3916. }
  3917. /**
  3918. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3919. * @param obj 原始 vjson 视图
  3920. * @param targetId 子元素的id
  3921. */
  3922. function deletVjsonById(vjson, targetId) {
  3923. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3924. // if (_.isArray(obj)) {
  3925. // if (obj.length <= 0) {
  3926. // let T: any = {
  3927. // view: "template",
  3928. // template: "拖动任何组件到此处",
  3929. // role: "placeholder",
  3930. // id: webix.uid()
  3931. // }
  3932. // obj.push(T);
  3933. // }
  3934. // }
  3935. return isDeleted;
  3936. }
  3937. function removeDesignProp(vjson) {
  3938. deepTravVJson(vjson, function (obj) {
  3939. if (obj.hasOwnProperty('id')) {
  3940. delete obj.id;
  3941. }
  3942. if (obj.hasOwnProperty("designMode")) {
  3943. delete obj.designMode;
  3944. }
  3945. });
  3946. if (vjson.hasOwnProperty("cls")) {
  3947. delete vjson.cls;
  3948. }
  3949. if (vjson.hasOwnProperty("viewModel")) {
  3950. delete vjson.viewModel;
  3951. }
  3952. if (vjson.hasOwnProperty("store")) {
  3953. delete vjson.store;
  3954. }
  3955. }
  3956. function getLayoutOutline(vjson) {
  3957. deepTravVJson(vjson, function (obj) {
  3958. if (!Array.isArray(obj)) {
  3959. _$2.forOwn(obj, function (value, key) {
  3960. if (key === 'id' || key === 'region' || key === 'layoutName'
  3961. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3962. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3963. if (key === 'region'
  3964. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3965. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3966. if (!_$2.has(obj, 'layoutName')) {
  3967. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3968. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3969. // console.log(obj.layoutName, obj.layoutNameDesc)
  3970. }
  3971. }
  3972. }
  3973. else {
  3974. if (key === 'items') {
  3975. obj.children = obj[key];
  3976. }
  3977. if (key === 'tbar') {
  3978. var t = obj[key];
  3979. t.layoutName = key;
  3980. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3981. // console.log(t.layoutName, t.layoutNameDesc)
  3982. if (_$2.has(obj, "items")) {
  3983. obj.items.splice(0, 0, t);
  3984. }
  3985. else if (_$2.has(obj, "children")) {
  3986. obj.children.splice(0, 0, t);
  3987. }
  3988. else {
  3989. obj.children = [t];
  3990. }
  3991. }
  3992. if (key === 'fbar') {
  3993. var t = obj[key];
  3994. t.layoutName = key;
  3995. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3996. // console.log(t.layoutName, t.layoutNameDesc)
  3997. if (_$2.has(obj, "items")) {
  3998. obj.items.push(t);
  3999. }
  4000. else if (_$2.has(obj, "children")) {
  4001. obj.children.push(t);
  4002. }
  4003. else {
  4004. obj.children = [t];
  4005. }
  4006. }
  4007. delete obj[key];
  4008. }
  4009. });
  4010. if (!obj.hasOwnProperty("children")) {
  4011. obj.leaf = true;
  4012. }
  4013. if (!obj.hasOwnProperty("expanded")) {
  4014. obj.expanded = true;
  4015. }
  4016. }
  4017. });
  4018. return vjson;
  4019. }
  4020. //# sourceMappingURL=ViewHelper.js.map
  4021. var checkFlags = {};
  4022. // ------------------------------------------------------------------------------------------ impls
  4023. function jsViewToVJson(modulePage, jsView) {
  4024. if (!jsView)
  4025. return {};
  4026. jsView = jsView.replace(/^\s*export\s+default/, "");
  4027. jsView = _$2.trim(jsView) || "{}";
  4028. try {
  4029. var json = dist.parse(jsView);
  4030. return modulePage.addViewId(json);
  4031. }
  4032. catch (e) {
  4033. //@ts-ignore
  4034. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  4035. }
  4036. }
  4037. function stringToJsonObj(jsonStr) {
  4038. if (!jsonStr)
  4039. return {};
  4040. try {
  4041. return dist.parse(jsonStr);
  4042. }
  4043. catch (e) {
  4044. return {};
  4045. }
  4046. }
  4047. /**
  4048. * 获取view.js 文件 string
  4049. */
  4050. function vjsonTojsView(vjson) {
  4051. var reVjson = _$2.cloneDeep(vjson);
  4052. removeDesignProp(reVjson);
  4053. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  4054. }
  4055. var ModuleStore = /** @class */ (function (_super) {
  4056. __extends(ModuleStore, _super);
  4057. function ModuleStore() {
  4058. var _this = _super.call(this) || this;
  4059. _this.store = {};
  4060. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  4061. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  4062. _this.addModule(id, module, modulePage);
  4063. });
  4064. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  4065. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  4066. _this.onMainTabChange(moduleId, oldModuleId, from);
  4067. });
  4068. return _this;
  4069. }
  4070. ModuleStore.prototype.getCacheKey = function (param) {
  4071. return "filetree_data.json";
  4072. };
  4073. ModuleStore.prototype.invokeApi = function (param) {
  4074. return moduleTree();
  4075. };
  4076. ModuleStore.prototype.reloadModule = function (id) {
  4077. var moduleObject = this.store[id];
  4078. if (!moduleObject)
  4079. return;
  4080. var module = moduleObject.module;
  4081. getModuleFileContent(module).then(function (_a) {
  4082. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4083. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  4084. moduleObject.lastModifyTime = lastModifyTime;
  4085. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  4086. // 触发事件 ModuleItemChange
  4087. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4088. moduleObject.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: "reloadModule" });
  4089. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  4090. });
  4091. };
  4092. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  4093. var _this = this;
  4094. getModuleFileContent(module).then(function (_a) {
  4095. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4096. var moduleObject = {
  4097. id: id, module: module,
  4098. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  4099. lastModifyTime: lastModifyTime,
  4100. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  4101. modulePage: modulePage,
  4102. moduleEventBus: modulePage.moduleEventBus
  4103. };
  4104. _this.store[id] = moduleObject;
  4105. // 触发事件 ModuleItemChange
  4106. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4107. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  4108. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  4109. });
  4110. };
  4111. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  4112. if (this.store[moduleId]) {
  4113. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  4114. }
  4115. };
  4116. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  4117. var moduleObject = this.store[id];
  4118. moduleObject.fileContent.jsController = codeValue;
  4119. };
  4120. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  4121. var moduleObject = this.store[id];
  4122. moduleObject.fileContent.jsView = codeValue;
  4123. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  4124. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: from });
  4125. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  4126. };
  4127. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  4128. var moduleObject = this.store[id];
  4129. moduleObject.fileContent.jsModel = codeValue;
  4130. };
  4131. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  4132. var moduleObject = this.store[id];
  4133. moduleObject.fileContent.groovy = codeValue;
  4134. };
  4135. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  4136. var moduleObject = this.store[id];
  4137. moduleObject.fileContent.mybatis = codeValue;
  4138. };
  4139. ModuleStore.prototype.getModuleObject = function (id) {
  4140. return this.store[id];
  4141. };
  4142. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  4143. if (checkFlags[moduleId] === 1) {
  4144. // @ts-ignore
  4145. system.msg("正在检测文件是否有外部修改,请稍后操作");
  4146. }
  4147. eventBus.publish(EventType.StopCheckModule, {});
  4148. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  4149. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  4150. saveFile(fileFullPath, fileContent).then(function (res) {
  4151. if (res.data && res.data.lastModified) {
  4152. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  4153. }
  4154. }).finally(function () {
  4155. eventBus.publish(EventType.RunCheckModule, {});
  4156. });
  4157. };
  4158. ModuleStore.prototype.check = function (moduleId) {
  4159. {
  4160. return;
  4161. }
  4162. };
  4163. return ModuleStore;
  4164. }(CacheStore));
  4165. // ------------------------------------------------------------------------------------------ use
  4166. var moduleStore = new ModuleStore();
  4167. //# sourceMappingURL=ModuleStore.js.map
  4168. /**
  4169. * 调用方法
  4170. */
  4171. function invokeMethod(fn, sender, args) {
  4172. if (typeof fn === 'function') {
  4173. fn.apply.apply(fn, __spread([sender], args));
  4174. }
  4175. }
  4176. /**
  4177. * 判断事件是否为有效的输入字符
  4178. * @param e
  4179. */
  4180. function isChartEvent(e) {
  4181. if (e.key === 'Shift' ||
  4182. e.key === 'Control' ||
  4183. e.key === 'Alt' ||
  4184. e.key === 'Escape' ||
  4185. e.key === 'ArrowRight' ||
  4186. e.key === 'Tab' ||
  4187. e.key === 'ArrowLeft') {
  4188. return false;
  4189. }
  4190. if (e.keyCode >= 48 && e.keyCode <= 57) {
  4191. // 0-9
  4192. return true;
  4193. }
  4194. if (e.keyCode >= 65 && e.keyCode <= 90) {
  4195. // a-z
  4196. return true;
  4197. }
  4198. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  4199. // 小键盘 0-9
  4200. return true;
  4201. }
  4202. return false;
  4203. }
  4204. if (!window["time_offset"]) {
  4205. window["time_offset"] = 0;
  4206. }
  4207. function syncDate(date) {
  4208. if (date && date.setTime && date.getTime) {
  4209. date.setTime(date.getTime() + window["time_offset"]);
  4210. }
  4211. return date;
  4212. }
  4213. //# sourceMappingURL=utils.js.map
  4214. function isDesignMode(control, config) {
  4215. var _a, _b;
  4216. if (window["IS_DESIGN_MODE"]) {
  4217. return true;
  4218. }
  4219. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  4220. return true;
  4221. }
  4222. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  4223. return true;
  4224. }
  4225. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  4226. return true;
  4227. }
  4228. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  4229. return true;
  4230. }
  4231. return false;
  4232. }
  4233. function toString(value) {
  4234. if (typeof value === 'undefined' || value === null) {
  4235. return "";
  4236. }
  4237. if (typeof value === 'number' && isNaN(value)) {
  4238. return "";
  4239. }
  4240. if (value == 'N/A') {
  4241. return "";
  4242. }
  4243. return ("" + value);
  4244. }
  4245. function isEmpty(value) {
  4246. if (typeof value === 'undefined' || value === null) {
  4247. return true;
  4248. }
  4249. if (typeof value === 'number' && isNaN(value)) {
  4250. return true;
  4251. }
  4252. if (value == 'N/A') {
  4253. return true;
  4254. }
  4255. return ("" + value).trim().length <= 0;
  4256. }
  4257. function createUUID() {
  4258. //@ts-ignore
  4259. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  4260. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  4261. });
  4262. }
  4263. function getRegList() {
  4264. var regList = _$2.get(window, 'yvanLib.regList');
  4265. if (!regList) {
  4266. regList = [];
  4267. _$2.set(window, 'yvanLib.regList', regList);
  4268. }
  4269. return regList;
  4270. }
  4271. function getRegParamList(methodName) {
  4272. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  4273. if (!regParamList) {
  4274. regParamList = {};
  4275. _$2.set(window, 'yvanLib.regParamList', regParamList);
  4276. }
  4277. if (!_$2.has(regParamList, methodName)) {
  4278. regParamList[methodName] = [];
  4279. }
  4280. return regParamList[methodName];
  4281. }
  4282. /**
  4283. * 模拟点击按钮
  4284. */
  4285. function raiseClick(buttonHandle) {
  4286. if (!buttonHandle) {
  4287. return false;
  4288. }
  4289. if (buttonHandle.disabled) {
  4290. // 按钮是禁止状态
  4291. return false;
  4292. }
  4293. if (buttonHandle.hidden) {
  4294. // 按钮是隐藏状态
  4295. return false;
  4296. }
  4297. // 按钮点击
  4298. buttonHandle.click();
  4299. return true;
  4300. }
  4301. /**
  4302. * 标注系统全局函数的参数
  4303. * @param title 函数名称
  4304. * @param type 函数类型
  4305. * @param allowEmpty 可否为空
  4306. */
  4307. function LibParam(title, type, allowEmpty) {
  4308. if (allowEmpty === void 0) { allowEmpty = false; }
  4309. return function (target, methodName, paramsIndex) {
  4310. var systemFnArgs = getRegParamList(methodName);
  4311. systemFnArgs[paramsIndex] = {
  4312. type: type,
  4313. title: title,
  4314. name: methodName,
  4315. allowEmpty: allowEmpty,
  4316. };
  4317. };
  4318. }
  4319. /**
  4320. * 标注函数变成"系统全局函数"
  4321. */
  4322. function Lib(registe) {
  4323. return function (target, propertyKey, descriptor) {
  4324. var libList = getRegList();
  4325. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  4326. if (registe.type === 'system') {
  4327. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  4328. }
  4329. else if (registe.type === 'format') {
  4330. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  4331. }
  4332. return target;
  4333. };
  4334. }
  4335. /**
  4336. * 解析事件
  4337. * 'scope.私有方法名'
  4338. * 'system.系统函数名'
  4339. * 'format.格式化名'
  4340. */
  4341. function lookupFn(scope, event, errorWho) {
  4342. if (isDesignMode(scope, undefined)) {
  4343. return Ext.emptyFn;
  4344. }
  4345. if (!_$2.startsWith(event, 'scope.') &&
  4346. !_$2.startsWith(event, 'system.') &&
  4347. !_$2.startsWith(event, 'format.')) {
  4348. console.error('无法识别的事件响应类型', event);
  4349. throw new TypeError('无法识别的事件响应类型');
  4350. }
  4351. // 为 eval 准备环境
  4352. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  4353. var data = scope.viewModel.data;
  4354. var keys = [];
  4355. var values = [];
  4356. _$2.forOwn(data, function (value, key) {
  4357. var idxKey = key.indexOf('//');
  4358. if (idxKey >= 0) {
  4359. keys.push(key.substr(0, idxKey));
  4360. }
  4361. else {
  4362. keys.push(key);
  4363. }
  4364. values.push(value);
  4365. });
  4366. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  4367. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  4368. if (typeof funcResult !== 'function') {
  4369. console.error('无法识别的事件响应类型', event, func, errorWho);
  4370. throw new TypeError('无法识别的事件响应类型');
  4371. }
  4372. return funcResult;
  4373. }
  4374. /**
  4375. * 从 ext.element 获取 scope 对象
  4376. */
  4377. function lookupScope(extHandle) {
  4378. if (!extHandle) {
  4379. // @ts-ignore
  4380. return;
  4381. }
  4382. if (extHandle.isScope) {
  4383. return extHandle;
  4384. }
  4385. if (extHandle.column) {
  4386. // 列上的组件
  4387. return extHandle.column.lookupReferenceHolder().yvanScope;
  4388. }
  4389. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  4390. if (typeof extHandle.lookupViewModel === 'function') {
  4391. var vm = extHandle.lookupViewModel();
  4392. return vm.yvanScope;
  4393. }
  4394. return;
  4395. }
  4396. //# sourceMappingURL=lib.js.map
  4397. /**
  4398. * 全局 ajax 方法
  4399. */
  4400. var ajax = {};
  4401. /**
  4402. * 计算拼音的函数
  4403. */
  4404. var pinyinFunc = function (str) { return (str); };
  4405. exports.scopeOnLoad = null;
  4406. exports.apiConvert = undefined;
  4407. var baseConfigProcessList = [];
  4408. /**
  4409. * 在基类添加 Config 的处理方法
  4410. */
  4411. function baseConfigProcess(option) {
  4412. return function (target, propertyKey) {
  4413. baseConfigProcessList.push(target[propertyKey]);
  4414. };
  4415. }
  4416. // let designMode: boolean = false
  4417. //
  4418. // export function isDesignMode(): boolean {
  4419. // return designMode
  4420. // }
  4421. //
  4422. // export function setDesignMode(v: boolean) {
  4423. // designMode = v
  4424. // }
  4425. /**
  4426. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  4427. */
  4428. function serverInvokeUrlTransform(url, option) {
  4429. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  4430. }
  4431. /**
  4432. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  4433. */
  4434. function sqlUrlTransform(url) {
  4435. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  4436. }
  4437. /**
  4438. * YvanUI 全局扩展配置
  4439. */
  4440. function extend(option) {
  4441. if (option.ajax) {
  4442. ajax.func = option.ajax;
  4443. }
  4444. if (option.serverInvokeUrlTransform) {
  4445. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  4446. }
  4447. if (option.sqlUrlTransform) {
  4448. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  4449. }
  4450. if (option.pinyinFunction) {
  4451. pinyinFunc = option.pinyinFunction;
  4452. }
  4453. if (option.scopeOnLoad) {
  4454. exports.scopeOnLoad = option.scopeOnLoad;
  4455. }
  4456. if (option.scopeOnCreate) {
  4457. exports.scopeOnCreate = option.scopeOnCreate;
  4458. }
  4459. if (option.apiConvert) {
  4460. exports.apiConvert = option.apiConvert;
  4461. }
  4462. // if (typeof option.designMode !== 'undefined') {
  4463. // setDesignMode(option.designMode)
  4464. // }
  4465. }
  4466. function getApiConvert() {
  4467. return exports.apiConvert;
  4468. }
  4469. function getScopeOnCreate() {
  4470. return exports.scopeOnCreate;
  4471. }
  4472. function getPinyin(v) {
  4473. return pinyinFunc(v);
  4474. }
  4475. /**
  4476. * 适用于 Select / Tree 等,作筛选的通用方法.
  4477. * 1.首字母模糊匹配(不区分大小写)
  4478. * 2.标识的模糊匹配(不区分大小写)
  4479. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  4480. */
  4481. function keywordFilter(keyword, label, value) {
  4482. if (!keyword) {
  4483. return true;
  4484. }
  4485. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  4486. // const labelPy = _.toLower(getPinyin(label))
  4487. //@ts-ignore
  4488. var labelPy = _$2.toLower(getFirstPinyin2(label));
  4489. value = _$2.toLower(_$2.trim(value));
  4490. var found = 0;
  4491. _$2.some(ws, function (word) {
  4492. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  4493. found++;
  4494. return;
  4495. }
  4496. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  4497. found++;
  4498. return;
  4499. }
  4500. });
  4501. return found >= ws.length;
  4502. }
  4503. //# sourceMappingURL=config.js.map
  4504. var Scope = /** @class */ (function () {
  4505. function Scope(_a) {
  4506. var model = _a.model, vjson = _a.vjson, i18n = _a.i18n;
  4507. /**
  4508. * 业务模块的唯一编号
  4509. */
  4510. this.id = _$2.uniqueId('scope_');
  4511. this.IS_DESIGN_MODE = false;
  4512. /**
  4513. * onload 运行完成之后才会设置本标记为 true
  4514. */
  4515. this.isLoadFinish = false;
  4516. this._isLoading = false;
  4517. this.model = model;
  4518. if (typeof vjson.layout === 'undefined') {
  4519. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  4520. var ret = buildPlus({ model: model, vjson: vjson });
  4521. model = ret.model;
  4522. vjson = ret.vjson;
  4523. }
  4524. this.originalVjson = _$2.cloneDeep(vjson);
  4525. this.vjson = this.originalVjson; // this.buildVjson()
  4526. var WMSTranslate = window["WMSTranslate"];
  4527. if (WMSTranslate) {
  4528. var i18nPath_1 = this.constructor.name;
  4529. if (i18n) {
  4530. WMSTranslate[i18nPath_1] = i18n;
  4531. }
  4532. this.vjson.i18nPath = i18nPath_1;
  4533. deepTravVJson(this.vjson, function (obj) {
  4534. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  4535. return;
  4536. }
  4537. obj.i18nPath = i18nPath_1;
  4538. });
  4539. }
  4540. var extScope = getScopeOnCreate();
  4541. if (typeof extScope === 'function') {
  4542. extScope({ vjson: vjson, model: model }, this);
  4543. }
  4544. }
  4545. Scope.prototype._addWatch = function (tplExpress, fn) {
  4546. if (!this._watchList) {
  4547. this._watchList = [];
  4548. }
  4549. this._watchList.push({ watch: tplExpress, fn: fn });
  4550. };
  4551. Scope.prototype._applyWatchList = function () {
  4552. var _this = this;
  4553. _$2.forEach(this._watchList, function (item) {
  4554. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  4555. });
  4556. };
  4557. Object.defineProperty(Scope.prototype, "isScope", {
  4558. get: function () {
  4559. return true;
  4560. },
  4561. enumerable: true,
  4562. configurable: true
  4563. });
  4564. /**
  4565. * 产生一个当前模块有效的唯一id
  4566. * @param key 唯一编号
  4567. */
  4568. Scope.prototype.uid = function (key) {
  4569. return this.id + key;
  4570. };
  4571. /**
  4572. * 对话框"保存"成功.
  4573. * 关闭对话框,并响应 success 方法
  4574. * @param data 要傳回的數據(可以為空)
  4575. */
  4576. Scope.prototype.dialogSuccess = function (data) {
  4577. this._handle.fireEvent('success', this, data);
  4578. var sender = this._handle.config.animateTarget;
  4579. var scope = lookupScope(sender);
  4580. if (typeof this['success'] === 'function') {
  4581. this['success'].call(scope, sender, data);
  4582. }
  4583. this.close();
  4584. };
  4585. /**
  4586. * 设置等待状态
  4587. * @param value
  4588. * @param msg
  4589. */
  4590. Scope.prototype.setLoading = function (value) {
  4591. var _a;
  4592. var scope = this;
  4593. this._isLoading = value;
  4594. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  4595. };
  4596. Scope.prototype.getLoading = function () {
  4597. return this._isLoading;
  4598. };
  4599. /**
  4600. * 以对话框模式打开当前模块
  4601. * @param sender 发送者(按钮或Scope对象)
  4602. * @param vjsonOption 界面覆盖选项(可以为空)
  4603. * @param dataOption 数据覆盖选项(可以为空)
  4604. */
  4605. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  4606. var _a;
  4607. var that = this;
  4608. var vmodel = _$2.defaultsDeep({
  4609. //
  4610. }, dataOption, that.model);
  4611. this.viewModel = new Ext.app.ViewModel(vmodel);
  4612. this.viewModel.yvanScope = this;
  4613. this._applyWatchList();
  4614. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4615. var config = _$2.defaultsDeep({
  4616. animateTarget: sender,
  4617. viewModel: this.viewModel,
  4618. yvanScope: this,
  4619. referenceHolder: true,
  4620. }, vjsonOption, that.vjson, windows);
  4621. if (config.height === 'unset') {
  4622. delete config.height;
  4623. }
  4624. if (config.width === 'unset') {
  4625. delete config.width;
  4626. }
  4627. // const holder = sender?.lookupReferenceHolder()
  4628. // delete config.constrain
  4629. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  4630. if (topScope) {
  4631. config.constrain = true;
  4632. this.topScope = topScope;
  4633. }
  4634. var win = new Ext.Window(config);
  4635. // if (holder) {
  4636. // holder.add(win)
  4637. // }
  4638. if (topScope) {
  4639. topScope._handle.add(win);
  4640. }
  4641. win.addListener('beforerender', function (sender) {
  4642. // 记录句柄
  4643. if (sender && !that._handle) {
  4644. that._handle = sender;
  4645. }
  4646. });
  4647. win.addListener('afterrender', function (sender) {
  4648. // 调用onLoad回调
  4649. try {
  4650. that._onLoad();
  4651. }
  4652. catch (e) {
  4653. console.error('errorAt onLoad', e);
  4654. }
  4655. window['cw'] = that;
  4656. });
  4657. win.addListener('destroy', this._destroy.bind(this));
  4658. win.show();
  4659. };
  4660. /**
  4661. * 以标签模式打开当前模块
  4662. * @param vjsonOption 界面覆盖选项(可以为空)
  4663. * @param dataOption 数据覆盖选项(可以为空)
  4664. */
  4665. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  4666. var _this = this;
  4667. var that = this;
  4668. this._vjsonOption = vjsonOption;
  4669. this._dataOption = dataOption;
  4670. var vmodel = _$2.defaultsDeep({
  4671. data: {}
  4672. }, dataOption, that.model);
  4673. this.viewModel = new Ext.app.ViewModel(vmodel);
  4674. this.viewModel.yvanScope = this;
  4675. this._applyWatchList();
  4676. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4677. // 根级不能设置id
  4678. delete that.vjson.id;
  4679. var config = _$2.defaultsDeep({
  4680. viewModel: this.viewModel,
  4681. yvanScope: this,
  4682. referenceHolder: true,
  4683. }, vjsonOption, that.vjson);
  4684. var tt = Ext.getCmp('TT');
  4685. var handle = tt.addScope(this, config, function (handle) {
  4686. handle.addListener('added', function (sender) {
  4687. // 记录句柄
  4688. if (sender && !that._handle) {
  4689. that._handle = sender;
  4690. }
  4691. });
  4692. handle.addListener('afterrender', function (sender) {
  4693. // 调用onLoad回调
  4694. try {
  4695. that._onLoad();
  4696. }
  4697. catch (e) {
  4698. console.error('errorAt onLoad', e);
  4699. }
  4700. });
  4701. handle.addListener('destroy', _this._destroy.bind(_this));
  4702. });
  4703. return handle;
  4704. };
  4705. /**
  4706. * 直接渲染到元素
  4707. * @param element 渲染目标
  4708. * @param vjsonOption 界面覆盖选项(可以为空)
  4709. * @param dataOption 数据覆盖选项(可以为空)
  4710. */
  4711. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  4712. var that = this;
  4713. this._vjsonOption = vjsonOption;
  4714. this._dataOption = dataOption;
  4715. var vmodel = _$2.defaultsDeep({
  4716. data: {}
  4717. }, that.model, dataOption);
  4718. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4719. this.viewModel = new Ext.app.ViewModel(vmodel);
  4720. this.viewModel.yvanScope = this;
  4721. this._applyWatchList();
  4722. var config = _$2.defaultsDeep({
  4723. viewModel: this.viewModel,
  4724. yvanScope: this,
  4725. referenceHolder: true,
  4726. renderTo: element,
  4727. listeners: {
  4728. afterrender: function (sender) {
  4729. var _a;
  4730. // 记录句柄
  4731. if (sender && !that._handle) {
  4732. that._handle = sender;
  4733. }
  4734. // 调用onLoad回调
  4735. that._onLoad();
  4736. // 如果vjson中配置了 afterrender ,需要恢复状态
  4737. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4738. },
  4739. },
  4740. }, vjsonOption, that.vjson);
  4741. new Ext.container.Viewport(config);
  4742. };
  4743. Scope.prototype.showDesigner = function (designer, option) {
  4744. var that = this;
  4745. var vmodel = _$2.defaultsDeep({
  4746. data: {
  4747. IS_DESIGN_MODE: true,
  4748. }
  4749. }, that.model);
  4750. this.IS_DESIGN_MODE = true;
  4751. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  4752. this.viewModel = new Ext.app.ViewModel(vmodel);
  4753. this.viewModel.yvanScope = this;
  4754. this._applyWatchList();
  4755. var config = _$2.defaultsDeep({
  4756. viewModel: this.viewModel,
  4757. yvanScope: this,
  4758. referenceHolder: true,
  4759. listeners: {
  4760. afterrender: function (sender) {
  4761. var _a;
  4762. // 记录句柄
  4763. if (sender && !that._handle) {
  4764. that._handle = sender;
  4765. }
  4766. // 调用onLoad回调
  4767. that._onLoad();
  4768. // 如果vjson中配置了 afterrender ,需要恢复状态
  4769. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4770. },
  4771. },
  4772. }, that.vjson);
  4773. designer.removeAll(true);
  4774. designer.add(config);
  4775. };
  4776. /**
  4777. * 关闭对话框(或标签页)
  4778. */
  4779. Scope.prototype.close = function () {
  4780. this._handle.close();
  4781. };
  4782. Object.defineProperty(Scope.prototype, "data", {
  4783. /**
  4784. * 获取 viewModel 里包含的数据(只读)
  4785. */
  4786. get: function () {
  4787. return this.viewModel.getData();
  4788. },
  4789. enumerable: true,
  4790. configurable: true
  4791. });
  4792. /**
  4793. * 设置 viewModel 中的数据
  4794. * 可以是 key, value 模式
  4795. * 也可以是 {key:value} 模式
  4796. */
  4797. Scope.prototype.set = function (path, value) {
  4798. return this.viewModel.set(path, value);
  4799. };
  4800. /**
  4801. * 寻找模块内所有的 xtype 对应的对象
  4802. * @param xtypeKey
  4803. */
  4804. Scope.prototype.down = function (xtypeKey) {
  4805. return this._handle.down(xtypeKey);
  4806. };
  4807. Object.defineProperty(Scope.prototype, "refs", {
  4808. /**
  4809. * 获取所有设置过 Reference 名称的组件
  4810. */
  4811. get: function () {
  4812. var _a, _b;
  4813. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  4814. },
  4815. enumerable: true,
  4816. configurable: true
  4817. });
  4818. Scope.prototype._destroy = function () {
  4819. var that = this;
  4820. that.onDestroy();
  4821. delete that._watchList;
  4822. delete that._handle;
  4823. this.isLoadFinish = false;
  4824. };
  4825. /**
  4826. * 私有渲染完成后的回调
  4827. */
  4828. Scope.prototype._onLoad = function () {
  4829. var _this = this;
  4830. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  4831. exports.scopeOnLoad(this);
  4832. }
  4833. this.onLoad();
  4834. _$2.defer(function () {
  4835. _this.isLoadFinish = true;
  4836. });
  4837. };
  4838. /**
  4839. * 默认 渲染完成之后调用的函数
  4840. */
  4841. Scope.prototype.onLoad = function () {
  4842. };
  4843. /**
  4844. * 组件卸载之后的回调
  4845. */
  4846. Scope.prototype.onDestroy = function () {
  4847. };
  4848. return Scope;
  4849. }());
  4850. /**
  4851. * 观察装饰器,viewModel 属性更改时触发成员方法
  4852. * @param tplExpress tpl表达式,例如 "{form.f1}"
  4853. */
  4854. function watch(tplExpress, deep) {
  4855. if (deep === void 0) { deep = false; }
  4856. return function (target, propertyKey, pd) {
  4857. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  4858. return target[propertyKey];
  4859. };
  4860. }
  4861. // 获取vjson的hash值
  4862. function getVjsonHash(str) {
  4863. var hash = 3465217896, i, ch;
  4864. for (i = str.length - 1; i >= 0; i--) {
  4865. ch = str.charCodeAt(i);
  4866. hash ^= ((hash << 5) + ch + (hash >> 2));
  4867. }
  4868. return (hash & 0x7FFFFFFF) + "";
  4869. }
  4870. function buildPlus(_a) {
  4871. var model = _a.model, vjson = _a.vjson;
  4872. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  4873. {
  4874. layout: 'border',
  4875. // tbar: vjson.action,
  4876. items: vjson.items,
  4877. },
  4878. ] });
  4879. if (_$2.isArray(vjson.action)) {
  4880. vjsonNew.items[0].tbar = vjson.action;
  4881. }
  4882. return { model: model, vjson: vjsonNew };
  4883. }
  4884. //# sourceMappingURL=Scope.js.map
  4885. var model = {
  4886. data: {
  4887. form: {
  4888. resource_parent: '',
  4889. resource_name: '',
  4890. resource_icon: '',
  4891. scope_url: '',
  4892. scope_params: '',
  4893. resource_order: '',
  4894. permission_code: '',
  4895. },
  4896. }
  4897. };
  4898. //# sourceMappingURL=RegisterModule.model.js.map
  4899. var vjson = {
  4900. title: '注册模块',
  4901. layout: 'fit',
  4902. width: "40%",
  4903. height: "50%",
  4904. fbar: {
  4905. xtype: 'toolbar',
  4906. items: [
  4907. {
  4908. xtype: "button",
  4909. text: "确定",
  4910. iconCls: 'x-fa fa-check',
  4911. listeners: {
  4912. click: 'scope.saveNode',
  4913. }
  4914. },
  4915. {
  4916. xtype: "button",
  4917. text: "关闭",
  4918. iconCls: 'x-fa fa-times',
  4919. listeners: {
  4920. click: 'system.closeMe()',
  4921. }
  4922. },
  4923. ]
  4924. },
  4925. items: [
  4926. {
  4927. layout: 'border',
  4928. items: [
  4929. {
  4930. region: 'west',
  4931. layout: 'fit',
  4932. xtype: 'tabpanel',
  4933. reference: 'tabs',
  4934. width: "50%",
  4935. split: true,
  4936. listeners: {
  4937. tabchange: 'scope.tabchange',
  4938. },
  4939. items: [
  4940. {
  4941. region: 'center',
  4942. layout: 'fit',
  4943. title: 'PC菜单',
  4944. key: "1",
  4945. items: [
  4946. {
  4947. xtype: 'treepanel',
  4948. layout: 'fit',
  4949. region: 'west',
  4950. rootVisible: false,
  4951. useArrows: true,
  4952. reference: 'tree1',
  4953. listeners: {
  4954. itemclick: "scope.tree1NodeClick",
  4955. }
  4956. },
  4957. ]
  4958. },
  4959. {
  4960. region: 'center',
  4961. layout: 'fit',
  4962. title: 'PDA菜单',
  4963. key: "2",
  4964. items: [
  4965. {
  4966. xtype: 'treepanel',
  4967. layout: 'fit',
  4968. region: 'west',
  4969. reference: 'tree2',
  4970. rootVisible: false,
  4971. useArrows: true,
  4972. listeners: {
  4973. itemclick: "scope.tree1NodeClick",
  4974. }
  4975. },
  4976. ]
  4977. },
  4978. ]
  4979. },
  4980. {
  4981. region: 'center',
  4982. xtype: 'form',
  4983. margin: '0 0 0 0',
  4984. split: true,
  4985. width: '50%',
  4986. items: [
  4987. {
  4988. xtype: 'cols',
  4989. items: [
  4990. {
  4991. xtype: 'textfield',
  4992. fieldLabel: '上级资源ID',
  4993. bind: {
  4994. readOnly: true,
  4995. disabled: true,
  4996. value: '{form.resource_parent}'
  4997. },
  4998. },
  4999. ],
  5000. },
  5001. {
  5002. xtype: 'cols',
  5003. items: [
  5004. {
  5005. xtype: 'textfield',
  5006. fieldLabel: '资源名称',
  5007. bind: {
  5008. value: '{form.resource_name}'
  5009. },
  5010. allowBlank: false,
  5011. },
  5012. ],
  5013. },
  5014. {
  5015. xtype: 'cols',
  5016. items: [
  5017. {
  5018. xtype: 'numberfield',
  5019. fieldLabel: '资源排序',
  5020. bind: {
  5021. value: '{form.resource_order}'
  5022. },
  5023. allowBlank: false,
  5024. },
  5025. ],
  5026. },
  5027. {
  5028. xtype: 'cols',
  5029. items: [
  5030. {
  5031. xtype: 'textfield',
  5032. fieldLabel: '功能URL',
  5033. bind: {
  5034. disabled: true,
  5035. value: '{form.scope_url}'
  5036. },
  5037. },
  5038. ]
  5039. },
  5040. {
  5041. xtype: 'cols',
  5042. items: [
  5043. {
  5044. xtype: 'textfield',
  5045. fieldLabel: '权限编码',
  5046. bind: {
  5047. value: '{form.permission_code}'
  5048. }
  5049. },
  5050. ],
  5051. },
  5052. {
  5053. xtype: 'cols',
  5054. items: [
  5055. {
  5056. xtype: 'textfield',
  5057. fieldLabel: '功能参数',
  5058. bind: {
  5059. value: '{form.scope_params}'
  5060. }
  5061. },
  5062. ],
  5063. },
  5064. ],
  5065. },
  5066. ],
  5067. },
  5068. ],
  5069. referenceHolder: true,
  5070. };
  5071. //# sourceMappingURL=RegisterModule.view.js.map
  5072. var RegisterModule = /** @class */ (function (_super) {
  5073. __extends(RegisterModule, _super);
  5074. function RegisterModule() {
  5075. return _super.call(this, { model: model, vjson: vjson }) || this;
  5076. }
  5077. RegisterModule.prototype.onLoad = function () {
  5078. this.reloadTree("PC");
  5079. };
  5080. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  5081. var currTabKey = b.key;
  5082. if (currTabKey === '1') {
  5083. this.viewModel.set('form', '');
  5084. this.reloadTree("PC");
  5085. }
  5086. else {
  5087. this.viewModel.set('form', '');
  5088. this.reloadTree("PDA");
  5089. }
  5090. };
  5091. RegisterModule.prototype.reloadTree = function (type) {
  5092. var _this = this;
  5093. if ("PC" === type) {
  5094. this.setLoading(true);
  5095. getMenuTree({ type: "PC" }).then(function (res) {
  5096. if (res.success) {
  5097. _this.refs.tree1.store.setRootNode({
  5098. expanded: true,
  5099. children: res.data
  5100. });
  5101. }
  5102. }).finally(function () {
  5103. _this.setLoading(false);
  5104. });
  5105. }
  5106. else {
  5107. this.setLoading(true);
  5108. getMenuTree({ type: "PDA" }).then(function (res) {
  5109. if (res.success) {
  5110. _this.refs.tree2.store.setRoot({
  5111. expanded: true,
  5112. children: res.data
  5113. });
  5114. }
  5115. }).finally(function () {
  5116. _this.setLoading(false);
  5117. });
  5118. }
  5119. };
  5120. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  5121. var id = _$2.split(node.data.id, '_')[1];
  5122. if (!id) {
  5123. return;
  5124. }
  5125. this.viewModel.set('form.resource_parent', id);
  5126. };
  5127. RegisterModule.prototype.saveNode = function () {
  5128. var _this = this;
  5129. var tabKey = this.refs.tabs.activeTab.key;
  5130. // 检验菜单数据
  5131. var param = this.viewModel.get('form');
  5132. if (!param.resource_parent) {
  5133. msg('请选择一个父节点');
  5134. return;
  5135. }
  5136. if (!param.resource_name) {
  5137. msg('资源名称不能为空');
  5138. return;
  5139. }
  5140. if (!param.scope_url) {
  5141. msg('功能URL不能为空');
  5142. return;
  5143. }
  5144. var type;
  5145. if (tabKey === '1') {
  5146. type = 'PC';
  5147. }
  5148. else {
  5149. type = 'PDA';
  5150. }
  5151. this.setLoading(true);
  5152. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  5153. if (res.success) {
  5154. msg("注册成功");
  5155. _this.close();
  5156. }
  5157. }).finally(function () {
  5158. _this.setLoading(false);
  5159. });
  5160. };
  5161. return RegisterModule;
  5162. }(Scope));
  5163. //# sourceMappingURL=RegisterModule.js.map
  5164. var model$1 = {
  5165. data: {
  5166. title: "模板选择",
  5167. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  5168. moduleType: 1,
  5169. // 当前模块包路径 "com/galaxis/wms/bas/area"
  5170. packagePath: "",
  5171. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  5172. fileSavePath: "",
  5173. // 模块名称 "Dict"
  5174. moduleName: "NewModule",
  5175. // 页面标题 "字典维护"
  5176. pageTitle: "新模块",
  5177. // 单表查询
  5178. singleTable: {
  5179. sql: "select * from bas_dict",
  5180. // 新增或者删除所用的表
  5181. tableName: "",
  5182. // 是否分页查询
  5183. pagination: true,
  5184. // 是否需要删除
  5185. delete: true,
  5186. // 删除条件字段
  5187. deleteWhereColumn: "",
  5188. // 删除提示语
  5189. deleteTips: "确定要删除?",
  5190. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  5191. editType: 2,
  5192. },
  5193. singleTableView: {
  5194. tableNameList: [
  5195. // { value: "aaa"},
  5196. ],
  5197. columnList: [
  5198. // { value: "aaa"},
  5199. ],
  5200. }
  5201. }
  5202. };
  5203. //# sourceMappingURL=CreateModule.model.js.map
  5204. var vjson$1 = {
  5205. bind: {
  5206. title: '新建模块-{title}',
  5207. },
  5208. width: "55%",
  5209. height: "60%",
  5210. minWidth: 500,
  5211. minHeight: 400,
  5212. modal: true,
  5213. frame: true,
  5214. layout: 'card',
  5215. bbar: [
  5216. '->',
  5217. {
  5218. itemId: 'card-prev',
  5219. text: '&laquo; 上一步',
  5220. disabled: true,
  5221. listeners: {
  5222. click: 'scope.showPrevious',
  5223. },
  5224. },
  5225. {
  5226. itemId: 'card-next',
  5227. text: '下一步 &raquo;',
  5228. listeners: {
  5229. click: 'scope.showNext',
  5230. },
  5231. },
  5232. {
  5233. itemId: 'card-finish',
  5234. text: '立刻执行',
  5235. iconCls: 'x-fa fa-flash',
  5236. hidden: true,
  5237. listeners: {
  5238. click: 'scope.finish',
  5239. },
  5240. },
  5241. ],
  5242. items: [
  5243. {
  5244. vtitle: '模板选择',
  5245. reference: 'templateSelection',
  5246. layout: {
  5247. type: 'hbox',
  5248. pack: 'start',
  5249. align: 'stretch'
  5250. },
  5251. listeners: {
  5252. cardEnter: 'scope.templateEnter',
  5253. cardLevel: 'scope.templateLevel'
  5254. },
  5255. items: [
  5256. {
  5257. width: 150,
  5258. xtype: 'form',
  5259. border: false,
  5260. layout: {
  5261. type: 'vbox',
  5262. align: 'stretch'
  5263. },
  5264. defaults: {
  5265. border: false,
  5266. anchor: '100%',
  5267. margin: '5',
  5268. },
  5269. items: [
  5270. {
  5271. xtype: 'radiogroup',
  5272. bind: {
  5273. value: '{moduleType}'
  5274. },
  5275. layout: 'vbox',
  5276. defaults: {
  5277. border: false,
  5278. anchor: '100%',
  5279. margin: '5',
  5280. },
  5281. items: [
  5282. { boxLabel: '单表查询', inputValue: 1 },
  5283. { boxLabel: '主/明细查询', inputValue: 2 },
  5284. { boxLabel: '树/明细查询', inputValue: 3 },
  5285. { boxLabel: '卡片表单', inputValue: 4 },
  5286. { boxLabel: '主/详情查询', inputValue: 5 },
  5287. ]
  5288. },
  5289. ]
  5290. },
  5291. {
  5292. flex: 1,
  5293. region: 'center',
  5294. xtype: "panel",
  5295. border: false,
  5296. frame: true,
  5297. padding: "4px 8px",
  5298. html: "描述...",
  5299. }
  5300. ]
  5301. },
  5302. {
  5303. vtitle: '模块名称',
  5304. reference: 'moduleName',
  5305. layout: 'fit',
  5306. listeners: {
  5307. cardEnter: 'scope.moduleEnter',
  5308. cardLevel: 'scope.moduleLevel'
  5309. },
  5310. items: [
  5311. {
  5312. xtype: 'form',
  5313. border: false,
  5314. layout: {
  5315. type: 'vbox',
  5316. align: 'stretch'
  5317. },
  5318. defaults: {
  5319. border: false,
  5320. anchor: '100%',
  5321. margin: '5',
  5322. },
  5323. items: [
  5324. {
  5325. xtype: 'textfield',
  5326. fieldLabel: '包路径',
  5327. allowBlank: false,
  5328. bind: { value: '{packagePath}' },
  5329. },
  5330. {
  5331. xtype: 'textfield',
  5332. fieldLabel: '文件路径',
  5333. allowBlank: false,
  5334. bind: { value: '{fileSavePath}' },
  5335. },
  5336. {
  5337. xtype: 'textfield',
  5338. fieldLabel: '模块名',
  5339. allowBlank: false,
  5340. bind: { value: '{moduleName}' },
  5341. },
  5342. {
  5343. xtype: 'textfield',
  5344. fieldLabel: '菜单名',
  5345. allowBlank: false,
  5346. bind: { value: '{pageTitle}' },
  5347. },
  5348. ]
  5349. },
  5350. ]
  5351. },
  5352. {
  5353. vtitle: '确认结果',
  5354. reference: 'confirmResult',
  5355. layout: 'fit',
  5356. listeners: {
  5357. cardEnter: 'scope.optionEnter',
  5358. cardLevel: 'scope.optionLevel',
  5359. },
  5360. items: [
  5361. {
  5362. xtype: 'jsoneditor',
  5363. reference: 'jsoneditor'
  5364. }
  5365. ]
  5366. },
  5367. // ---------------------------------------------------------------------------------- 单表查询
  5368. {
  5369. vtitle: '查询SQL',
  5370. reference: 'singleTable_1',
  5371. layout: 'fit',
  5372. listeners: {
  5373. cardEnter: 'scope.editorEnter',
  5374. cardLevel: 'scope.editorLevel'
  5375. },
  5376. items: [
  5377. {
  5378. xtype: 'sqleditor',
  5379. }
  5380. ],
  5381. },
  5382. {
  5383. vtitle: '字段选项',
  5384. reference: 'singleTable_2',
  5385. layout: 'fit',
  5386. listeners: {
  5387. cardEnter: 'scope.columnEnter',
  5388. cardLevel: 'scope.columnLevel',
  5389. },
  5390. items: [
  5391. {
  5392. xtype: 'yvgrid',
  5393. border: false,
  5394. selModel: {
  5395. type: 'spreadsheet',
  5396. columnSelect: true,
  5397. pruneRemoved: false,
  5398. extensible: 'y'
  5399. },
  5400. plugins: {
  5401. clipboard: true,
  5402. selectionreplicator: true
  5403. },
  5404. reference: 'grid1',
  5405. idField: 'column_name',
  5406. hideFootbar: true,
  5407. tbar: {
  5408. xtype: 'toolbar',
  5409. items: [
  5410. {
  5411. xtype: 'button',
  5412. text: '添加',
  5413. iconCls: 'x-fa fa-plus-circle',
  5414. listeners: {
  5415. click: 'scope.addField'
  5416. }
  5417. },
  5418. {
  5419. xtype: 'button',
  5420. text: '删除',
  5421. iconCls: 'x-fa fa-minus-circle',
  5422. listeners: {
  5423. click: 'scope.removeField'
  5424. }
  5425. },
  5426. {
  5427. xtype: 'button',
  5428. text: '分析SQL',
  5429. iconCls: 'x-fa fa-refresh',
  5430. listeners: {
  5431. click: 'scope.parseSQL'
  5432. }
  5433. },
  5434. ]
  5435. },
  5436. columns: [
  5437. {
  5438. text: '字段名', dataIndex: 'column_name',
  5439. sortable: false,
  5440. menuDisabled: true,
  5441. width: 150,
  5442. editor: {
  5443. allowBlank: true,
  5444. selectOnFocus: false,
  5445. }
  5446. },
  5447. {
  5448. text: '字段中文', dataIndex: 'column_comment',
  5449. width: 150,
  5450. sortable: false,
  5451. menuDisabled: true,
  5452. editor: {
  5453. allowBlank: true,
  5454. selectOnFocus: false,
  5455. }
  5456. },
  5457. {
  5458. dataIndex: "column_useto",
  5459. // fix: ['system.getDict("column_useto")'],
  5460. header: "用途",
  5461. editor: {
  5462. xtype: 'combo',
  5463. allowBlank: false,
  5464. },
  5465. },
  5466. {
  5467. text: '主键', dataIndex: 'is_primary_key',
  5468. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5469. width: 48, resizable: false,
  5470. },
  5471. {
  5472. text: '必填', dataIndex: 'not_null',
  5473. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5474. width: 48, resizable: false,
  5475. },
  5476. {
  5477. text: '长度', dataIndex: 'column_size',
  5478. sortable: false, menuDisabled: true,
  5479. xtype: 'numbercolumn', format: '0',
  5480. editor: { allowBlank: true, selectOnFocus: true }
  5481. },
  5482. {
  5483. text: '字典', dataIndex: 'column_dict',
  5484. sortable: false, menuDisabled: true,
  5485. width: 200,
  5486. editor: {
  5487. allowBlank: true,
  5488. }
  5489. },
  5490. {
  5491. text: 'UI组件', dataIndex: 'column_ui',
  5492. sortable: false, menuDisabled: true,
  5493. // fix: ['system.getDict("column_ui")'],
  5494. width: 150,
  5495. editor: {
  5496. xtype: 'combo',
  5497. allowBlank: true,
  5498. }
  5499. },
  5500. {
  5501. dataIndex: 'data_type',
  5502. hidden: true,
  5503. },
  5504. ]
  5505. }
  5506. ],
  5507. },
  5508. {
  5509. vtitle: '其他选项',
  5510. reference: 'singleTable_3',
  5511. isEnd: true,
  5512. listeners: {
  5513. cardEnter: 'scope.extendEnter',
  5514. cardLevel: 'scope.extendLevel',
  5515. },
  5516. layout: 'fit',
  5517. items: [
  5518. {
  5519. xtype: 'form',
  5520. border: false,
  5521. layout: {
  5522. type: 'vbox',
  5523. align: 'stretch'
  5524. },
  5525. defaults: {
  5526. border: false,
  5527. anchor: '100%',
  5528. margin: '5',
  5529. },
  5530. items: [
  5531. {
  5532. xtype: 'checkbox',
  5533. fieldLabel: '需要分页',
  5534. labelWidth: 100,
  5535. bind: {
  5536. value: '{singleTable.pagination}',
  5537. },
  5538. },
  5539. {
  5540. xtype: 'combobox',
  5541. fieldLabel: '操作数据库表',
  5542. labelWidth: 100,
  5543. publishes: 'singleTable.tableName',
  5544. displayField: 'value',
  5545. valueField: 'value',
  5546. bind: {
  5547. data: '{singleTableView.tableNameList}',
  5548. value: '{singleTable.tableName}',
  5549. },
  5550. },
  5551. {
  5552. xtype: 'checkboxfield',
  5553. fieldLabel: '需要删除',
  5554. labelWidth: 100,
  5555. bind: {
  5556. value: '{singleTable.delete}',
  5557. },
  5558. },
  5559. {
  5560. xtype: 'combobox',
  5561. fieldLabel: '删除条件字段',
  5562. labelWidth: 100,
  5563. publishes: 'singleTable.deleteWhereColumn',
  5564. displayField: 'value',
  5565. valueField: 'value',
  5566. bind: {
  5567. data: '{singleTableView.columnList}',
  5568. hidden: '{!singleTable.delete}',
  5569. value: '{singleTable.deleteWhereColumn}',
  5570. },
  5571. },
  5572. {
  5573. xtype: 'textfield',
  5574. fieldLabel: '删除提示语句',
  5575. labelWidth: 100,
  5576. bind: {
  5577. hidden: '{!singleTable.delete}',
  5578. value: '{singleTable.deleteTips}',
  5579. },
  5580. },
  5581. {
  5582. fieldLabel: '新增与编辑',
  5583. labelWidth: 100,
  5584. xtype: 'radiogroup',
  5585. bind: {
  5586. value: '{singleTable.editType}'
  5587. },
  5588. layout: 'vbox',
  5589. defaults: {
  5590. border: false,
  5591. anchor: '100%',
  5592. margin: '5',
  5593. },
  5594. items: [
  5595. { boxLabel: '不要新增和编辑', inputValue: 1 },
  5596. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  5597. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  5598. ]
  5599. },
  5600. ]
  5601. }
  5602. ]
  5603. },
  5604. // ---------------------------------------------------------------------------------- 主/明细查询
  5605. {
  5606. vtitle: '主表查询SQL',
  5607. reference: 'mainDetailTable_1',
  5608. layout: 'fit',
  5609. listeners: {},
  5610. items: [],
  5611. },
  5612. {
  5613. vtitle: '主表字段选项',
  5614. reference: 'mainDetailTable_2',
  5615. layout: 'fit',
  5616. listeners: {},
  5617. items: [],
  5618. },
  5619. {
  5620. vtitle: '主表其他选项',
  5621. reference: 'mainDetailTable_3',
  5622. layout: 'fit',
  5623. listeners: {},
  5624. items: [],
  5625. },
  5626. {
  5627. vtitle: '子表查询SQL',
  5628. reference: 'mainDetailTable_4',
  5629. layout: 'fit',
  5630. listeners: {},
  5631. items: [],
  5632. },
  5633. {
  5634. vtitle: '子表字段选项',
  5635. reference: 'mainDetailTable_5',
  5636. layout: 'fit',
  5637. listeners: {},
  5638. items: [],
  5639. },
  5640. {
  5641. vtitle: '子表其他选项',
  5642. reference: 'mainDetailTable_6',
  5643. isEnd: true,
  5644. layout: 'fit',
  5645. listeners: {},
  5646. items: [],
  5647. },
  5648. // ---------------------------------------------------------------------------------- 树/明细查询
  5649. // ---------------------------------------------------------------------------------- 卡片表单
  5650. {
  5651. vtitle: '表单字段',
  5652. reference: 'cardForm_1',
  5653. layout: 'fit',
  5654. listeners: {},
  5655. items: [],
  5656. },
  5657. {
  5658. vtitle: '表单初始化',
  5659. reference: 'cardForm_2',
  5660. isEnd: true,
  5661. layout: 'fit',
  5662. listeners: {},
  5663. items: [],
  5664. },
  5665. ]
  5666. };
  5667. //# sourceMappingURL=CreateModule.view.js.map
  5668. var DbStore = /** @class */ (function (_super) {
  5669. __extends(DbStore, _super);
  5670. function DbStore() {
  5671. return _super !== null && _super.apply(this, arguments) || this;
  5672. }
  5673. DbStore.prototype.getCacheKey = function (param) {
  5674. return "db_data.json";
  5675. };
  5676. DbStore.prototype.invokeApi = function (param) {
  5677. return getMateData(param);
  5678. };
  5679. /**
  5680. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  5681. */
  5682. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  5683. return new Promise(function (resolve, reject) {
  5684. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  5685. resolve(res1);
  5686. // TODO 好像不需要,先跳过
  5687. // reloadByTableName(schema_name, table_name).then(res2 => {
  5688. // resolve(res1)
  5689. // }).catch(e => {
  5690. // reject(e)
  5691. // })
  5692. }).catch(function (e) {
  5693. reject(e);
  5694. });
  5695. });
  5696. };
  5697. /**
  5698. * 保存元数据至表格
  5699. */
  5700. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  5701. var _this = this;
  5702. return new Promise(function (resolve, reject) {
  5703. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  5704. // 保存后重新刷新
  5705. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  5706. resolve({
  5707. data: res2,
  5708. msg: res1.msg
  5709. });
  5710. }).catch(function (e) {
  5711. reject(e);
  5712. });
  5713. }).catch(function (e) {
  5714. reject(e);
  5715. });
  5716. });
  5717. };
  5718. /**
  5719. * 预览生成的 DDL 语句
  5720. */
  5721. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  5722. return new Promise(function (resolve, reject) {
  5723. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  5724. .then(function (res) {
  5725. resolve(res);
  5726. });
  5727. });
  5728. };
  5729. /**
  5730. * 执行 DDL
  5731. */
  5732. DbStore.prototype.pushToDbCommit = function (arg) {
  5733. return new Promise(function (resolve, reject) {
  5734. pushToDbCommitApi(arg).then(function (res) {
  5735. resolve(res);
  5736. }).catch(function (e) {
  5737. reject(e);
  5738. });
  5739. });
  5740. };
  5741. /**
  5742. * 重读某一个表格的 meta 元数据
  5743. */
  5744. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  5745. var _this = this;
  5746. return new Promise(function (resolve, reject) {
  5747. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  5748. if (!res[0] || !res[0].table_list[0]) {
  5749. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  5750. return;
  5751. }
  5752. var tableRow = _this.getTableByName(schema_name, table_name);
  5753. if (!tableRow) {
  5754. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  5755. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  5756. if (!schemaRow) {
  5757. showErrorDialog$1('没有找到 schema:' + schema_name);
  5758. return;
  5759. }
  5760. schemaRow.table_list.push(res[0].table_list[0]);
  5761. }
  5762. else {
  5763. // 找到了目标表格,就吧 table 所有属性都赋值过去
  5764. Object.assign(tableRow, res[0].table_list[0]);
  5765. }
  5766. // 所有界面通知一遍刷新
  5767. _this.notifyRefresh();
  5768. resolve(res);
  5769. }).catch(function (e) {
  5770. reject(e);
  5771. });
  5772. });
  5773. };
  5774. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  5775. var result = undefined;
  5776. _$2.forEach(this.apiResponse, function (schemaRow) {
  5777. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  5778. if (tableRow) {
  5779. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  5780. if (columnRow) {
  5781. result = columnRow;
  5782. return false;
  5783. }
  5784. }
  5785. });
  5786. return result;
  5787. };
  5788. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  5789. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  5790. if (!schemaRow) {
  5791. showErrorDialog$1('没有找到 schema:' + schemaName);
  5792. return;
  5793. }
  5794. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  5795. if (!schemaRow) {
  5796. showErrorDialog$1('没有找到 table:' + tableName);
  5797. return;
  5798. }
  5799. return tableRow;
  5800. };
  5801. /**
  5802. * 添加一个新表格
  5803. */
  5804. DbStore.prototype.appendNewTable = function (tableInfo) {
  5805. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  5806. if (!schemaRow) {
  5807. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  5808. return;
  5809. }
  5810. schemaRow.table_list.push(tableInfo);
  5811. };
  5812. /**
  5813. * 从数据库结构重新生成元数据
  5814. */
  5815. DbStore.prototype.dbToMetaAndReload = function () {
  5816. var _this = this;
  5817. this.notifyLoading(true);
  5818. dbToMeta().then(function () {
  5819. _this.reloadForce(undefined);
  5820. }).catch(function (e) {
  5821. _this.notifyLoading(false);
  5822. });
  5823. };
  5824. DbStore.prototype.getSchemaDbType = function (schemaName) {
  5825. var dbType = undefined;
  5826. _$2.forEach(this.apiResponse, function (schemaRow) {
  5827. if (schemaRow.schema_name === schemaName) {
  5828. dbType = schemaRow.db_type;
  5829. return false;
  5830. }
  5831. });
  5832. return dbType;
  5833. };
  5834. return DbStore;
  5835. }(CacheStore));
  5836. function syncQueryDSL(_a) {
  5837. var schema_name = _a.schema_name, table_name = _a.table_name;
  5838. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  5839. }
  5840. var instance = new DbStore();
  5841. // // 字段域数据
  5842. // let columnDomain = undefined
  5843. // // 元数据
  5844. // let apiResponse = []
  5845. //
  5846. // // 订阅
  5847. // const subscribeList = []
  5848. // /**
  5849. // * 获取全部元数据
  5850. // */
  5851. // export function getApiResponse() {
  5852. // return apiResponse
  5853. // }
  5854. //
  5855. // export function getColumnDomain() {
  5856. // return columnDomain
  5857. // }
  5858. // window['getApiResponse'] = getApiResponse
  5859. // window['getColumnDomain'] = getColumnDomain
  5860. // window['getDbTreeStore'] = function () {
  5861. // return apiResponse
  5862. // }
  5863. //
  5864. // /**
  5865. // * 订阅结果集
  5866. // */
  5867. // export function subscribe(fn) {
  5868. // subscribeList.push(fn)
  5869. // }
  5870. //
  5871. // /**
  5872. // * 取消订阅
  5873. // */
  5874. // export function describe(fn) {
  5875. // _.remove(subscribeList, item => item === fn)
  5876. // }
  5877. //
  5878. // /**
  5879. // * 刷新,如果前端从来没有取到过结果的话
  5880. // * 如果强制刷新成功,就返回 true
  5881. // * 如果没有被强制刷新,返回 false
  5882. // */
  5883. // export function reloadIfNeed() {
  5884. // if (_.size(apiResponse) <= 0) {
  5885. // reloadForce()
  5886. // return true
  5887. // }
  5888. // return false
  5889. // }
  5890. //
  5891. // export function reloadIfNeedPromise() {
  5892. // return new Promise((resolve, reject) => {
  5893. // if (_.size(apiResponse) <= 0) {
  5894. // // 从未有获取过值
  5895. // reloadForce().then(res => {
  5896. // resolve(apiResponse)
  5897. // })
  5898. // return
  5899. // }
  5900. // resolve(apiResponse)
  5901. // return
  5902. // })
  5903. // }
  5904. //
  5905. // /**
  5906. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  5907. // */
  5908. // export function reloadForce() {
  5909. // _.forEach(subscribeList, fn => {
  5910. // fn(true)
  5911. // })
  5912. //
  5913. // return getMateData().then((content) => {
  5914. // apiResponse = content
  5915. // _.forEach(subscribeList, fn => {
  5916. // fn(apiResponse)
  5917. // })
  5918. // }).finally(() => {
  5919. // _.forEach(subscribeList, fn => {
  5920. // fn(false)
  5921. // })
  5922. // })
  5923. // }
  5924. //
  5925. // /**
  5926. // * 通知刷新元数据
  5927. // */
  5928. // export function notifyRefresh() {
  5929. // _.forEach(subscribeList, fn => {
  5930. // fn(apiResponse)
  5931. // })
  5932. // }
  5933. // export function getAllDomain() {
  5934. // return new Promise((resolve, reject) => {
  5935. // getColumnDomainApi()
  5936. // .then(res => {
  5937. // if (res.success) {
  5938. // columnDomain = res.data
  5939. // resolve(res.data)
  5940. // } else {
  5941. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  5942. // console.error('getColumnDomain', res.msg)
  5943. // }
  5944. //
  5945. // })
  5946. // .catch(e => {
  5947. // showErrorDialog('getColumnDomain error!')
  5948. // console.error('getColumnDomain', e)
  5949. // reject(e)
  5950. // })
  5951. // })
  5952. // }
  5953. //# sourceMappingURL=DbStore.js.map
  5954. // noinspection TypeScriptCheckImport
  5955. function getSingleTableData(origin) {
  5956. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  5957. var _a, _b, _c;
  5958. var data = {
  5959. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  5960. package: _$2.replace(origin.packagePath, /\//g, "."),
  5961. groovyClass: origin.moduleName,
  5962. qClass: queryDslInfo.qClass,
  5963. qClassTable: queryDslInfo.qClassTable,
  5964. queryColumns: [],
  5965. insertColumns: [],
  5966. updateColumns: [],
  5967. updateWheres: [],
  5968. deleteWheres: [],
  5969. gridColumns: [],
  5970. sql: origin.sql,
  5971. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  5972. addButton: origin.editType !== 1,
  5973. saveButton: origin.editType === 2,
  5974. deleteButton: true,
  5975. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  5976. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  5977. fileSavePath: origin.fileSavePath,
  5978. };
  5979. origin.columnList.forEach(function (column) {
  5980. 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;
  5981. var query = origin.queryColumns.indexOf(column_name) >= 0;
  5982. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  5983. var update = origin.updateColumns.indexOf(column_name) >= 0;
  5984. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  5985. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  5986. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  5987. if (query) {
  5988. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  5989. }
  5990. if (insert) {
  5991. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  5992. }
  5993. if (update) {
  5994. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  5995. }
  5996. if (grid) {
  5997. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  5998. if (column_dict) {
  5999. gridColumn.fix = { dictName: column_dict };
  6000. }
  6001. if (origin.editType == 2 && (insert || update)) {
  6002. gridColumn.editor = { xtype: column_ui, fix: undefined };
  6003. if (column_dict) {
  6004. gridColumn.editor.fix = { dictName: column_dict };
  6005. }
  6006. }
  6007. data.gridColumns.push(gridColumn);
  6008. }
  6009. if (is_primary_key) {
  6010. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6011. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6012. }
  6013. });
  6014. return data;
  6015. });
  6016. }
  6017. // noinspection HttpUrlsUsage
  6018. var urlPrefix = "/static/studio-template/single_table";
  6019. function generateCode(data) {
  6020. return Promise.all([
  6021. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  6022. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  6023. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  6024. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  6025. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  6026. ]).then(function (values) {
  6027. var groovy = handlebars.compile(values[0]);
  6028. var mybatis = handlebars.compile(values[1]);
  6029. var controller = handlebars.compile(values[2]);
  6030. var view = handlebars.compile(values[3]);
  6031. var model = handlebars.compile(values[4]);
  6032. var code = {
  6033. groovy: groovy(data),
  6034. mybatis: mybatis(data),
  6035. controller: controller(data),
  6036. view: view(data),
  6037. model: model(data),
  6038. };
  6039. return code;
  6040. });
  6041. }
  6042. //# sourceMappingURL=SingleTableCodegen.js.map
  6043. var CreateModule = /** @class */ (function (_super) {
  6044. __extends(CreateModule, _super);
  6045. function CreateModule() {
  6046. var _this = _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  6047. _this.columns = [];
  6048. return _this;
  6049. }
  6050. CreateModule.prototype.onLoad = function () {
  6051. this.refs.grid1.setData([]);
  6052. };
  6053. CreateModule.prototype.addField = function () {
  6054. this.refs.grid1.appendEditRow({
  6055. column_name: '',
  6056. column_comment: '',
  6057. is_primary_key: false,
  6058. not_null: true,
  6059. column_domain: '',
  6060. data_type: '',
  6061. column_size: 0,
  6062. decimal_digits: 0,
  6063. default_value: '',
  6064. column_dict: '',
  6065. column_ui: '',
  6066. column_note: '',
  6067. }, 0);
  6068. };
  6069. CreateModule.prototype.removeField = function () {
  6070. var _this = this;
  6071. var rows = [];
  6072. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6073. rows.push(r);
  6074. });
  6075. _$2.forEach(rows, function (r) {
  6076. _this.refs.grid1.getStore().remove(r);
  6077. });
  6078. };
  6079. CreateModule.prototype.parseSQL = function (sender) {
  6080. var _this = this;
  6081. var sql = this.viewModel.get('singleTable.sql');
  6082. sender.up('window').setLoading(true);
  6083. instance.reloadIfNeedPromise(undefined).then(function (res) {
  6084. parseSqlApi(sql).then(function (parseResult) {
  6085. if (!parseResult.success) {
  6086. msg(parseResult.msg);
  6087. return;
  6088. }
  6089. var tableNameList = [];
  6090. var columnList = [];
  6091. var singleTableTableName;
  6092. var singleTableDeleteWhereColumn;
  6093. _this.refs.grid1.setData([]);
  6094. var rows = _this.refs.grid1.getDataRows();
  6095. _$2.forEach(parseResult.data, function (parseRetColumn) {
  6096. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  6097. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  6098. return;
  6099. }
  6100. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  6101. tableNameList.push({ value: tableName });
  6102. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  6103. columnList.push({ value: columnName });
  6104. if (!singleTableTableName)
  6105. singleTableTableName = tableName;
  6106. if (!singleTableDeleteWhereColumn)
  6107. singleTableDeleteWhereColumn = columnName;
  6108. // 已经加过这个列了
  6109. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  6110. if (rowExists) {
  6111. return;
  6112. }
  6113. var columnRow = instance.getColumnByTableNameColumnName(tableName, columnName);
  6114. if (columnRow) {
  6115. _this.refs.grid1.appendEditRow({
  6116. table_name: tableName,
  6117. column_name: columnRow.column_name,
  6118. column_comment: columnRow.column_comment,
  6119. column_useto: 2,
  6120. is_primary_key: columnRow.is_primary_key,
  6121. not_null: columnRow.not_null,
  6122. column_size: columnRow.column_size,
  6123. column_dict: columnRow.column_dict,
  6124. column_ui: columnRow.column_ui,
  6125. data_type: columnRow.data_type,
  6126. });
  6127. if (columnRow.is_primary_key)
  6128. singleTableDeleteWhereColumn = columnName;
  6129. }
  6130. else {
  6131. _this.refs.grid1.appendEditRow({
  6132. table_name: tableName,
  6133. column_name: columnName,
  6134. column_useto: 2,
  6135. });
  6136. }
  6137. });
  6138. _this.viewModel.set("singleTableView.columnList", columnList);
  6139. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  6140. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  6141. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  6142. }).finally(function () {
  6143. sender.up('window').setLoading(false);
  6144. });
  6145. }).catch(function () {
  6146. sender.up('window').setLoading(false);
  6147. });
  6148. };
  6149. CreateModule.prototype.templateEnter = function (sender) {
  6150. };
  6151. CreateModule.prototype.templateLevel = function (sender, opt) {
  6152. if (!this.viewModel.get('moduleType')) {
  6153. msg('请选择模板类型');
  6154. opt.cancel = true;
  6155. return;
  6156. }
  6157. };
  6158. CreateModule.prototype.moduleEnter = function (sender) {
  6159. };
  6160. CreateModule.prototype.moduleLevel = function (sender, opt) {
  6161. if (!sender.down('form').isValid()) {
  6162. opt.cancel = true;
  6163. return;
  6164. }
  6165. };
  6166. CreateModule.prototype.editorEnter = function (sender) {
  6167. var editor = sender.down('sqleditor');
  6168. editor.setValue(this.viewModel.get('singleTable.sql'));
  6169. };
  6170. CreateModule.prototype.editorLevel = function (sender, opt) {
  6171. var editor = sender.down('sqleditor');
  6172. var sql = editor.getValue();
  6173. if (!sql) {
  6174. msg('查询SQL语句必填');
  6175. opt.cancel = true;
  6176. return;
  6177. }
  6178. this.viewModel.set('singleTable.sql', sql);
  6179. };
  6180. CreateModule.prototype.columnEnter = function (sender) {
  6181. };
  6182. CreateModule.prototype.columnLevel = function (sender, opt) {
  6183. };
  6184. CreateModule.prototype.extendEnter = function (sender) {
  6185. };
  6186. CreateModule.prototype.extendLevel = function (sender, opt) {
  6187. };
  6188. // 确认结果 - Enter
  6189. CreateModule.prototype.optionEnter = function (sender) {
  6190. var _this = this;
  6191. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6192. var moduleType = this.viewModel.get("moduleType");
  6193. var data = this.viewModel.getData();
  6194. var code = "";
  6195. var origin = {};
  6196. if (moduleType === 1) {
  6197. var singleTable = data.singleTable;
  6198. var editColumns = this.refs.grid1.getDataRows();
  6199. origin.moduleType = data.moduleType;
  6200. origin.packagePath = data.packagePath;
  6201. origin.fileSavePath = data.fileSavePath;
  6202. origin.moduleName = data.moduleName;
  6203. origin.pageTitle = data.pageTitle;
  6204. if (singleTable) {
  6205. origin.sql = singleTable.sql;
  6206. origin.tableName = singleTable.tableName;
  6207. origin.pagination = singleTable.pagination;
  6208. origin.delete = singleTable.delete;
  6209. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  6210. origin.deleteTips = singleTable.deleteTips;
  6211. origin.editType = singleTable.editType;
  6212. }
  6213. origin.columnList = [];
  6214. origin.queryColumns = [];
  6215. origin.insertColumns = [];
  6216. origin.updateColumns = [];
  6217. origin.gridColumns = [];
  6218. editColumns.forEach(function (column) {
  6219. var row = {
  6220. table_name: column.table_name,
  6221. column_name: column.column_name,
  6222. column_comment: column.column_comment,
  6223. is_primary_key: column.is_primary_key,
  6224. not_null: column.not_null,
  6225. column_size: column.column_size,
  6226. column_dict: column.column_dict,
  6227. column_ui: column.column_ui,
  6228. data_type: column.data_type,
  6229. column_type: column.column_type,
  6230. };
  6231. origin.columnList.push(row);
  6232. // 1:查询条件; 2:查询结果; 3:条件+结果;
  6233. var column_name = column.column_name, column_useto = column.column_useto;
  6234. switch (column_useto) {
  6235. case 1:
  6236. origin.queryColumns.push(column_name);
  6237. break;
  6238. case 2:
  6239. origin.gridColumns.push(column_name);
  6240. break;
  6241. case 3:
  6242. origin.queryColumns.push(column_name);
  6243. origin.gridColumns.push(column_name);
  6244. break;
  6245. }
  6246. origin.insertColumns.push(column_name);
  6247. origin.updateColumns.push(column_name);
  6248. });
  6249. }
  6250. this.setLoading(true);
  6251. getSingleTableData(origin).then(function (data) {
  6252. code = JSON.stringify(data, null, 4);
  6253. window['lastTemplateData'] = code;
  6254. var editor = _this.refs.jsoneditor;
  6255. editor.setCode(code);
  6256. }).finally(function () { return _this.setLoading(false); });
  6257. };
  6258. // 确认结果 - Level
  6259. CreateModule.prototype.optionLevel = function (sender, opt) {
  6260. };
  6261. // 上一步
  6262. CreateModule.prototype.showPrevious = function () {
  6263. this.doCardNavigation(false);
  6264. };
  6265. // 下一步
  6266. CreateModule.prototype.showNext = function () {
  6267. this.doCardNavigation(true, true);
  6268. };
  6269. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  6270. if (isNext === void 0) { isNext = true; }
  6271. if (isCancelable === void 0) { isCancelable = false; }
  6272. var layout = this._handle.getLayout();
  6273. var activeItem = layout.activeItem;
  6274. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  6275. if (isNext)
  6276. this.prevCard = reference;
  6277. var activeCard;
  6278. if (reference === "templateSelection") {
  6279. if (isNext) {
  6280. activeCard = this.refs['moduleName'];
  6281. }
  6282. }
  6283. else if (reference === "moduleName") {
  6284. if (isNext) {
  6285. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6286. var moduleType = this.viewModel.get("moduleType");
  6287. switch (moduleType) {
  6288. case 1:
  6289. activeCard = this.refs['singleTable_1'];
  6290. break;
  6291. case 2:
  6292. activeCard = this.refs['mainDetailTable_1'];
  6293. break;
  6294. case 3:
  6295. // activeCard =
  6296. break;
  6297. case 4:
  6298. activeCard = this.refs['cardForm_1'];
  6299. break;
  6300. }
  6301. }
  6302. else {
  6303. activeCard = this.refs['templateSelection'];
  6304. }
  6305. }
  6306. else if (reference === "confirmResult") {
  6307. if (!isNext) {
  6308. activeCard = this.refs[this.prevCard];
  6309. }
  6310. }
  6311. else {
  6312. var name = reference.split('_')[0];
  6313. var idx = parseInt(reference.split('_')[1], 10);
  6314. if (isNext) {
  6315. if (isEnd) {
  6316. activeCard = this.refs['confirmResult'];
  6317. }
  6318. else {
  6319. idx += 1;
  6320. }
  6321. }
  6322. else {
  6323. idx -= 1;
  6324. }
  6325. if (idx <= 0) {
  6326. activeCard = this.refs['moduleName'];
  6327. }
  6328. else if (!activeCard) {
  6329. activeCard = this.refs[name + "_" + idx];
  6330. }
  6331. }
  6332. // 按钮状态
  6333. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  6334. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  6335. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  6336. // 设置下一页显示
  6337. if (activeCard) {
  6338. var optCancel = { cancel: false };
  6339. // 发出 cardLevel 事件
  6340. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  6341. if (isCancelable && optCancel.cancel) {
  6342. // 取消了
  6343. return;
  6344. }
  6345. layout.setActiveItem(activeCard);
  6346. this.viewModel.set('title', layout.activeItem.vtitle);
  6347. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  6348. }
  6349. };
  6350. // 立刻执行
  6351. CreateModule.prototype.finish = function (sender) {
  6352. var _this = this;
  6353. var parent = sender.up('window');
  6354. var editor = this.refs.jsoneditor;
  6355. var data = JSON.parse(editor.getCode());
  6356. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6357. var moduleType = this.viewModel.get("moduleType");
  6358. if (moduleType === 1) {
  6359. this.setLoading(true);
  6360. generateCode(data).then(function (code) {
  6361. console.log("===> ", code);
  6362. _this.setLoading(true);
  6363. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  6364. .then(function () {
  6365. msg("创建成功!");
  6366. parent.close();
  6367. handles$1.fileTree.reload();
  6368. }).finally(function () { return _this.setLoading(false); });
  6369. }).finally(function () { return _this.setLoading(false); });
  6370. }
  6371. };
  6372. return CreateModule;
  6373. }(Scope));
  6374. //# sourceMappingURL=CreateModule.js.map
  6375. function getModuleId(path) {
  6376. var separator = "/";
  6377. var sps = path.split(separator);
  6378. var joinSps = sps.join('$');
  6379. if (!joinSps) {
  6380. return "ROOT";
  6381. }
  6382. return joinSps;
  6383. }
  6384. /**
  6385. * Module数据转换成Tree数据
  6386. */
  6387. function modulesToTreeData(modules) {
  6388. var separator = "/";
  6389. var treeNodeMap = new Map();
  6390. var root = {
  6391. type: "Dir",
  6392. path: "",
  6393. expanded: true,
  6394. leaf: false,
  6395. children: [],
  6396. };
  6397. root.id = getModuleId(root.path);
  6398. treeNodeMap.set(root.path, root);
  6399. modules.forEach(function (module) {
  6400. var _a;
  6401. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  6402. if (paths.length <= 0)
  6403. return;
  6404. var path = [];
  6405. var parent = root;
  6406. paths.forEach(function (dirName, idx) {
  6407. var parentPath = path.join(separator);
  6408. parent = treeNodeMap.get(parentPath);
  6409. path.push(dirName);
  6410. var currentPath = path.join(separator);
  6411. var child = treeNodeMap.get(currentPath);
  6412. if (child == null) {
  6413. // 获取当前path 绝对路径
  6414. var indexLength = module.absolutePath.indexOf(currentPath);
  6415. var currentAbsolutePath = "";
  6416. if (indexLength > 0) {
  6417. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  6418. }
  6419. child = {
  6420. type: "Dir",
  6421. path: currentPath,
  6422. absolutePath: currentAbsolutePath,
  6423. leaf: false,
  6424. children: [],
  6425. text: dirName
  6426. };
  6427. child.id = getModuleId(child.path);
  6428. parent.children.push(child);
  6429. treeNodeMap.set(child.path, child);
  6430. }
  6431. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  6432. var leaf = {
  6433. type: "Module",
  6434. path: module.path + separator + module.name,
  6435. absolutePath: module.absolutePath,
  6436. leaf: true,
  6437. text: module.name,
  6438. module: module,
  6439. };
  6440. leaf.id = getModuleId(leaf.path);
  6441. child.children.push(leaf);
  6442. treeNodeMap.set(leaf.path, leaf);
  6443. }
  6444. });
  6445. });
  6446. // 排序处理
  6447. treeNodeMap.forEach(function (module) {
  6448. if (module.children) {
  6449. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  6450. module.children.length = 0;
  6451. children.forEach(function (item) { return module.children.push(item); });
  6452. }
  6453. });
  6454. return root;
  6455. }
  6456. function showDialog(sender, option) {
  6457. var _a, _b;
  6458. var win = new Ext.Window({
  6459. autoDestroy: true,
  6460. title: option.title,
  6461. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  6462. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  6463. resizable: false,
  6464. closable: true,
  6465. modal: true,
  6466. maximizable: false,
  6467. minimizable: false,
  6468. // constrainHeader: true,
  6469. constrain: true,
  6470. layout: 'fit',
  6471. animateTarget: sender,
  6472. buttonAlign: 'center',
  6473. items: [
  6474. {
  6475. xtype: "form",
  6476. layout: "hbox",
  6477. margin: '10px 20px',
  6478. border: 0,
  6479. items: option.items
  6480. }
  6481. ],
  6482. //窗口按钮
  6483. fbar: [
  6484. {
  6485. xtype: 'button', text: '保存', handler: function (btn) {
  6486. //窗口获取表单
  6487. var form = win.down('form');
  6488. var vaildSuccess = form.isValid();
  6489. if (!vaildSuccess) {
  6490. return;
  6491. }
  6492. option.submitFunc(form);
  6493. }
  6494. },
  6495. {
  6496. xtype: 'button', text: '取消', handler: function (btn) {
  6497. //窗口关闭
  6498. btn.up('window').close();
  6499. }
  6500. }
  6501. ],
  6502. });
  6503. win.show();
  6504. }
  6505. function showCreateFolderWin(sender, parentPath) {
  6506. showDialog(sender, {
  6507. title: '新建文件夹',
  6508. height: 150,
  6509. items: [
  6510. {
  6511. xtype: "textfield",
  6512. name: "filename",
  6513. fieldLabel: "文件夹名称",
  6514. allowBlank: false,
  6515. selectOnFocus: true,
  6516. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  6517. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  6518. labelWidth: 80,
  6519. width: "100%",
  6520. listeners: {
  6521. afterrender: function (sender) {
  6522. _$2.defer(function () {
  6523. sender.focus();
  6524. });
  6525. }
  6526. }
  6527. },
  6528. ],
  6529. submitFunc: function (form) {
  6530. var filename = form.down('textfield[name="filename"]').getValue();
  6531. createFolder(parentPath, filename).then(function (res) {
  6532. if (res.success) {
  6533. msg$1('创建成功');
  6534. handles$1.fileTree.reload();
  6535. form.up('window').close();
  6536. }
  6537. else {
  6538. showErrorDialog$1(res.msg);
  6539. }
  6540. }).catch(function (e) {
  6541. showErrorDialog$1(e.responseJSON.msg);
  6542. });
  6543. }
  6544. });
  6545. }
  6546. function showCreateModuleCrudWin(sender, path, absolutePath) {
  6547. var dlg = new CreateModule();
  6548. dlg.showDialog(sender, {}, {
  6549. data: {
  6550. packagePath: path,
  6551. fileSavePath: absolutePath,
  6552. }
  6553. });
  6554. }
  6555. function registerModule$1(sender, path, name, icon) {
  6556. // 前缀 com/galaxis/wms 写死了
  6557. var dlg = new RegisterModule();
  6558. dlg.showDialog(sender, {}, {
  6559. data: {
  6560. form: {
  6561. scope_url: path.replace("com/galaxis/wms", "."),
  6562. resource_name: name,
  6563. resource_icon: icon,
  6564. }
  6565. }
  6566. });
  6567. }
  6568. function showCreateEmptyModule(sender, path) {
  6569. var win = new Ext.Window({
  6570. autoDestroy: true,
  6571. title: "新建空模块",
  6572. width: 400,
  6573. height: 150,
  6574. resizable: true,
  6575. closable: true,
  6576. maximizable: true,
  6577. minimizable: true,
  6578. plain: true,
  6579. // constrainHeader: true,
  6580. constrain: true,
  6581. layout: 'fit',
  6582. animateTarget: sender,
  6583. buttonAlign: 'center',
  6584. items: [
  6585. {
  6586. xtype: "form",
  6587. layout: "hbox",
  6588. margin: '10px 20px',
  6589. border: 0,
  6590. items: [
  6591. {
  6592. flex: 1,
  6593. layout: 'vbox',
  6594. items: [
  6595. {
  6596. xtype: "textfield",
  6597. name: "filename",
  6598. fieldLabel: "模块名",
  6599. flex: 1,
  6600. allowBlank: false,
  6601. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  6602. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  6603. labelWidth: 50,
  6604. width: "100%",
  6605. },
  6606. ]
  6607. },
  6608. ]
  6609. }
  6610. ],
  6611. //窗口按钮
  6612. buttons: [
  6613. {
  6614. xtype: 'button', text: '保存', handler: function (btn) {
  6615. //窗口获取表单
  6616. var form = win.down('form');
  6617. var vaildSuccess = form.isValid();
  6618. if (!vaildSuccess) {
  6619. return;
  6620. }
  6621. var filename = form.down('textfield[name="filename"]').getValue();
  6622. createEmptyModule(path, filename).then(function (res) {
  6623. if (res.success) {
  6624. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  6625. handles$1.fileTree.reload();
  6626. win.close();
  6627. }
  6628. else {
  6629. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  6630. }
  6631. }).catch(function (e) {
  6632. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  6633. });
  6634. }
  6635. },
  6636. {
  6637. xtype: 'button', text: '取消', handler: function (btn) {
  6638. //窗口关闭
  6639. win.close();
  6640. }
  6641. }
  6642. ]
  6643. });
  6644. win.show();
  6645. }
  6646. //# sourceMappingURL=FileHelp.js.map
  6647. function initFileTree () {
  6648. Ext.define('com.yvan.studio.FileTree', {
  6649. extend: 'com.yvan.studio.StateTree',
  6650. xtype: 'filetree',
  6651. tooltip: '文件',
  6652. iconCls: 'x-fa fa-file',
  6653. rootVisible: false,
  6654. useArrows: true,
  6655. colspan: 2,
  6656. lines: true,
  6657. reference: 'filetree',
  6658. multiSelect: true,
  6659. getStateFilename: function () {
  6660. return getCurrentProject().uuid + "/filetree.json";
  6661. },
  6662. openNode: function () {
  6663. var selection = this.getSelection();
  6664. var _a = __read(selection, 1), record = _a[0];
  6665. if (!record) {
  6666. return;
  6667. }
  6668. var raw = record.raw;
  6669. if (raw.type === 'Dir') {
  6670. return;
  6671. }
  6672. if (raw.type === "Module" && raw.module) {
  6673. eventBus.publish(EventType.ModuleOpen, raw);
  6674. }
  6675. },
  6676. openInIdea: function () {
  6677. var _a = __read(this.getSelection(), 1), record = _a[0];
  6678. if (record) {
  6679. var data = record.data;
  6680. if (data.type === "Module") {
  6681. if (data.module.groovyFile && data.module.groovyFile.exists) {
  6682. native.openInIdea(data.module.groovyFile.absolutePath);
  6683. }
  6684. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  6685. native.openInIdea(data.module.jsControllerFile.absolutePath);
  6686. }
  6687. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  6688. native.openInIdea(data.module.jsViewFile.absolutePath);
  6689. }
  6690. return;
  6691. }
  6692. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  6693. }
  6694. },
  6695. deleteSelection: function () {
  6696. var selection = this.getSelection();
  6697. var pathList = [];
  6698. _.forEach(selection, function (item) {
  6699. if (item.data.type === "Dir") {
  6700. pathList.push({ path: item.data.path, isFolder: true });
  6701. }
  6702. else {
  6703. pathList.push({ path: item.data.path, isFolder: false });
  6704. }
  6705. });
  6706. {
  6707. return;
  6708. }
  6709. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  6710. //
  6711. // Ext.Msg.confirm('提示', title, (btn) => {
  6712. // if (btn === 'yes') {
  6713. // deleteFileOrFolder(raw.path, title, true)
  6714. // }
  6715. // })
  6716. // const title = '您确定要删除(' + raw.path + ')吗?'
  6717. // deleteFileOrFolder(raw.path, title, false)
  6718. },
  6719. listeners: {
  6720. itemverify: function () {
  6721. this.openNode();
  6722. },
  6723. afterrender: function (me) {
  6724. console.log('filetree_afterrender', 'reloadIfNeed');
  6725. moduleStore.registe(me.subscribeModule.bind(this));
  6726. moduleStore.reloadIfNeed("PC");
  6727. },
  6728. destroy: function (me) {
  6729. console.log('filetree_destroy');
  6730. moduleStore.unregiste(me.subscribeModule.bind(this));
  6731. },
  6732. itemcontextmenu: function (sender, node, element, idx, e) {
  6733. e.preventDefault();
  6734. var raw = node.raw;
  6735. var option = {};
  6736. if (raw.type === 'Dir') {
  6737. // 文件夹右键
  6738. option = {
  6739. shadow: 'frame', allowOtherMenus: true,
  6740. items: [
  6741. {
  6742. text: '新建空模块',
  6743. iconCls: 'x-fa fa-plus-circle',
  6744. handler: function (sender) {
  6745. showCreateEmptyModule(sender, raw.path);
  6746. }
  6747. },
  6748. {
  6749. text: '新建模块',
  6750. iconCls: 'x-fa fa-plus-circle',
  6751. handler: function (sender) {
  6752. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  6753. }
  6754. },
  6755. '-',
  6756. {
  6757. text: '新建文件夹',
  6758. iconCls: 'x-fa fa-folder-o',
  6759. handler: function (sender) {
  6760. var parentPath = raw.path;
  6761. showCreateFolderWin(sender, parentPath);
  6762. }
  6763. },
  6764. {
  6765. text: '复制路径',
  6766. iconCls: 'x-fa fa-external-link',
  6767. handler: function (sender) {
  6768. native.clipboardSet(raw.path);
  6769. }
  6770. },
  6771. ]
  6772. };
  6773. }
  6774. else {
  6775. // 文件右键
  6776. option = {
  6777. shadow: 'frame', allowOtherMenus: true,
  6778. items: [
  6779. // {
  6780. // text: '重命名',
  6781. // iconCls: 'x-fa fa-terminal',
  6782. // handler(sender) {
  6783. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  6784. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  6785. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  6786. // }
  6787. // },
  6788. // {
  6789. // text: '另存为',
  6790. // iconCls: 'x-fa fa-exchange',
  6791. // handler(sender) {
  6792. // console.error('没做')
  6793. // }
  6794. // },
  6795. {
  6796. text: '复制路径',
  6797. iconCls: 'x-fa fa-external-link',
  6798. handler: function (sender) {
  6799. native.clipboardSet(raw.path);
  6800. }
  6801. },
  6802. '-',
  6803. {
  6804. text: '注册模块',
  6805. iconCls: 'x-fa fa-sign-in',
  6806. handler: function (sender) {
  6807. registerModule$1(sender, raw.path);
  6808. }
  6809. },
  6810. ]
  6811. };
  6812. }
  6813. var treeMenu = new Ext.menu.Menu(option);
  6814. treeMenu.showAt(e.getXY());
  6815. },
  6816. },
  6817. tbar: [
  6818. {
  6819. xtype: 'button',
  6820. iconCls: 'x-fa fa-crosshairs',
  6821. tooltip: '选中当前打开的文件',
  6822. handler: function (sender) {
  6823. msg$1('没做');
  6824. }
  6825. },
  6826. {
  6827. xtype: 'button',
  6828. iconCls: 'x-fa fa-link',
  6829. tooltip: '在IDEA中打开',
  6830. handler: function (sender) {
  6831. var scope = sender.up("filetree");
  6832. scope.openInIdea();
  6833. }
  6834. },
  6835. {
  6836. xtype: 'button',
  6837. iconCls: 'x-fa fa-refresh',
  6838. tooltip: '刷新',
  6839. handler: function (sender) {
  6840. var scope = sender.up("filetree");
  6841. scope.reload();
  6842. }
  6843. },
  6844. {
  6845. xtype: 'button',
  6846. iconCls: 'x-fa fa-percent',
  6847. tooltip: '监控',
  6848. handler: function (sender) {
  6849. // handles.mainWindow.showPerform()
  6850. }
  6851. },
  6852. ],
  6853. initComponent: function () {
  6854. setFileTree(this);
  6855. this.superclass.initComponent.apply(this, arguments);
  6856. // super.initComponent.apply(this, arguments)
  6857. },
  6858. subscribeModule: function (res) {
  6859. if (typeof res === 'object') {
  6860. var rootNode = modulesToTreeData(res.data);
  6861. this.setRootNode(rootNode);
  6862. this.restoreState();
  6863. handles$1.mainWindow.modules = res.data;
  6864. }
  6865. else if (typeof res === 'boolean') {
  6866. this.setLoading(res);
  6867. }
  6868. },
  6869. reload: function () {
  6870. console.log('filetree_reloadForce');
  6871. moduleStore.reloadForce("PC").then(function (res) {
  6872. });
  6873. }
  6874. });
  6875. }
  6876. //# sourceMappingURL=FileTree.js.map
  6877. function initDbTree () {
  6878. var define = {
  6879. extend: 'com.yvan.studio.StateTree',
  6880. xtype: 'dbtree',
  6881. tooltip: '数据库',
  6882. iconCls: 'x-fa fa-database',
  6883. rootVisible: false,
  6884. useArrows: true,
  6885. reference: 'dbtree',
  6886. multiSelect: true,
  6887. getStateFilename: function () {
  6888. return getCurrentProject().uuid + "/dbtree.json";
  6889. },
  6890. tbar: [
  6891. {
  6892. xtype: 'button',
  6893. iconCls: 'x-fa fa-crosshairs',
  6894. tooltip: '选中当前打开的表',
  6895. handler: function (sender) {
  6896. var _a;
  6897. // 获取当前选中的活动标签 tableColumn_bas_car
  6898. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  6899. if (!locatPath) {
  6900. return;
  6901. }
  6902. handles$1.dbTree.selectPath(locatPath);
  6903. }
  6904. },
  6905. {
  6906. xtype: 'button',
  6907. iconCls: 'x-fa fa-refresh',
  6908. tooltip: '刷新',
  6909. handler: function (sender) {
  6910. handles$1.dbTree.reload();
  6911. }
  6912. },
  6913. {
  6914. xtype: 'button',
  6915. iconCls: 'x-fa fa-cloud-download',
  6916. tooltip: '重新拉取生成元数据(耗时很长!)',
  6917. handler: function (sender) {
  6918. handles$1.dbTree.dbToMetaAndReload(sender);
  6919. }
  6920. },
  6921. // {
  6922. // xtype: 'button',
  6923. // iconCls: 'x-fa fa-files-o',
  6924. // tooltip: '数据同步',
  6925. // handler(sender) {
  6926. //
  6927. // }
  6928. // },
  6929. {
  6930. xtype: 'button',
  6931. iconCls: 'x-fa fa-exchange',
  6932. tooltip: '数据结构同步',
  6933. handler: function (sender) {
  6934. // handles.mainWindow.showDataSync(sender)
  6935. }
  6936. },
  6937. {
  6938. xtype: 'button',
  6939. iconCls: 'x-fa fa-window-maximize',
  6940. tooltip: 'SQL查询分析器',
  6941. handler: function (sender) {
  6942. // handles.mainWindow.showDbCodeTemplate(sender)
  6943. }
  6944. },
  6945. {
  6946. xtype: 'button',
  6947. iconCls: 'x-fa fa-cubes',
  6948. tooltip: '数据域管理',
  6949. handler: function (sender) {
  6950. // handles.mainWindow.showColumnDomain()
  6951. }
  6952. },
  6953. {
  6954. xtype: 'button',
  6955. iconCls: 'x-fa fa-edit',
  6956. tooltip: '修改结构',
  6957. handler: function (sender) {
  6958. var tree = sender.up("treepanel");
  6959. var selection = tree.getSelection();
  6960. var _a = __read(selection, 1), node = _a[0];
  6961. if (!node) {
  6962. msg$1('请选择一个表');
  6963. return;
  6964. }
  6965. var raw = node.data.raw;
  6966. if (node.get('type') === 'table') ;
  6967. else if (node.get('type') === 'column') ;
  6968. }
  6969. },
  6970. ],
  6971. listeners: {
  6972. afterrender: function (me) {
  6973. setDbTree(this);
  6974. // 找管理器订阅刷新的事件
  6975. instance.registe(this.refreshData.bind(this));
  6976. instance.reloadIfNeed(undefined);
  6977. },
  6978. destory: function (me) {
  6979. setDbTree(undefined);
  6980. instance.unregiste(this.refreshData.bind(this));
  6981. },
  6982. itemcontextmenu: function (sender, node, element, idx, e) {
  6983. var _this = this;
  6984. e.preventDefault();
  6985. var option = {};
  6986. var raw = node.raw.raw;
  6987. if (node.get('type') === 'column') {
  6988. option = {
  6989. shadow: 'frame', allowOtherMenus: true,
  6990. items: [
  6991. {
  6992. text: '设计结构',
  6993. iconCls: 'x-fa fa-edit',
  6994. handler: function (sender) {
  6995. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  6996. }
  6997. },
  6998. ]
  6999. };
  7000. }
  7001. else if (node.get('type') === 'table') {
  7002. option = {
  7003. shadow: 'frame', allowOtherMenus: true,
  7004. items: [
  7005. {
  7006. text: '新建',
  7007. iconCls: 'x-fa fa-plus',
  7008. handler: function (sender) {
  7009. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  7010. }
  7011. },
  7012. {
  7013. text: '设计结构',
  7014. iconCls: 'x-fa fa-edit',
  7015. handler: function (sender) {
  7016. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  7017. }
  7018. },
  7019. {
  7020. text: '重命名',
  7021. iconCls: 'x-fa fa-pencil',
  7022. handler: function (sender) {
  7023. _this.renameTable(sender, node.data.raw);
  7024. }
  7025. },
  7026. '-',
  7027. {
  7028. text: '删除',
  7029. iconCls: 'x-fa fa-minus',
  7030. handler: function (sender) {
  7031. _this.removeTable(sender, node.data.raw);
  7032. }
  7033. },
  7034. ]
  7035. };
  7036. }
  7037. var treeMenu = new Ext.menu.Menu(option);
  7038. treeMenu.showAt(e.getXY());
  7039. }
  7040. },
  7041. // DbTreeStore 刷新时,会回调到这个方法
  7042. refreshData: function (isLoadingState) {
  7043. var me = this;
  7044. if (typeof isLoadingState === 'boolean') {
  7045. me.setLoading(isLoadingState);
  7046. return;
  7047. }
  7048. var rootNode = getDbTree(instance.apiResponse);
  7049. me.setRootNode(rootNode);
  7050. this.restoreState();
  7051. },
  7052. renameTable: function (sender, tableRow) {
  7053. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  7054. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  7055. if (!res.data)
  7056. return;
  7057. var window = Ext.create('Ext.window.Window', {
  7058. title: 'SQL 预览',
  7059. height: 400,
  7060. width: 600,
  7061. modal: true,
  7062. animateTarget: sender,
  7063. maximizable: true,
  7064. layout: 'fit',
  7065. items: {
  7066. xtype: 'sqleditor',
  7067. value: res.data,
  7068. },
  7069. buttons: [
  7070. {
  7071. xtype: 'button',
  7072. text: '执行',
  7073. iconCls: 'x-fa fa-save',
  7074. handler: function (sender) {
  7075. var editor = sender.up('window').down('sqleditor');
  7076. var ddl = editor.getValue();
  7077. window.setLoading(true);
  7078. instance.pushToDbCommit({
  7079. schema_name: tableRow.schema_name,
  7080. table_name: name,
  7081. old_table_name: tableRow.table_name,
  7082. ddl: ddl,
  7083. }).then(function () {
  7084. handles$1.dbTree.reload();
  7085. window.close();
  7086. }).finally(function () { return window.setLoading(false); });
  7087. },
  7088. },
  7089. {
  7090. xtype: 'button',
  7091. text: '取消',
  7092. iconCls: 'x-fa fa-times',
  7093. handler: function () {
  7094. window.close();
  7095. }
  7096. },
  7097. ]
  7098. }).show();
  7099. });
  7100. });
  7101. },
  7102. removeTable: function (sender, tableRow) {
  7103. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  7104. if (!res.data)
  7105. return;
  7106. var window = Ext.create('Ext.window.Window', {
  7107. title: 'SQL 预览',
  7108. height: 400,
  7109. width: 600,
  7110. modal: true,
  7111. animateTarget: sender,
  7112. maximizable: true,
  7113. layout: 'fit',
  7114. items: {
  7115. xtype: 'sqleditor',
  7116. value: res.data,
  7117. },
  7118. buttons: [
  7119. {
  7120. xtype: 'button',
  7121. text: '执行',
  7122. iconCls: 'x-fa fa-save',
  7123. handler: function (sender) {
  7124. var editor = sender.up('window').down('sqleditor');
  7125. var ddl = editor.getValue();
  7126. window.setLoading(true);
  7127. instance.pushToDbCommit({
  7128. schema_name: tableRow.schema_name,
  7129. table_name: tableRow.table_name,
  7130. ddl: ddl
  7131. })
  7132. .then(function () {
  7133. handles$1.dbTree.reload();
  7134. window.close();
  7135. }).finally(function () { return window.setLoading(false); });
  7136. }
  7137. },
  7138. {
  7139. xtype: 'button',
  7140. text: '取消',
  7141. iconCls: 'x-fa fa-times',
  7142. handler: function () {
  7143. window.close();
  7144. }
  7145. }
  7146. ]
  7147. }).show();
  7148. });
  7149. },
  7150. // hideHeaders: true,
  7151. // columns: [
  7152. // {
  7153. // xtype: 'treecolumn',
  7154. // text: '名称',
  7155. // dataIndex: 'text',
  7156. // flex: 2,
  7157. // }, {
  7158. // text: '描述',
  7159. // dataIndex: 'comment',
  7160. // flex: 1,
  7161. // }
  7162. // ],
  7163. reload: function () {
  7164. // 强制刷新 DbManager
  7165. instance.reloadForce(undefined);
  7166. },
  7167. dbToMetaAndReload: function () {
  7168. // 从数据库结构重新生成元数据
  7169. instance.dbToMetaAndReload();
  7170. }
  7171. };
  7172. Ext.define('com.yvan.studio.DbTree', define);
  7173. }
  7174. /**
  7175. * 将数据构建成 dbTree 需要的格式
  7176. */
  7177. function getDbTree(apiResponse) {
  7178. var rootNode = {
  7179. children: [],
  7180. expanded: true,
  7181. id: "ROOT",
  7182. leaf: false,
  7183. };
  7184. _$2.forEach(apiResponse, function (schemaRow) {
  7185. var schemaNode = {
  7186. id: 'schema$' + schemaRow.schema_name,
  7187. type: "schema",
  7188. expanded: true,
  7189. leaf: false,
  7190. iconCls: 'x-fa fa-th-large ',
  7191. text: schemaRow.schema_name,
  7192. raw: __assign({}, schemaRow),
  7193. children: [],
  7194. };
  7195. delete schemaNode.raw.table_list;
  7196. rootNode.children.push(schemaNode);
  7197. _$2.forEach(schemaRow.table_list, function (tableRow) {
  7198. var _a;
  7199. var tableNode = {
  7200. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  7201. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  7202. comment: tableRow.description,
  7203. type: "table",
  7204. iconCls: 'x-fa fa-table',
  7205. expanded: false,
  7206. leaf: false,
  7207. children: [],
  7208. raw: __assign({}, tableRow)
  7209. };
  7210. delete tableNode.raw.column_list;
  7211. schemaNode.children.push(tableNode);
  7212. _$2.forEach(tableRow.column_list, function (columnRow) {
  7213. var _a;
  7214. var iconCls = 'x-fa fa-square-o';
  7215. if (columnRow.is_primary_key) {
  7216. iconCls = 'x-fa fa-key';
  7217. }
  7218. else if (columnRow.not_null) {
  7219. iconCls = 'x-fa fa-check-square';
  7220. }
  7221. var columnNode = {
  7222. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  7223. type: "column",
  7224. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  7225. comment: columnRow.column_comment,
  7226. leaf: true,
  7227. iconCls: iconCls,
  7228. raw: __assign({}, columnRow)
  7229. };
  7230. tableNode.children.push(columnNode);
  7231. }); // column
  7232. }); // table
  7233. }); // schema
  7234. return rootNode;
  7235. }
  7236. //# sourceMappingURL=DbTree.js.map
  7237. var ReportGridController = /** @class */ (function () {
  7238. function ReportGridController() {
  7239. }
  7240. ReportGridController.prototype.onLoad = function (sender) {
  7241. this.reload();
  7242. setReport(this);
  7243. };
  7244. ReportGridController.prototype.showSingle = function (sender) {
  7245. var _this = this;
  7246. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7247. if (record) {
  7248. handles.mainWindow.showFormSingle(record.data, function () {
  7249. _this.reload();
  7250. });
  7251. }
  7252. };
  7253. ReportGridController.prototype.filterChanged = function (sender, value) {
  7254. console.log('filterChange', sender, value);
  7255. this.view.store.clearFilter();
  7256. if (value) {
  7257. this.view.store.filterBy(function (record) {
  7258. var code = _.lowerCase(record.get('report_name'));
  7259. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  7260. return (code.includes(value) ||
  7261. dict_desc_py.includes(value));
  7262. });
  7263. }
  7264. };
  7265. ReportGridController.prototype.onClearClick = function () {
  7266. var _a, _b;
  7267. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  7268. };
  7269. ReportGridController.prototype.reload = function () {
  7270. var me = this;
  7271. me.getView().setLoading(true);
  7272. reportListApi().then(function (res) {
  7273. _.forEach(res.data, function (r) {
  7274. r.report_enable = r.report_enable === 1;
  7275. });
  7276. me.getView().setStore(new Ext.data.Store({
  7277. fields: ['report_id', 'report_name', 'report_enable'],
  7278. data: res.data,
  7279. }));
  7280. }).finally(function () {
  7281. me.getView().setLoading(false);
  7282. });
  7283. };
  7284. ReportGridController.prototype.reportAdd = function () {
  7285. var _this = this;
  7286. prompt$2('请输入报表名称').then(function (name) {
  7287. createReportApi(name).then(function (res) {
  7288. if (res.success) {
  7289. msg$1('添加成功');
  7290. handles.mainWindow.showReport(res.data, name, function () {
  7291. _this.reload();
  7292. });
  7293. }
  7294. _this.reload();
  7295. });
  7296. });
  7297. };
  7298. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  7299. e.preventDefault();
  7300. var me = sender.up('grid').ownerGrid.getController();
  7301. var option = {
  7302. shadow: 'frame', allowOtherMenus: true,
  7303. items: [
  7304. {
  7305. text: '添加',
  7306. iconCls: 'x-fa fa-plus-circle',
  7307. handler: function (sender) {
  7308. me.reportAdd();
  7309. }
  7310. },
  7311. {
  7312. text: '编辑',
  7313. iconCls: 'x-fa fa-edit',
  7314. handler: function (sender) {
  7315. me.reportEdit();
  7316. }
  7317. },
  7318. {
  7319. text: '删除',
  7320. iconCls: 'x-fa fa-minus-circle',
  7321. handler: function (sender) {
  7322. me.reportRemove();
  7323. }
  7324. },
  7325. '-',
  7326. {
  7327. text: '注册(至菜单)',
  7328. iconCls: 'x-fa fa-sign-in',
  7329. handler: function (sender) {
  7330. me.reportRegiste(sender);
  7331. }
  7332. },
  7333. {
  7334. text: '卸载',
  7335. iconCls: 'x-fa fa-sign-out',
  7336. handler: function (sender) {
  7337. console.error('没做');
  7338. }
  7339. },
  7340. ]
  7341. };
  7342. var treeMenu = new Ext.menu.Menu(option);
  7343. treeMenu.showAt(e.getXY());
  7344. };
  7345. ReportGridController.prototype.reportRegiste = function (sender) {
  7346. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7347. if (record) {
  7348. var reportName = record.get('report_name');
  7349. var reportId = record.get('report_id');
  7350. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  7351. }
  7352. };
  7353. ReportGridController.prototype.reportRemove = function () {
  7354. var _this = this;
  7355. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7356. if (record) {
  7357. var reportName = record.get('report_name');
  7358. var reportId_1 = record.get('report_id');
  7359. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  7360. delReportApi(reportId_1).then(function (res) {
  7361. if (res.success) {
  7362. msg$1('删除成功');
  7363. _this.reload();
  7364. }
  7365. });
  7366. });
  7367. }
  7368. };
  7369. ReportGridController.prototype.reportEdit = function () {
  7370. var _this = this;
  7371. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7372. if (record) {
  7373. var reportName = record.get('report_name');
  7374. var reportId = record.get('report_id');
  7375. handles.mainWindow.showReport(reportId, reportName, function () {
  7376. _this.reload();
  7377. });
  7378. }
  7379. };
  7380. ReportGridController.prototype.onDblClick = function (sender) {
  7381. this.reportEdit();
  7382. };
  7383. return ReportGridController;
  7384. }());
  7385. //# sourceMappingURL=ReportGridController.js.map
  7386. function initReportGrid () {
  7387. var controller = new ReportGridController();
  7388. Ext.define('com.yvan.studio.ReportGrid', {
  7389. extend: 'Ext.grid.Panel',
  7390. xtype: 'reportGrid',
  7391. controller: controller,
  7392. scope: controller,
  7393. referenceHolder: true,
  7394. tooltip: '查询报表',
  7395. iconCls: 'x-fa fa-bar-chart',
  7396. useArrows: true,
  7397. reference: 'reportgrid',
  7398. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  7399. listeners: {
  7400. itemdblclick: 'onDblClick',
  7401. afterrender: 'onLoad',
  7402. },
  7403. viewConfig: {
  7404. listeners: {
  7405. itemcontextmenu: 'onGridContextMenu',
  7406. },
  7407. },
  7408. tbar: {
  7409. xtype: 'toolbar',
  7410. items: [
  7411. {
  7412. xtype: 'button',
  7413. tooltip: '测试',
  7414. iconCls: 'x-fa fa-bars',
  7415. listeners: {
  7416. click: 'showSingle'
  7417. }
  7418. },
  7419. {
  7420. xtype: 'button',
  7421. tooltip: '刷新',
  7422. iconCls: 'x-fa fa-refresh',
  7423. listeners: {
  7424. click: 'reload'
  7425. }
  7426. },
  7427. {
  7428. xtype: 'button',
  7429. tooltip: '添加',
  7430. iconCls: 'x-fa fa-plus-circle',
  7431. listeners: {
  7432. click: 'reportAdd'
  7433. }
  7434. },
  7435. {
  7436. xtype: 'button',
  7437. tooltip: '删除',
  7438. iconCls: 'x-fa fa-minus-circle',
  7439. listeners: {
  7440. click: 'reportRemove'
  7441. }
  7442. },
  7443. {
  7444. xtype: 'textfield',
  7445. flex: 1,
  7446. reference: "txtFilter",
  7447. emptyText: '搜索过滤',
  7448. enableKeyEvents: true,
  7449. listeners: {
  7450. change: {
  7451. fn: 'filterChanged',
  7452. buffer: 50
  7453. }
  7454. }
  7455. },
  7456. ]
  7457. },
  7458. columns: [
  7459. {
  7460. text: 'ID', dataIndex: 'report_id',
  7461. hidden: true,
  7462. },
  7463. {
  7464. text: '报表名称', dataIndex: 'report_name',
  7465. menuDisabled: true, flex: 1,
  7466. },
  7467. ]
  7468. });
  7469. }
  7470. //# sourceMappingURL=ReportGrid.js.map
  7471. /** 所有变量类型 */
  7472. var TypeEnum;
  7473. (function (TypeEnum) {
  7474. TypeEnum["string"] = "string";
  7475. TypeEnum["number"] = "number";
  7476. TypeEnum["object"] = "object";
  7477. TypeEnum["array"] = "array";
  7478. TypeEnum["function"] = "function";
  7479. TypeEnum["null"] = "null";
  7480. TypeEnum["boolean"] = "boolean";
  7481. TypeEnum["symbol"] = "symbol";
  7482. TypeEnum["json"] = "json";
  7483. TypeEnum["math"] = "math";
  7484. TypeEnum["regexp"] = "regexp";
  7485. TypeEnum["date"] = "date";
  7486. TypeEnum["undefined"] = "undefined";
  7487. TypeEnum["nan"] = "nan";
  7488. TypeEnum["reactNode"] = "react_node";
  7489. })(TypeEnum || (TypeEnum = {}));
  7490. /**
  7491. * 判断对象类型
  7492. * @param object 对象
  7493. */
  7494. var variableTypeOf = function (object) {
  7495. var typeStr = Object.prototype.toString.call(object);
  7496. var typeName;
  7497. switch (("" + typeStr).toLowerCase()) {
  7498. case '[object string]':
  7499. typeName = TypeEnum.string;
  7500. break;
  7501. case '[object number]':
  7502. if (Number.isNaN(object)) {
  7503. return TypeEnum.nan;
  7504. }
  7505. typeName = TypeEnum.number;
  7506. break;
  7507. case '[object object]':
  7508. if (object.$$typeof && object.props) {
  7509. var type = variableTypeOf(object.$$typeof);
  7510. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  7511. return TypeEnum.reactNode;
  7512. }
  7513. }
  7514. typeName = TypeEnum.object;
  7515. break;
  7516. case '[object array]':
  7517. typeName = TypeEnum.array;
  7518. break;
  7519. case '[object function]':
  7520. typeName = TypeEnum.function;
  7521. break;
  7522. case '[object null]':
  7523. typeName = TypeEnum.null;
  7524. break;
  7525. case '[object boolean]':
  7526. typeName = TypeEnum.boolean;
  7527. break;
  7528. case '[object date]':
  7529. typeName = TypeEnum.date;
  7530. break;
  7531. // 不常用
  7532. case '[object symbol]':
  7533. typeName = TypeEnum.symbol;
  7534. break;
  7535. case '[object json]':
  7536. typeName = TypeEnum.json;
  7537. break;
  7538. case '[object math]':
  7539. typeName = TypeEnum.math;
  7540. break;
  7541. case '[object regexp]':
  7542. typeName = TypeEnum.regexp;
  7543. break;
  7544. // 貌似不会走的分支
  7545. case '[object undefined]':
  7546. typeName = TypeEnum.undefined;
  7547. break;
  7548. // 无法识别
  7549. default:
  7550. if (object === undefined) {
  7551. return TypeEnum.undefined;
  7552. }
  7553. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  7554. typeName = TypeEnum.object;
  7555. }
  7556. return typeName;
  7557. };
  7558. //# sourceMappingURL=typeof.js.map
  7559. function initGroovyEditor () {
  7560. Ext.define('com.yvan.studio.GroovyEditor', {
  7561. extend: 'Ext.panel.Panel',
  7562. alias: 'widget.groovyeditor',
  7563. xtype: 'groovyeditor',
  7564. layout: 'fit',
  7565. border: false,
  7566. html: "<div class=\"editor\"/>",
  7567. config: {
  7568. value: ''
  7569. },
  7570. codeChange: undefined,
  7571. isChangeFromOuter: false,
  7572. getCode: function () {
  7573. if (this.editor) {
  7574. return this.editor.getValue();
  7575. }
  7576. else {
  7577. return this.code;
  7578. }
  7579. },
  7580. setCode: function (value) {
  7581. var _this = this;
  7582. this.code = value;
  7583. this.value = value;
  7584. _$2.defer(function () {
  7585. _this.isChangeFromOuter = true;
  7586. if (_this.editor) {
  7587. _this.editor.setValue(value);
  7588. }
  7589. });
  7590. },
  7591. applyPosition: function () {
  7592. var _this = this;
  7593. if (this.autoFocusMethod) {
  7594. if (this.editor) {
  7595. _$2.defer(function () {
  7596. if (_this.autoFocusStartLine) {
  7597. _this.editor.setPosition({
  7598. lineNumber: _this.autoFocusStartLine,
  7599. column: _this.autoFocusStartColumn
  7600. });
  7601. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7602. }
  7603. _this.editor.focus();
  7604. });
  7605. delete this.autoFocusMethod;
  7606. }
  7607. }
  7608. this.editor.layout();
  7609. },
  7610. getValue: function () {
  7611. return this.value;
  7612. },
  7613. setValue: function (value, fromEditor) {
  7614. var me = this;
  7615. if (me.value === value) {
  7616. // 值相等,不需要变化
  7617. return;
  7618. }
  7619. if (fromEditor !== true && me.editor) {
  7620. // 不是来源于编辑器的变化,才设置编辑器的值
  7621. me.editor.setValue(value);
  7622. }
  7623. // 通知mixins setValue
  7624. me.value = value;
  7625. me.fireEvent('change', value);
  7626. },
  7627. initComponent: function () {
  7628. var that = this;
  7629. this.superclass.initComponent.call(this, arguments);
  7630. that.on({
  7631. resize: function () {
  7632. if (that.editor) {
  7633. that.editor.layout();
  7634. }
  7635. },
  7636. destory: function () {
  7637. if (that.editor) {
  7638. that.editor.dispose();
  7639. delete that.editor;
  7640. }
  7641. },
  7642. afterrender: function (sender) {
  7643. var $dom = $(that.el.dom).find('.editor');
  7644. attach_3($dom[0], {
  7645. value: that.code
  7646. }).then(function (editor) {
  7647. that.editor = editor;
  7648. that.applyPosition();
  7649. that.editor.onDidChangeModelContent(function (e) {
  7650. that.fireEvent('change', that.editor, e);
  7651. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  7652. that.codeChange(that.editor.getValue(), that.name, e);
  7653. }
  7654. that.isChangeFromOuter = false;
  7655. });
  7656. });
  7657. }
  7658. });
  7659. }
  7660. });
  7661. }
  7662. function attach_3(element, opts) {
  7663. return new Promise(function (resolve) {
  7664. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  7665. enabled: false
  7666. } }));
  7667. editor.onKeyUp(function (e) {
  7668. // console.log(e)
  7669. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7670. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7671. }
  7672. });
  7673. resolve(editor);
  7674. });
  7675. }
  7676. //# sourceMappingURL=GroovyEditor.js.map
  7677. function initJsEditor () {
  7678. Ext.define('com.yvan.studio.JsEditor', {
  7679. extend: 'Ext.panel.Panel',
  7680. alias: 'widget.jseditor',
  7681. xtype: 'jseditor',
  7682. layout: 'fit',
  7683. border: false,
  7684. html: "<div class=\"editor\"/>",
  7685. autoFocusMethod: true,
  7686. autoFocusStartLine: 0,
  7687. autoFocusStartColumn: 0,
  7688. codeChange: undefined,
  7689. funcArr: [],
  7690. modulePage: null,
  7691. isChangeFromOuter: false,
  7692. name: "",
  7693. /**
  7694. * 设置代码
  7695. */
  7696. setCode: function (value) {
  7697. var _this = this;
  7698. this.code = value;
  7699. _$2.defer(function () {
  7700. _this.isChangeFromOuter = true;
  7701. if (_this.editor) {
  7702. _this.editor.setValue(value);
  7703. if (_this.name === "controllerEditor") {
  7704. _this.funcArr = _this.getAllFunction();
  7705. }
  7706. }
  7707. });
  7708. },
  7709. getCode: function () {
  7710. var _a;
  7711. if (!this.editor) {
  7712. return this.code;
  7713. }
  7714. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7715. },
  7716. applyPosition: function () {
  7717. var _this = this;
  7718. if (this.autoFocusMethod) {
  7719. if (this.editor) {
  7720. _$2.defer(function () {
  7721. if (_this.autoFocusStartLine) {
  7722. _this.editor.setPosition({
  7723. lineNumber: _this.autoFocusStartLine,
  7724. column: _this.autoFocusStartColumn
  7725. });
  7726. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7727. }
  7728. _this.editor.focus();
  7729. });
  7730. delete this.autoFocusMethod;
  7731. }
  7732. }
  7733. this.editor.layout();
  7734. },
  7735. initComponent: function () {
  7736. var that = this;
  7737. this.superclass.initComponent.apply(this, arguments);
  7738. this.on({
  7739. resize: function (sender, width, height) {
  7740. if (that.editor) {
  7741. that.editor.layout();
  7742. }
  7743. },
  7744. destory: function () {
  7745. if (that.editor) {
  7746. that.editor.dispose();
  7747. delete that.editor;
  7748. }
  7749. },
  7750. afterrender: function () {
  7751. var $dom = $(that.el.dom).find('.editor');
  7752. attach_1($dom[0], {
  7753. value: that.code
  7754. }).then(function (editor) {
  7755. that.editor = editor;
  7756. that.applyPosition();
  7757. that.editor.onDidChangeModelContent(function (e) {
  7758. that.fireEvent('change', that.editor, e);
  7759. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7760. that.codeChange(that.editor.getValue(), that.name, e);
  7761. }
  7762. that.isChangeFromOuter = false;
  7763. });
  7764. });
  7765. }
  7766. });
  7767. },
  7768. getAllFunction: function () {
  7769. var funcArr = [];
  7770. var ast = window['YvanUI'].recast.parse(this.code);
  7771. if (ast && ast.program && ast.program.body) {
  7772. if (Array.isArray(ast.program.body)) {
  7773. for (var i = 0; i < ast.program.body.length; i++) {
  7774. var m = ast.program.body[i];
  7775. if (m.type === "ExportDefaultDeclaration") {
  7776. if (m.declaration.type === "ClassDeclaration") {
  7777. if (m.declaration.body.type === "ClassBody") {
  7778. if (Array.isArray(m.declaration.body.body)) {
  7779. for (var j = 0; j < m.declaration.body.body.length; j++) {
  7780. var ob = m.declaration.body.body[j];
  7781. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  7782. var funcItem = { name: ob.key.name, args: [] };
  7783. if (Array.isArray(ob.value.params)) {
  7784. for (var k = 0; k < ob.value.params.length; k++) {
  7785. var p = ob.value.params[k];
  7786. funcItem.args.push(p.name);
  7787. }
  7788. }
  7789. funcArr.push(funcItem);
  7790. }
  7791. }
  7792. }
  7793. }
  7794. }
  7795. }
  7796. }
  7797. }
  7798. }
  7799. return funcArr;
  7800. }
  7801. });
  7802. }
  7803. var isInited = false;
  7804. function attach_1(element, opts) {
  7805. return new Promise(function (resolve) {
  7806. var monaco = window['monaco'];
  7807. if (!isInited) {
  7808. isInited = true;
  7809. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  7810. noSemanticValidation: true,
  7811. noSyntaxValidation: false
  7812. });
  7813. // compiler options
  7814. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  7815. target: monaco.languages.typescript.ScriptTarget.ES2016,
  7816. allowNonTsExtensions: true,
  7817. });
  7818. // extra libraries
  7819. var libSource = [
  7820. 'declare class Facts {',
  7821. ' /**',
  7822. ' * Returns the next fact',
  7823. ' */',
  7824. ' static next():string',
  7825. ' static next222():string',
  7826. '}',
  7827. "\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 ",
  7828. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  7829. ].join('\n');
  7830. var libUri = 'file:///index.d.ts';
  7831. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  7832. // When resolving definitions and references, the editor will try to use created models.
  7833. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  7834. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  7835. }
  7836. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  7837. resolve(editor);
  7838. });
  7839. }
  7840. //# sourceMappingURL=JsEditor.js.map
  7841. function initJsonEditor () {
  7842. Ext.define('com.yvan.studio.JsonEditor', {
  7843. extend: 'Ext.panel.Panel',
  7844. alias: 'widget.jsoneditor',
  7845. xtype: 'jsoneditor',
  7846. layout: 'fit',
  7847. border: false,
  7848. html: "<div class=\"editor\"/>",
  7849. autoFocusMethod: true,
  7850. autoFocusStartLine: 0,
  7851. autoFocusStartColumn: 0,
  7852. codeChange: undefined,
  7853. funcArr: [],
  7854. modulePage: null,
  7855. isChangeFromOuter: false,
  7856. name: "",
  7857. /**
  7858. * 设置代码
  7859. */
  7860. setCode: function (value) {
  7861. var _this = this;
  7862. this.code = value;
  7863. _$2.defer(function () {
  7864. _this.isChangeFromOuter = true;
  7865. if (_this.editor) {
  7866. _this.editor.setValue(value);
  7867. }
  7868. });
  7869. },
  7870. updateOptions: function (options) {
  7871. if (this.editor && options) {
  7872. this.editor.updateOptions(options);
  7873. }
  7874. },
  7875. setLanguage: function (lang) {
  7876. if (this.editor && lang) {
  7877. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  7878. }
  7879. },
  7880. getCode: function () {
  7881. var _a;
  7882. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7883. },
  7884. applyPosition: function () {
  7885. var _this = this;
  7886. if (this.autoFocusMethod) {
  7887. if (this.editor) {
  7888. _$2.defer(function () {
  7889. if (_this.autoFocusStartLine) {
  7890. _this.editor.setPosition({
  7891. lineNumber: _this.autoFocusStartLine,
  7892. column: _this.autoFocusStartColumn
  7893. });
  7894. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7895. }
  7896. _this.editor.focus();
  7897. });
  7898. delete this.autoFocusMethod;
  7899. }
  7900. }
  7901. this.editor.layout();
  7902. },
  7903. initComponent: function () {
  7904. var that = this;
  7905. this.superclass.initComponent.apply(this, arguments);
  7906. this.on({
  7907. resize: function (sender, width, height) {
  7908. if (that.editor) {
  7909. that.editor.layout();
  7910. }
  7911. },
  7912. destory: function () {
  7913. if (that.editor) {
  7914. that.editor.dispose();
  7915. delete that.editor;
  7916. }
  7917. },
  7918. afterrender: function (sender) {
  7919. var $dom = $(that.el.dom).find('.editor');
  7920. attach_116($dom[0], {
  7921. value: that.code
  7922. }).then(function (editor) {
  7923. that.editor = editor;
  7924. that.applyPosition();
  7925. that.editor.onDidChangeModelContent(function (e) {
  7926. that.fireEvent('change', that.editor, e);
  7927. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7928. that.codeChange(that.editor.getValue(), that.name, e);
  7929. }
  7930. that.isChangeFromOuter = false;
  7931. });
  7932. });
  7933. }
  7934. });
  7935. },
  7936. });
  7937. }
  7938. function attach_116(element, opts) {
  7939. return new Promise(function (resolve) {
  7940. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  7941. enabled: false
  7942. } }));
  7943. editor.onKeyUp(function (e) {
  7944. // console.log(e)
  7945. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7946. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7947. }
  7948. });
  7949. resolve(editor);
  7950. });
  7951. }
  7952. //# sourceMappingURL=JsonEditor.js.map
  7953. function initSqlEditor () {
  7954. Ext.define('com.yvan.studio.SqlEditor', {
  7955. extend: 'Ext.panel.Panel',
  7956. alias: 'widget.sqleditor',
  7957. xtype: 'sqleditor',
  7958. layout: 'fit',
  7959. border: false,
  7960. html: "<div class=\"editor\"/>",
  7961. config: {
  7962. value: ''
  7963. },
  7964. codeChange: undefined,
  7965. isChangeFromOuter: false,
  7966. setCode: function (value) {
  7967. var _this = this;
  7968. this.code = value;
  7969. this.value = value;
  7970. _$2.defer(function () {
  7971. _this.isChangeFromOuter = true;
  7972. if (_this.editor) {
  7973. _this.editor.setValue(value);
  7974. }
  7975. });
  7976. },
  7977. getCode: function () {
  7978. return this.getValue();
  7979. },
  7980. updateOptions: function (options) {
  7981. if (this.editor && options) {
  7982. this.editor.updateOptions(options);
  7983. }
  7984. },
  7985. getValue: function () {
  7986. if (!this.editor) {
  7987. return this.code;
  7988. }
  7989. return this.editor.getValue();
  7990. },
  7991. applyPosition: function () {
  7992. var _this = this;
  7993. if (this.autoFocusMethod) {
  7994. if (this.editor) {
  7995. _$2.defer(function () {
  7996. if (_this.autoFocusStartLine) {
  7997. _this.editor.setPosition({
  7998. lineNumber: _this.autoFocusStartLine,
  7999. column: _this.autoFocusStartColumn
  8000. });
  8001. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  8002. }
  8003. _this.editor.focus();
  8004. });
  8005. delete this.autoFocusMethod;
  8006. }
  8007. }
  8008. this.editor.layout();
  8009. },
  8010. setValue: function (value, fromEditor) {
  8011. this.setCode(value);
  8012. var me = this;
  8013. if (me.value === value) {
  8014. // 值相等,不需要变化
  8015. return;
  8016. }
  8017. if (fromEditor !== true && me.editor) {
  8018. // 不是来源于编辑器的变化,才设置编辑器的值
  8019. me.editor.setValue(value);
  8020. }
  8021. // 通知mixins setValue
  8022. me.value = value;
  8023. me.fireEvent('change', value);
  8024. },
  8025. initComponent: function () {
  8026. var that = this;
  8027. this.superclass.initComponent.call(this);
  8028. that.on({
  8029. resize: function () {
  8030. if (that.editor) {
  8031. that.editor.layout();
  8032. }
  8033. },
  8034. destory: function () {
  8035. if (that.editor) {
  8036. that.editor.dispose();
  8037. delete that.editor;
  8038. }
  8039. },
  8040. afterrender: function (sender) {
  8041. var $dom = $(that.el.dom).find('.editor');
  8042. attach_2($dom[0], {
  8043. value: that.code
  8044. }).then(function (editor) {
  8045. that.editor = editor;
  8046. that.applyPosition();
  8047. that.editor.onDidChangeModelContent(function (e) {
  8048. that.fireEvent('change', that.editor, e);
  8049. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  8050. that.codeChange(that.editor.getValue(), that.name, e);
  8051. }
  8052. that.isChangeFromOuter = false;
  8053. });
  8054. });
  8055. }
  8056. });
  8057. }
  8058. });
  8059. }
  8060. function attach_2(element, opts) {
  8061. return new Promise(function (resolve) {
  8062. var monaco = window['monaco'];
  8063. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  8064. enabled: false
  8065. } }));
  8066. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  8067. // const sql = editor.getValue()
  8068. // if (_.trim(sql).length > 0) {
  8069. // editor.setValue(format(sql, {
  8070. // indent: ' ',
  8071. // uppercase: true,
  8072. // }))
  8073. // }
  8074. msg$1('没做');
  8075. });
  8076. editor.onKeyUp(function (e) {
  8077. // console.log(e)
  8078. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8079. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8080. }
  8081. });
  8082. resolve(editor);
  8083. });
  8084. }
  8085. //# sourceMappingURL=SqlEditor.js.map
  8086. function initTemplateEditor () {
  8087. Ext.define('com.yvan.studio.TemplateEditor', {
  8088. extend: 'Ext.panel.Panel',
  8089. alias: 'widget.templateeditor',
  8090. xtype: 'templateeditor',
  8091. layout: 'fit',
  8092. border: false,
  8093. html: "<div class=\"editor\"/>",
  8094. autoFocusMethod: true,
  8095. autoFocusStartLine: 0,
  8096. autoFocusStartColumn: 0,
  8097. codeChange: undefined,
  8098. funcArr: [],
  8099. modulePage: null,
  8100. isChangeFromOuter: false,
  8101. name: "",
  8102. /**
  8103. * 设置代码
  8104. */
  8105. setCode: function (value) {
  8106. var _this = this;
  8107. this.code = value;
  8108. _$2.defer(function () {
  8109. _this.isChangeFromOuter = true;
  8110. if (_this.editor) {
  8111. _this.editor.setValue(value);
  8112. }
  8113. });
  8114. },
  8115. getCode: function () {
  8116. var _a;
  8117. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  8118. },
  8119. applyPosition: function () {
  8120. var _this = this;
  8121. if (this.autoFocusMethod) {
  8122. if (this.editor) {
  8123. _$2.defer(function () {
  8124. if (_this.autoFocusStartLine) {
  8125. _this.editor.setPosition({
  8126. lineNumber: _this.autoFocusStartLine,
  8127. column: _this.autoFocusStartColumn
  8128. });
  8129. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  8130. }
  8131. _this.editor.focus();
  8132. });
  8133. delete this.autoFocusMethod;
  8134. }
  8135. }
  8136. this.editor.layout();
  8137. },
  8138. initComponent: function () {
  8139. var that = this;
  8140. this.superclass.initComponent.apply(this, arguments);
  8141. this.on({
  8142. resize: function (sender, width, height) {
  8143. if (that.editor) {
  8144. that.editor.layout();
  8145. }
  8146. },
  8147. destory: function () {
  8148. if (that.editor) {
  8149. that.editor.dispose();
  8150. delete that.editor;
  8151. }
  8152. },
  8153. afterrender: function (sender) {
  8154. var $dom = $(that.el.dom).find('.editor');
  8155. attach_117($dom[0], {
  8156. value: that.code
  8157. }).then(function (editor) {
  8158. that.editor = editor;
  8159. that.applyPosition();
  8160. that.editor.onDidChangeModelContent(function (e) {
  8161. that.fireEvent('change', that.editor, e);
  8162. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  8163. that.codeChange(that.editor.getValue(), that.name, e);
  8164. }
  8165. that.isChangeFromOuter = false;
  8166. });
  8167. });
  8168. }
  8169. });
  8170. },
  8171. });
  8172. }
  8173. function attach_117(element, opts) {
  8174. return new Promise(function (resolve) {
  8175. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  8176. enabled: false
  8177. } }));
  8178. editor.onKeyUp(function (e) {
  8179. // console.log(e)
  8180. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8181. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8182. }
  8183. });
  8184. resolve(editor);
  8185. });
  8186. }
  8187. //# sourceMappingURL=TemplateEditor.js.map
  8188. var DictStore = /** @class */ (function (_super) {
  8189. __extends(DictStore, _super);
  8190. function DictStore() {
  8191. return _super !== null && _super.apply(this, arguments) || this;
  8192. }
  8193. DictStore.prototype.getCacheKey = function (param) {
  8194. return "dict_data.json";
  8195. };
  8196. DictStore.prototype.invokeApi = function (param) {
  8197. return getDict(param);
  8198. };
  8199. DictStore.prototype.getDicts = function () {
  8200. return this.apiResponse.data.dict;
  8201. };
  8202. DictStore.prototype.getDictCodes = function () {
  8203. return new Promise(function (resolve) {
  8204. // reloadIfNeedPromise().then(() => {
  8205. // const result = []
  8206. // _.forEach(this.getDicts(), dictRow => {
  8207. // result.push({
  8208. // id: dictRow.dict_code,
  8209. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  8210. // })
  8211. // })
  8212. // resolve(result)
  8213. // })
  8214. });
  8215. };
  8216. DictStore.prototype.saveDict = function (param) {
  8217. return saveDictApi(param);
  8218. };
  8219. DictStore.prototype.saveDictItems = function (param) {
  8220. return saveDictItemsApi(param);
  8221. };
  8222. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  8223. var results = [];
  8224. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  8225. if (dictItemRow.dict_code === dict_code) {
  8226. results.push(_$2.clone(dictItemRow));
  8227. }
  8228. });
  8229. return results;
  8230. };
  8231. return DictStore;
  8232. }(CacheStore));
  8233. var instance$1 = new DictStore();
  8234. //# sourceMappingURL=DictStore.js.map
  8235. var DictTreeController = /** @class */ (function () {
  8236. function DictTreeController() {
  8237. this._saveStateFlag = true;
  8238. }
  8239. DictTreeController.prototype.dictSave = function () {
  8240. var _this = this;
  8241. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8242. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  8243. if (err) {
  8244. // 如果有异常就不保存
  8245. return;
  8246. }
  8247. // 进行业务上的逻辑校验,比如说必填校验等等
  8248. var hasError = false;
  8249. _$2.forEach(rows, function (row, i) {
  8250. if (isEmpty(row.dict_code)) {
  8251. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  8252. hasError = true;
  8253. return false;
  8254. }
  8255. });
  8256. if (hasError) {
  8257. return;
  8258. }
  8259. // 设置当前界面为 "保存中..." 状态
  8260. this.view.setLoading(true);
  8261. instance$1.saveDict({
  8262. newRows: newRows,
  8263. modifyRows: modifyRows,
  8264. removeRecords: removeRecords,
  8265. }).then(function (res) {
  8266. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8267. msg$1(res.msg);
  8268. _this.reload();
  8269. }).finally(function () {
  8270. // 无论正常异常,关闭 "保存中..." 状态
  8271. _this.view.setLoading(false);
  8272. });
  8273. };
  8274. DictTreeController.prototype.dictItemSave = function () {
  8275. var _this = this;
  8276. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8277. var currentDictCode = undefined;
  8278. if (record) {
  8279. currentDictCode = record.get('dict_code');
  8280. }
  8281. if (!currentDictCode) {
  8282. msg$1('请选择一个字典');
  8283. return;
  8284. }
  8285. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8286. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  8287. if (err) {
  8288. // 如果有异常就不保存
  8289. return;
  8290. }
  8291. // 进行业务上的逻辑校验,比如说必填校验等等
  8292. var hasError = false;
  8293. _$2.forEach(rows, function (row, i) {
  8294. if (!row.dict_value && row.dict_value !== 0) {
  8295. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  8296. hasError = true;
  8297. return false;
  8298. }
  8299. });
  8300. if (hasError) {
  8301. return;
  8302. }
  8303. // 设置当前界面为 "保存中..." 状态
  8304. this.view.setLoading(true);
  8305. instance$1.saveDictItems({
  8306. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  8307. newRows: newRows,
  8308. modifyRows: modifyRows,
  8309. removeRecords: removeRecords,
  8310. dict_code: currentDictCode
  8311. }).then(function (res) {
  8312. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8313. msg$1(res.msg);
  8314. _this.reload();
  8315. }).finally(function () {
  8316. // 无论正常异常,关闭 "保存中..." 状态
  8317. _this.view.setLoading(false);
  8318. });
  8319. };
  8320. DictTreeController.prototype.createDictEnum = function () {
  8321. var _this = this;
  8322. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8323. var currentDictCode = undefined;
  8324. if (record) {
  8325. currentDictCode = record.get('dict_code');
  8326. }
  8327. if (!currentDictCode) {
  8328. msg$1('请选择一个字典');
  8329. return;
  8330. }
  8331. // 设置当前界面为 "保存中..." 状态
  8332. this.view.setLoading(true);
  8333. createDictEnum({ dictCode: currentDictCode })
  8334. .then(function () { return _this.reload(); })
  8335. .finally(function () { return _this.view.setLoading(false); });
  8336. };
  8337. DictTreeController.prototype.onLoad = function () {
  8338. setDictTree(this);
  8339. this.grid1 = this.view.lookupReference('grid1');
  8340. this.grid2 = this.view.lookupReference('grid2');
  8341. this.grid1.setData([]);
  8342. this.grid2.setData([]);
  8343. // this.grid1.columns[0].hide()
  8344. this.grid2.columns[0].hide();
  8345. // 找管理器订阅刷新的事件
  8346. instance$1.registe(this.refreshData.bind(this));
  8347. // 非强制性刷新 DbManager
  8348. instance$1.reloadIfNeed(undefined);
  8349. };
  8350. DictTreeController.prototype.onDestory = function () {
  8351. instance$1.unregiste(this.refreshData.bind(this));
  8352. };
  8353. // dictStore 刷新时,会回调到这个方法
  8354. DictTreeController.prototype.refreshData = function (isLoadingState) {
  8355. var me = this;
  8356. if (typeof isLoadingState === 'boolean') {
  8357. me.view.setLoading(isLoadingState);
  8358. return;
  8359. }
  8360. this.grid1.setData(instance$1.getDicts());
  8361. this.restoreState();
  8362. };
  8363. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  8364. var _this = this;
  8365. _$2.defer(function () {
  8366. _this.saveState();
  8367. });
  8368. if (!record) {
  8369. this.grid2.setData([]);
  8370. return;
  8371. }
  8372. var dict_code = record.get('dict_code');
  8373. var data = instance$1.getDictItemByDictcode(dict_code);
  8374. this.grid2.setData(data);
  8375. };
  8376. DictTreeController.prototype.reload = function () {
  8377. var _this = this;
  8378. // 强制刷新 DbManager
  8379. instance$1.reloadForce(undefined).then(function (res) {
  8380. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  8381. });
  8382. };
  8383. DictTreeController.prototype.dictAdd = function () {
  8384. this.grid1.appendEditRow({
  8385. _createFlag: true,
  8386. dict_code: '',
  8387. dict_desc: '',
  8388. }, 0);
  8389. };
  8390. DictTreeController.prototype.dictRemove = function () {
  8391. this.grid1.removeEditRow();
  8392. };
  8393. DictTreeController.prototype.dictItemAdd = function () {
  8394. var _a, _b;
  8395. 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;
  8396. if (!dict_code) {
  8397. msg$1('请先保存字典');
  8398. return;
  8399. }
  8400. this.grid2.appendEditRow({
  8401. dict_code: dict_code,
  8402. dict_text: '',
  8403. dict_value: '',
  8404. }, 0);
  8405. };
  8406. DictTreeController.prototype.dictItemRemove = function () {
  8407. var _this = this;
  8408. var rows = [];
  8409. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  8410. rows.push(r);
  8411. });
  8412. _$2.forEach(rows, function (r) {
  8413. _this.grid2.getStore().remove(r);
  8414. });
  8415. };
  8416. DictTreeController.prototype.clearSearch1 = function () {
  8417. this.grid1.store.clearFilter();
  8418. };
  8419. DictTreeController.prototype.search1 = function (sender) {
  8420. this.grid1.store.clearFilter();
  8421. this.getViewModel().set('grid1.selection', null);
  8422. this.grid1.fireEvent('itemselect');
  8423. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8424. if (!value) {
  8425. return;
  8426. }
  8427. this.grid1.store.filterBy(function (record) {
  8428. if (record.get('_createFlag')) {
  8429. return true;
  8430. }
  8431. var dict_code = _$2.lowerCase(record.get('dict_code'));
  8432. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  8433. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  8434. return (dict_code.includes(value) ||
  8435. dict_desc.includes(value) ||
  8436. dict_desc_py.includes(value));
  8437. });
  8438. };
  8439. DictTreeController.prototype.clearSearch2 = function () {
  8440. this.grid2.store.clearFilter();
  8441. };
  8442. DictTreeController.prototype.search2 = function (sender) {
  8443. this.grid2.store.clearFilter();
  8444. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8445. if (!value) {
  8446. return;
  8447. }
  8448. this.grid2.store.filterBy(function (record) {
  8449. var dict_text = _$2.lowerCase(record.get('dict_text'));
  8450. var dict_value = _$2.lowerCase(record.get('dict_value'));
  8451. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  8452. return (dict_text.includes(value) ||
  8453. dict_value === value ||
  8454. dict_text_py.includes(value));
  8455. });
  8456. };
  8457. DictTreeController.prototype.getStateFilename = function () {
  8458. return getCurrentProject().uuid + "/dicttree.json";
  8459. };
  8460. DictTreeController.prototype.restoreState = function () {
  8461. var _this = this;
  8462. var grid = this.grid1;
  8463. native.loadFile(this.getStateFilename(), function (content) {
  8464. if (!content)
  8465. return;
  8466. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  8467. _this._saveStateFlag = false;
  8468. if (selection) {
  8469. var idx = grid.store.findExact('dict_code', selection);
  8470. if (idx >= 0) {
  8471. var record = grid.store.getAt(idx);
  8472. if (record) {
  8473. grid.setSelection([record]);
  8474. }
  8475. }
  8476. }
  8477. if (scrollPosition && scrollSize) {
  8478. var size = grid.scrollable.getSize();
  8479. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  8480. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  8481. }
  8482. }
  8483. setTimeout(function () {
  8484. _this._saveStateFlag = true;
  8485. }, 200);
  8486. });
  8487. };
  8488. DictTreeController.prototype.saveState = function () {
  8489. if (!this._saveStateFlag) {
  8490. return;
  8491. }
  8492. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8493. var selection = undefined;
  8494. if (record) {
  8495. selection = record.get('dict_code');
  8496. }
  8497. var scrollPosition = this.grid1.scrollable.position;
  8498. var scrollSize = this.grid1.scrollable.getSize();
  8499. native.saveFile(this.getStateFilename(), {
  8500. selection: selection,
  8501. scrollPosition: scrollPosition,
  8502. scrollSize: scrollSize
  8503. });
  8504. };
  8505. return DictTreeController;
  8506. }());
  8507. //# sourceMappingURL=DictTreeController.js.map
  8508. function initDict () {
  8509. var controller = new DictTreeController();
  8510. Ext.define('com.yvan.studio.DictTree', {
  8511. extend: 'Ext.panel.Panel',
  8512. xtype: 'dicttree',
  8513. controller: controller,
  8514. scope: controller,
  8515. referenceHolder: true,
  8516. tooltip: '字典',
  8517. iconCls: 'x-fa fa-book',
  8518. rootVisible: false,
  8519. useArrows: true,
  8520. reference: 'dicttree',
  8521. layout: 'border',
  8522. listeners: {
  8523. afterrender: 'onLoad',
  8524. destory: 'onDestory',
  8525. },
  8526. items: [
  8527. {
  8528. region: 'center',
  8529. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  8530. _mode: 'select',
  8531. tbar: [
  8532. {
  8533. xtype: 'button',
  8534. tooltip: '刷新',
  8535. iconCls: 'x-fa fa-refresh',
  8536. listeners: {
  8537. click: 'reload'
  8538. }
  8539. },
  8540. {
  8541. xtype: 'button',
  8542. tooltip: '添加',
  8543. iconCls: 'x-fa fa-plus-circle',
  8544. listeners: {
  8545. click: 'dictAdd'
  8546. }
  8547. },
  8548. {
  8549. xtype: 'button',
  8550. tooltip: '删除',
  8551. iconCls: 'x-fa fa-minus-circle',
  8552. bind: {
  8553. disabled: '{!grid1.selection}'
  8554. },
  8555. listeners: {
  8556. click: 'dictRemove'
  8557. }
  8558. },
  8559. {
  8560. xtype: 'button',
  8561. tooltip: '保存',
  8562. iconCls: 'x-fa fa-save',
  8563. bind: {
  8564. disabled: '{!grid1.ischanged}'
  8565. },
  8566. listeners: {
  8567. click: 'dictSave'
  8568. }
  8569. },
  8570. {
  8571. xtype: 'textfield',
  8572. hideClear: true,
  8573. triggers: {
  8574. clear: {
  8575. cls: 'x-form-clear-trigger',
  8576. handler: 'clearSearch1'
  8577. },
  8578. },
  8579. flex: 1,
  8580. emptyText: '搜索过滤',
  8581. enableKeyEvents: true,
  8582. listeners: {
  8583. keyup: {
  8584. fn: 'search1',
  8585. buffer: 50
  8586. }
  8587. }
  8588. },
  8589. ],
  8590. listeners: {
  8591. itemselect: 'grid1Selected',
  8592. },
  8593. idField: 'dict_code',
  8594. columns: [
  8595. {
  8596. text: '字典编号', dataIndex: 'dict_code',
  8597. menuDisabled: true, flex: 1,
  8598. editor: {
  8599. allowBlank: true,
  8600. selectOnFocus: false
  8601. }
  8602. },
  8603. {
  8604. text: '中文描述', dataIndex: 'dict_desc',
  8605. menuDisabled: true, flex: 1,
  8606. editor: {
  8607. allowBlank: true,
  8608. selectOnFocus: false
  8609. }
  8610. },
  8611. ]
  8612. },
  8613. {
  8614. region: 'south', height: '50%',
  8615. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  8616. split: true,
  8617. _mode: 'edit1',
  8618. listeners: {},
  8619. tbar: [
  8620. {
  8621. xtype: 'button',
  8622. tooltip: '添加',
  8623. iconCls: 'x-fa fa-plus-circle',
  8624. bind: {
  8625. disabled: '{!grid1.selection}'
  8626. },
  8627. listeners: {
  8628. click: 'dictItemAdd'
  8629. }
  8630. },
  8631. {
  8632. xtype: 'button',
  8633. tooltip: '删除',
  8634. iconCls: 'x-fa fa-minus-circle',
  8635. bind: {
  8636. disabled: '{!grid1.selection}'
  8637. },
  8638. listeners: {
  8639. click: 'dictItemRemove'
  8640. }
  8641. },
  8642. {
  8643. xtype: 'button',
  8644. tooltip: '保存',
  8645. iconCls: 'x-fa fa-save',
  8646. bind: {
  8647. disabled: '{!grid2.ischanged}'
  8648. },
  8649. listeners: {
  8650. click: 'dictItemSave'
  8651. }
  8652. },
  8653. {
  8654. xtype: 'button',
  8655. tooltip: '刷新代码',
  8656. iconCls: 'x-fa fa-code',
  8657. bind: {
  8658. disabled: '{!grid1.selection}'
  8659. },
  8660. listeners: {
  8661. click: 'createDictEnum'
  8662. }
  8663. },
  8664. ],
  8665. columns: [
  8666. {
  8667. text: '字典项', dataIndex: 'dict_text',
  8668. menuDisabled: true, flex: 1,
  8669. editor: {
  8670. allowBlank: true,
  8671. selectOnFocus: false
  8672. }
  8673. },
  8674. {
  8675. text: '字典值', dataIndex: 'dict_value',
  8676. menuDisabled: true, flex: 1,
  8677. dataType: 'int',
  8678. editor: {
  8679. xtype: 'numberfield',
  8680. allowBlank: true,
  8681. selectOnFocus: false
  8682. }
  8683. },
  8684. {
  8685. text: '激活', dataIndex: 'is_enable',
  8686. xtype: 'checkcolumn', menuDisabled: true,
  8687. },
  8688. {
  8689. text: '变量名', dataIndex: 'var_name',
  8690. menuDisabled: true, flex: 1,
  8691. editor: {
  8692. allowBlank: true,
  8693. selectOnFocus: false
  8694. }
  8695. },
  8696. ]
  8697. }
  8698. ]
  8699. });
  8700. }
  8701. //# sourceMappingURL=DictTree.js.map
  8702. var model$2 = {
  8703. data: {
  8704. form: {
  8705. path: "",
  8706. requestBody: "",
  8707. responseBody: "",
  8708. }
  8709. }
  8710. };
  8711. var vjson$2 = {
  8712. title: '接口信息',
  8713. layout: 'fit',
  8714. width: 800,
  8715. height: 500,
  8716. items: [
  8717. {
  8718. xtype: 'form',
  8719. layout: {
  8720. type: 'vbox',
  8721. pack: 'start',
  8722. align: 'stretch'
  8723. },
  8724. defaults: {
  8725. border: false,
  8726. anchor: '100%',
  8727. margin: '5',
  8728. },
  8729. items: [
  8730. {
  8731. xtype: 'textfield',
  8732. fieldLabel: '接口路径',
  8733. bind: {
  8734. value: "{form.path}",
  8735. },
  8736. },
  8737. {
  8738. xtype: 'textareafield',
  8739. // height: 150,
  8740. flex: 2,
  8741. fieldLabel: '请求数据',
  8742. bind: {
  8743. value: "{form.requestBody}",
  8744. },
  8745. },
  8746. {
  8747. xtype: 'textareafield',
  8748. // height: 150,
  8749. flex: 5,
  8750. fieldLabel: '响应数据',
  8751. bind: {
  8752. value: "{form.responseBody}",
  8753. },
  8754. },
  8755. ]
  8756. }
  8757. ]
  8758. };
  8759. var ApiInfoDialog = /** @class */ (function (_super) {
  8760. __extends(ApiInfoDialog, _super);
  8761. function ApiInfoDialog() {
  8762. return _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  8763. }
  8764. return ApiInfoDialog;
  8765. }(Scope));
  8766. //# sourceMappingURL=apiInfoDialog.js.map
  8767. var model$3 = {
  8768. data: {
  8769. query: {
  8770. role_id: '',
  8771. resource_id: '',
  8772. },
  8773. form: {},
  8774. form2: {
  8775. key: "",
  8776. start_at: "",
  8777. end_at: "",
  8778. }
  8779. }
  8780. };
  8781. var vjson$3 = {
  8782. title: '接口信息',
  8783. layout: 'fit',
  8784. items: [
  8785. {
  8786. layout: 'border',
  8787. border: false,
  8788. items: [
  8789. {
  8790. region: 'center',
  8791. layout: 'border',
  8792. items: [
  8793. {
  8794. region: 'north',
  8795. bind: {
  8796. title: '{form.title}',
  8797. },
  8798. xtype: 'form',
  8799. scrollable: true,
  8800. layout: {
  8801. type: 'vbox',
  8802. pack: 'start',
  8803. align: 'stretch'
  8804. },
  8805. defaults: {
  8806. border: false,
  8807. anchor: '100%',
  8808. margin: '5',
  8809. },
  8810. tbar: {
  8811. xtype: 'toolbar',
  8812. items: [
  8813. {
  8814. xtype: 'button',
  8815. text: '查询',
  8816. iconCls: 'x-fa fa-search',
  8817. listeners: {
  8818. click: 'scope.requestLogs'
  8819. },
  8820. },
  8821. {
  8822. xtype: 'button',
  8823. text: '保存',
  8824. iconCls: 'x-fa fa-save',
  8825. listeners: {},
  8826. },
  8827. {
  8828. xtype: 'button',
  8829. text: '禁用',
  8830. iconCls: 'x-fa fa-stop-circle',
  8831. bind: {},
  8832. listeners: {},
  8833. },
  8834. {
  8835. xtype: 'button',
  8836. text: '启用',
  8837. iconCls: 'x-fa fa-play-circle',
  8838. bind: {},
  8839. listeners: {},
  8840. },
  8841. ],
  8842. },
  8843. items: [
  8844. {
  8845. xtype: 'cols',
  8846. defaults: { labelWidth: 120 },
  8847. items: [
  8848. {
  8849. xtype: 'textfield',
  8850. fieldLabel: 'URL',
  8851. bind: {
  8852. value: '{form.api_url}',
  8853. },
  8854. readOnly: true,
  8855. },
  8856. {
  8857. xtype: 'textfield',
  8858. fieldLabel: '名称',
  8859. bind: {
  8860. value: '{form.api_name}',
  8861. },
  8862. readOnly: true,
  8863. },
  8864. ],
  8865. },
  8866. {
  8867. xtype: 'cols',
  8868. defaults: { labelWidth: 120 },
  8869. items: [
  8870. {
  8871. xtype: 'textfield',
  8872. fieldLabel: '实现类',
  8873. bind: {
  8874. value: '{form.api_class}',
  8875. },
  8876. readOnly: true,
  8877. },
  8878. {
  8879. border: false,
  8880. flex: 1
  8881. },
  8882. ]
  8883. },
  8884. {
  8885. xtype: 'cols',
  8886. defaults: { labelWidth: 120 },
  8887. items: [
  8888. {
  8889. xtype: 'textfield',
  8890. fieldLabel: '超时时间',
  8891. bind: {
  8892. value: '{form.timeout}',
  8893. },
  8894. readOnly: true,
  8895. },
  8896. {
  8897. border: false,
  8898. flex: 1
  8899. },
  8900. ]
  8901. },
  8902. {
  8903. xtype: 'cols',
  8904. defaults: { labelWidth: 120 },
  8905. items: [
  8906. {
  8907. xtype: 'textfield',
  8908. fieldLabel: 'Remote IP',
  8909. bind: {
  8910. value: '{form.remote_ip}',
  8911. },
  8912. readOnly: true,
  8913. },
  8914. {
  8915. border: false,
  8916. flex: 1
  8917. },
  8918. ]
  8919. },
  8920. {
  8921. xtype: 'cols',
  8922. defaults: { labelWidth: 120 },
  8923. items: [
  8924. {
  8925. xtype: 'textfield',
  8926. fieldLabel: '解析表单',
  8927. bind: {
  8928. value: '{form.chandi}',
  8929. },
  8930. readOnly: true,
  8931. },
  8932. {
  8933. border: false,
  8934. flex: 1
  8935. },
  8936. ]
  8937. },
  8938. ],
  8939. },
  8940. {
  8941. region: 'center',
  8942. // title: 'Request',
  8943. layout: 'border',
  8944. items: [
  8945. {
  8946. region: 'north',
  8947. xtype: 'form',
  8948. reference: 'form2',
  8949. split: true,
  8950. items: [
  8951. {
  8952. xtype: 'cols',
  8953. width: 700,
  8954. items: [
  8955. {
  8956. xtype: 'textfield',
  8957. fieldLabel: '关键字',
  8958. bind: {
  8959. value: "{form2.key}"
  8960. },
  8961. },
  8962. {
  8963. xtype: 'datefield',
  8964. fieldLabel: '开始时间',
  8965. bind: {
  8966. value: "{form2.start_at}"
  8967. },
  8968. },
  8969. {
  8970. xtype: 'datefield',
  8971. fieldLabel: '结束时间',
  8972. bind: {
  8973. value: "{form2.end_at}"
  8974. },
  8975. },
  8976. ]
  8977. }
  8978. ]
  8979. },
  8980. {
  8981. region: 'center',
  8982. xtype: 'yvgrid',
  8983. layout: 'fit',
  8984. reference: 'grid1',
  8985. pagination: true,
  8986. autoLoad: false,
  8987. selModel: {
  8988. selType: 'rowmodel',
  8989. mode: 'SINGLE',
  8990. },
  8991. dataSource: {
  8992. method: 'invoke',
  8993. url: '/sys/api/Api@requestLogs',
  8994. params: {
  8995. formData: '{form2}',
  8996. path: '{form.api_url}',
  8997. },
  8998. },
  8999. listeners: {
  9000. rowdblclick: 'scope.showDialog',
  9001. },
  9002. columns: [
  9003. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9004. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  9005. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  9006. { dataIndex: "size", header: "大小", width: 80 },
  9007. { dataIndex: "path", header: "path", flex: 1 },
  9008. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  9009. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  9010. ]
  9011. }
  9012. ]
  9013. },
  9014. ],
  9015. },
  9016. ],
  9017. },
  9018. ],
  9019. referenceHolder: true,
  9020. };
  9021. var Api = /** @class */ (function (_super) {
  9022. __extends(Api, _super);
  9023. function Api() {
  9024. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  9025. }
  9026. Api.prototype.onLoad = function () {
  9027. _super.prototype.onLoad.call(this);
  9028. this.requestLogs();
  9029. };
  9030. Api.prototype.selectList = function (sender, selected, eOpts) {
  9031. this.viewModel.set("form", selected.data);
  9032. if (selected.data.api_type === '1') {
  9033. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  9034. }
  9035. else {
  9036. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  9037. }
  9038. };
  9039. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  9040. var sel = [];
  9041. _$2.forEach(records, function (item) {
  9042. if (item.data.flg === 'Y') {
  9043. sel.push(item);
  9044. }
  9045. });
  9046. this.refs.methodGrid.selModel.select(sel);
  9047. };
  9048. Api.prototype.saveAll = function () {
  9049. var _this = this;
  9050. var _a, _b, _c;
  9051. var role_id = this.viewModel.get("query.role_id");
  9052. if (!role_id) {
  9053. msg$1("请先选择一个角色");
  9054. return;
  9055. }
  9056. var wh_id = this.viewModel.get("form.wh_id");
  9057. if (!wh_id) {
  9058. msg$1("请先选择一个仓库");
  9059. return;
  9060. }
  9061. var menus = this.refs.theTree.getChecked();
  9062. var rowsMenus = [];
  9063. _$2.forEach(menus, function (m) {
  9064. if (m.data.resource_id) {
  9065. rowsMenus.push(m.data.resource_id);
  9066. }
  9067. });
  9068. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  9069. 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; });
  9070. _$2.remove(mm, function (x) {
  9071. return methodsArry.includes(x.resource_id);
  9072. });
  9073. var rowsBtn = [];
  9074. _$2.forEach(mm, function (m) {
  9075. rowsBtn.push({ resource_id: m.resource_id });
  9076. });
  9077. this.setLoading(true);
  9078. invokeServer$1('/sys/role/Role@saveAll', {
  9079. wh_id: wh_id,
  9080. role_id: role_id,
  9081. rowsMenus: rowsMenus,
  9082. rowsBtn: rowsBtn,
  9083. }).then(function (res) {
  9084. msg$1(res.msg);
  9085. if (res.success) {
  9086. _this.reloadTree();
  9087. // this.viewModel.set('query.role_id', '')
  9088. _this.viewModel.set('query.resource_id', '');
  9089. _this.refs.methodGrid.reload();
  9090. }
  9091. }).finally(function () {
  9092. _this.setLoading(false);
  9093. });
  9094. };
  9095. Api.prototype.editRoleSuccess = function (sender, data) {
  9096. if (data.success) {
  9097. this.refs.roleGrid.reload();
  9098. this.viewModel.set("query.JIAOS_ID", "");
  9099. this.reloadTree();
  9100. this.viewModel.set("query.CAID_ID", "");
  9101. this.refs.methodGrid.reload();
  9102. }
  9103. };
  9104. Api.prototype.deleteRole = function (sender) {
  9105. var _this = this;
  9106. var role_id = this.viewModel.get("query.role_id");
  9107. if (!role_id) {
  9108. msg$1("请先选择一个角色");
  9109. return;
  9110. }
  9111. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  9112. if (btn === 'yes') {
  9113. invokeServer$1('/sys/role/Role@deleteRole', {
  9114. role_id: role_id,
  9115. wh_id: window['whId']
  9116. }).then(function (res) {
  9117. msg$1(res.msg);
  9118. if (res.success) {
  9119. _this.refs.roleGrid.reload();
  9120. _this.viewModel.set("query.role_id", "");
  9121. _this.reloadTree();
  9122. _this.refs.methodGrid.reload();
  9123. }
  9124. });
  9125. }
  9126. });
  9127. };
  9128. Api.prototype.reloadTree = function () {
  9129. showErrorDialog$1('reloadTree 不存在');
  9130. };
  9131. Api.prototype.whChange = function (sender, value) {
  9132. this.viewModel.set("form.wh_id", value);
  9133. this.reloadTree();
  9134. this.refs.methodGrid.reload();
  9135. };
  9136. Api.prototype.requestLogs = function () {
  9137. var path = this.viewModel.get("form.api_url");
  9138. if (!path)
  9139. return;
  9140. this.refs.grid1.reload();
  9141. };
  9142. Api.prototype.showDialog = function (sender) {
  9143. var _a, _b;
  9144. 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; });
  9145. if (!rows || rows.length <= 0)
  9146. return;
  9147. var dialog = new ApiInfoDialog();
  9148. dialog.showDialog(null, {}, {
  9149. data: {
  9150. form: __assign({}, rows[0])
  9151. }
  9152. });
  9153. };
  9154. return Api;
  9155. }(Scope));
  9156. //# sourceMappingURL=ApiPage.js.map
  9157. var Controller = /** @class */ (function () {
  9158. function Controller() {
  9159. }
  9160. Controller.prototype.selectList = function (sender, selected, eOpts) {
  9161. var _a, _b, _c, _d, _e, _f, _g, _h;
  9162. // @ts-ignore
  9163. 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; });
  9164. if (!rows || rows.length <= 0)
  9165. return;
  9166. var apiPage = new Api();
  9167. apiPage.showPage({
  9168. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  9169. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  9170. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  9171. }, {
  9172. data: {
  9173. form: __assign({}, rows[0])
  9174. }
  9175. });
  9176. };
  9177. return Controller;
  9178. }());
  9179. var controller = new Controller();
  9180. function initApiTree () {
  9181. Ext.define('com.yvan.studio.ApiGrid', {
  9182. extend: 'Ext.Panel',
  9183. xtype: 'apigrid',
  9184. controller: controller,
  9185. scope: controller,
  9186. referenceHolder: true,
  9187. layout: 'fit',
  9188. items: [
  9189. {
  9190. width: 400,
  9191. split: true,
  9192. xtype: 'yvgrid',
  9193. reference: 'roleGrid',
  9194. border: false,
  9195. pagination: false,
  9196. autoLoad: true,
  9197. remoteFilter: false,
  9198. selModel: {
  9199. selType: 'rowmodel',
  9200. mode: 'SINGLE',
  9201. },
  9202. tbar: {
  9203. xtype: 'toolbar',
  9204. items: [
  9205. {
  9206. xtype: 'button',
  9207. text: '新增',
  9208. iconCls: 'x-fa fa-plus-circle',
  9209. listeners: {},
  9210. },
  9211. {
  9212. xtype: 'button',
  9213. text: '删除',
  9214. iconCls: 'x-fa fa-trash',
  9215. bind: {
  9216. disabled: '{roleGrid.selection==null}',
  9217. },
  9218. listeners: {},
  9219. },
  9220. ],
  9221. },
  9222. dataSource: {
  9223. url: '/sys/api/Api@getApiList',
  9224. method: 'invoke',
  9225. params: {},
  9226. },
  9227. listeners: {
  9228. itemdblclick: "selectList",
  9229. },
  9230. columns: [
  9231. {
  9232. dataIndex: 'api_name',
  9233. header: '接口名称',
  9234. filter: { type: 'string' },
  9235. flex: 1,
  9236. },
  9237. ],
  9238. },
  9239. ]
  9240. });
  9241. }
  9242. //# sourceMappingURL=ApiTree.js.map
  9243. var model$4 = {
  9244. data: {
  9245. iframeSrc: ''
  9246. }
  9247. };
  9248. var vjson$4 = {
  9249. layout: 'fit',
  9250. border: false,
  9251. iconCls: 'x-fa fa-newspaper-o',
  9252. referenceHolder: true,
  9253. items: [
  9254. {
  9255. // title: 'view.design',
  9256. xtype: 'uxiframe',
  9257. layout: 'fit',
  9258. // cls: 'module_page_iframe',
  9259. reference: 'iframe',
  9260. listeners: {
  9261. afterrender: 'scope.iframeRender'
  9262. }
  9263. },
  9264. ]
  9265. };
  9266. var Iframe = /** @class */ (function (_super) {
  9267. __extends(Iframe, _super);
  9268. function Iframe(path) {
  9269. var _this = _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  9270. _this.path = "";
  9271. _this.path = path;
  9272. return _this;
  9273. }
  9274. Iframe.prototype.iframeRender = function (sender) {
  9275. var $dom = $(sender.el.dom).find('iframe');
  9276. var iframe = $dom[0];
  9277. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  9278. iframe.onload = function () {
  9279. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  9280. };
  9281. };
  9282. return Iframe;
  9283. }(Scope));
  9284. //# sourceMappingURL=Iframe.js.map
  9285. var Controller$1 = /** @class */ (function () {
  9286. function Controller() {
  9287. }
  9288. Controller.prototype.onDblClick = function (sender, record) {
  9289. var data = record.raw;
  9290. if (data.text === "运行报表") {
  9291. this.openIframe("/xxl-job/index", "运行报表");
  9292. }
  9293. else if (data.text === "任务管理") {
  9294. this.openIframe("/xxl-job/jobinfo", "任务管理");
  9295. }
  9296. else if (data.text === "调度日志") {
  9297. this.openIframe("/xxl-job/joblog", "调度日志");
  9298. }
  9299. else if (data.text === "执行器管理") {
  9300. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  9301. }
  9302. };
  9303. Controller.prototype.openIframe = function (path, title) {
  9304. var page = new Iframe(path);
  9305. page.showPage({
  9306. title: title,
  9307. id: 'xxljob__' + path.replaceAll("/", "_"),
  9308. path: 'xxljob__' + path.replaceAll("/", "_"),
  9309. }, {});
  9310. };
  9311. Controller.prototype.onLoad = function () {
  9312. var me = this;
  9313. me.getView().setRootNode({
  9314. expanded: true,
  9315. leaf: false,
  9316. children: [
  9317. { leaf: true, text: '运行报表' },
  9318. { leaf: true, text: '任务管理' },
  9319. { leaf: true, text: '调度日志' },
  9320. { leaf: true, text: '执行器管理' },
  9321. ]
  9322. });
  9323. };
  9324. return Controller;
  9325. }());
  9326. var controller$1 = new Controller$1();
  9327. function initTaskTree () {
  9328. Ext.define('com.yvan.studio.TaskTree', {
  9329. extend: 'Ext.tree.Panel',
  9330. xtype: 'tasktree',
  9331. controller: controller$1,
  9332. scope: controller$1,
  9333. reference: 'roleGrid',
  9334. tooltip: '表单定义',
  9335. iconCls: 'x-fa fa-bar-chart',
  9336. useArrows: true,
  9337. rootVisible: false,
  9338. colspan: 2,
  9339. lines: true,
  9340. multiSelect: false,
  9341. referenceHolder: true,
  9342. // openNode() {
  9343. // const selection = this.getSelection()
  9344. // const [record] = selection
  9345. // if (!record) {
  9346. // return
  9347. // }
  9348. //
  9349. // const {raw} = record;
  9350. // if (raw.type === 'Dir') {
  9351. // return
  9352. // }
  9353. // if (raw.type === "Module" && raw.module) {
  9354. // // eventBus.publish(EventType.ModuleOpen, raw)
  9355. // }
  9356. // },
  9357. listeners: {
  9358. itemdblclick: 'onDblClick',
  9359. afterrender: "onLoad",
  9360. },
  9361. });
  9362. }
  9363. //# sourceMappingURL=TaskTree.js.map
  9364. var model$5 = {
  9365. data: {
  9366. form: {
  9367. address: "",
  9368. level: "",
  9369. logger: "",
  9370. message: "",
  9371. nodeName: "",
  9372. serverName: "",
  9373. thread: "",
  9374. whId: "",
  9375. userId: "",
  9376. }
  9377. }
  9378. };
  9379. var vjson$5 = {
  9380. title: '接口信息',
  9381. layout: 'fit',
  9382. width: 800,
  9383. height: 600,
  9384. items: [
  9385. {
  9386. xtype: 'form',
  9387. layout: {
  9388. type: 'vbox',
  9389. pack: 'start',
  9390. align: 'stretch'
  9391. },
  9392. defaults: {
  9393. border: false,
  9394. anchor: '100%',
  9395. margin: '5',
  9396. },
  9397. items: [
  9398. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  9399. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  9400. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  9401. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  9402. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  9403. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  9404. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  9405. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  9406. {
  9407. xtype: 'textareafield',
  9408. flex: 5,
  9409. fieldLabel: '响应数据',
  9410. bind: {
  9411. value: "{form.message}",
  9412. },
  9413. },
  9414. ]
  9415. }
  9416. ]
  9417. };
  9418. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  9419. __extends(ApiInfoDialog, _super);
  9420. function ApiInfoDialog() {
  9421. return _super.call(this, { model: model$5, vjson: vjson$5 }) || this;
  9422. }
  9423. return ApiInfoDialog;
  9424. }(Scope));
  9425. //# sourceMappingURL=LogPageDialog.js.map
  9426. var model$6 = {
  9427. data: {
  9428. form2: {}
  9429. }
  9430. };
  9431. var vjson$6 = {
  9432. title: '日志查询',
  9433. layout: 'fit',
  9434. width: "70%",
  9435. height: "80%",
  9436. items: [
  9437. {
  9438. region: 'center',
  9439. xtype: 'yvgrid',
  9440. layout: 'fit',
  9441. reference: 'grid1',
  9442. pagination: false,
  9443. autoLoad: false,
  9444. selModel: {
  9445. selType: 'rowmodel',
  9446. mode: 'SINGLE',
  9447. },
  9448. dataSource: {
  9449. method: 'invoke',
  9450. url: '/sys/api/Api@aroundLogs',
  9451. params: {
  9452. formData: '{form2}',
  9453. },
  9454. },
  9455. listeners: {
  9456. rowdblclick: 'scope.showDialog2',
  9457. },
  9458. columns: [
  9459. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9460. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9461. { dataIndex: "thread", header: "thread", width: 150 },
  9462. { dataIndex: "message", header: "message", flex: 1 },
  9463. ]
  9464. }
  9465. ]
  9466. };
  9467. var AroundLog = /** @class */ (function (_super) {
  9468. __extends(AroundLog, _super);
  9469. function AroundLog() {
  9470. return _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  9471. }
  9472. AroundLog.prototype.onLoad = function () {
  9473. _super.prototype.onLoad.call(this);
  9474. this.queryLog();
  9475. };
  9476. AroundLog.prototype.queryLog = function () {
  9477. this.refs.grid1.reload();
  9478. };
  9479. AroundLog.prototype.showDialog2 = function () {
  9480. var _a, _b;
  9481. 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; });
  9482. if (!rows || rows.length <= 0)
  9483. return;
  9484. var dialog = new ApiInfoDialog$1();
  9485. dialog.showDialog(null, {}, {
  9486. data: {
  9487. form: __assign({}, rows[0])
  9488. }
  9489. });
  9490. };
  9491. return AroundLog;
  9492. }(Scope));
  9493. //# sourceMappingURL=AroundLog.js.map
  9494. var model$7 = {
  9495. data: {
  9496. form2: {
  9497. key: "",
  9498. start_at: "",
  9499. end_at: "",
  9500. }
  9501. }
  9502. };
  9503. var vjson$7 = {
  9504. title: '日志查询',
  9505. layout: 'fit',
  9506. tbar: {
  9507. xtype: 'toolbar',
  9508. items: [
  9509. {
  9510. xtype: 'button',
  9511. text: '刷新',
  9512. listeners: {
  9513. click: 'scope.queryLog'
  9514. },
  9515. },
  9516. {
  9517. xtype: 'button',
  9518. text: '周围日志',
  9519. bind: {},
  9520. listeners: {
  9521. click: 'scope.aroundLogs'
  9522. },
  9523. },
  9524. ],
  9525. },
  9526. items: [
  9527. {
  9528. region: 'center',
  9529. xtype: 'yvgrid',
  9530. layout: 'fit',
  9531. reference: 'grid1',
  9532. pagination: true,
  9533. autoLoad: false,
  9534. selModel: {
  9535. selType: 'rowmodel',
  9536. mode: 'SINGLE',
  9537. },
  9538. dataSource: {
  9539. method: 'invoke',
  9540. url: '/sys/api/Api@queryLog',
  9541. params: {
  9542. formData: '{form2}',
  9543. path: '{form.api_url}',
  9544. },
  9545. },
  9546. listeners: {
  9547. rowdblclick: 'scope.showDialog',
  9548. },
  9549. columns: [
  9550. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9551. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9552. { dataIndex: "thread", header: "thread", width: 150 },
  9553. { dataIndex: "message", header: "message", flex: 1 },
  9554. ]
  9555. }
  9556. ]
  9557. };
  9558. var LogPage = /** @class */ (function (_super) {
  9559. __extends(LogPage, _super);
  9560. function LogPage() {
  9561. return _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  9562. }
  9563. LogPage.prototype.onLoad = function () {
  9564. _super.prototype.onLoad.call(this);
  9565. this.queryLog();
  9566. };
  9567. LogPage.prototype.queryLog = function () {
  9568. this.refs.grid1.reload();
  9569. };
  9570. LogPage.prototype.showDialog = function () {
  9571. var _a, _b;
  9572. 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; });
  9573. if (!rows || rows.length <= 0)
  9574. return;
  9575. var dialog = new ApiInfoDialog$1();
  9576. dialog.showDialog(null, {}, {
  9577. data: {
  9578. form: __assign({}, rows[0])
  9579. }
  9580. });
  9581. };
  9582. LogPage.prototype.aroundLogs = function () {
  9583. var _a, _b;
  9584. 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; });
  9585. if (!rows || rows.length <= 0)
  9586. return;
  9587. var dialog = new AroundLog();
  9588. dialog.showDialog(null, {}, {
  9589. data: {
  9590. form2: __assign({}, rows[0])
  9591. }
  9592. });
  9593. };
  9594. return LogPage;
  9595. }(Scope));
  9596. //# sourceMappingURL=LogPage.js.map
  9597. var Controller$2 = /** @class */ (function () {
  9598. function Controller() {
  9599. }
  9600. Controller.prototype.queryLog = function () {
  9601. var form2 = this.getViewModel().get("form2");
  9602. var logPage = new LogPage();
  9603. logPage.showPage({}, {
  9604. data: {
  9605. form2: __assign({}, form2)
  9606. }
  9607. });
  9608. };
  9609. return Controller;
  9610. }());
  9611. var controller$2 = new Controller$2();
  9612. function initLogsTree () {
  9613. Ext.define('com.yvan.studio.LogsTree', {
  9614. extend: 'Ext.panel.Panel',
  9615. xtype: 'logstree',
  9616. controller: controller$2,
  9617. scope: controller$2,
  9618. viewModel: {
  9619. data: {
  9620. form2: {
  9621. key: "",
  9622. start_at: "",
  9623. end_at: "",
  9624. }
  9625. }
  9626. },
  9627. reference: 'logstree',
  9628. tooltip: '表单定义',
  9629. iconCls: 'x-fa fa-bar-chart',
  9630. useArrows: true,
  9631. rootVisible: false,
  9632. colspan: 2,
  9633. lines: true,
  9634. multiSelect: false,
  9635. referenceHolder: true,
  9636. items: [
  9637. {
  9638. region: 'north',
  9639. xtype: 'form',
  9640. reference: 'form2',
  9641. split: true,
  9642. items: [
  9643. {
  9644. xtype: 'textfield',
  9645. fieldLabel: '关键字',
  9646. bind: {
  9647. value: "{form2.key}"
  9648. },
  9649. },
  9650. {
  9651. xtype: 'datefield',
  9652. fieldLabel: '开始时间',
  9653. bind: {
  9654. value: "{form2.start_at}"
  9655. },
  9656. },
  9657. {
  9658. xtype: 'datefield',
  9659. fieldLabel: '结束时间',
  9660. bind: {
  9661. value: "{form2.end_at}"
  9662. },
  9663. },
  9664. ]
  9665. },
  9666. {
  9667. xtype: "cols",
  9668. items: [
  9669. {
  9670. xtype: "box",
  9671. },
  9672. {
  9673. xtype: "button",
  9674. text: '查询',
  9675. listeners: {
  9676. click: 'queryLog'
  9677. },
  9678. },
  9679. {
  9680. xtype: "box",
  9681. },
  9682. ]
  9683. },
  9684. ],
  9685. });
  9686. }
  9687. //# sourceMappingURL=LogsTree.js.map
  9688. var model$8 = {
  9689. data: {
  9690. // opsId: "",
  9691. // name: "",
  9692. running: false,
  9693. }
  9694. };
  9695. //# sourceMappingURL=DevOpsTerminal.model.js.map
  9696. var vjson$8 = {
  9697. bind: {
  9698. title: '运维-{name}',
  9699. },
  9700. layout: 'fit',
  9701. items: [
  9702. {
  9703. layout: 'border',
  9704. items: [
  9705. {
  9706. region: 'north',
  9707. items: [
  9708. {
  9709. xtype: 'toolbar',
  9710. border: false,
  9711. items: [
  9712. {
  9713. xtype: 'button',
  9714. text: '执行',
  9715. iconCls: 'x-fa fa-play',
  9716. bind: {
  9717. hidden: "{running}",
  9718. },
  9719. listeners: {
  9720. click: 'scope.start'
  9721. }
  9722. },
  9723. {
  9724. xtype: 'button',
  9725. text: '停止',
  9726. iconCls: 'x-fa fa-stop',
  9727. bind: {
  9728. hidden: "{!running}",
  9729. },
  9730. listeners: {
  9731. click: 'scope.stop'
  9732. }
  9733. },
  9734. ],
  9735. },
  9736. ]
  9737. },
  9738. {
  9739. region: 'center',
  9740. reference: 'terminal',
  9741. xtype: 'terminal',
  9742. },
  9743. ],
  9744. },
  9745. ],
  9746. };
  9747. //# sourceMappingURL=DevOpsTerminal.view.js.map
  9748. var DevOpsTerminal = /** @class */ (function (_super) {
  9749. __extends(DevOpsTerminal, _super);
  9750. function DevOpsTerminal() {
  9751. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  9752. _this.websocket = undefined;
  9753. return _this;
  9754. }
  9755. DevOpsTerminal.prototype.onLoad = function () {
  9756. this.load();
  9757. };
  9758. DevOpsTerminal.prototype.onDestroy = function () {
  9759. if (this.websocket) {
  9760. this.websocket.close();
  9761. this.websocket = undefined;
  9762. }
  9763. };
  9764. DevOpsTerminal.prototype.load = function () {
  9765. var _this = this;
  9766. var opsId = this.viewModel.get('opsId');
  9767. this.setLoading(true);
  9768. devOpsById(opsId).then(function (res) {
  9769. _this.viewModel.set('devOps', res.data);
  9770. }).finally(function () {
  9771. _this.setLoading(false);
  9772. });
  9773. };
  9774. DevOpsTerminal.prototype.start = function () {
  9775. var me = this;
  9776. var running = this.viewModel.get('running');
  9777. var devOps = this.viewModel.get('devOps');
  9778. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  9779. return;
  9780. var devopsServer = "ws://122.9.140.63:9999";
  9781. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  9782. this.websocket.addEventListener('open', function () {
  9783. me.viewModel.set('running', true);
  9784. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  9785. });
  9786. this.websocket.addEventListener('message', function (event) {
  9787. me.refs.terminal.write(event.data);
  9788. });
  9789. this.websocket.addEventListener('close', function () {
  9790. me.stop();
  9791. });
  9792. this.websocket.addEventListener('error', function () {
  9793. me.stop();
  9794. });
  9795. };
  9796. DevOpsTerminal.prototype.stop = function () {
  9797. if (this.websocket) {
  9798. this.websocket.close();
  9799. this.websocket = undefined;
  9800. }
  9801. this.viewModel.set('running', false);
  9802. };
  9803. return DevOpsTerminal;
  9804. }(Scope));
  9805. //# sourceMappingURL=DevOpsTerminal.js.map
  9806. var Controller$3 = /** @class */ (function () {
  9807. function Controller() {
  9808. }
  9809. Controller.prototype.onLoad = function (sender) {
  9810. this.reload();
  9811. };
  9812. Controller.prototype.reload = function () {
  9813. var me = this;
  9814. // @ts-ignore
  9815. var view = me.getView();
  9816. view.setLoading(true);
  9817. devOpsList().then(function (res) {
  9818. view.setStore(new Ext.data.Store({
  9819. fields: ['ops_id', 'host', 'name'],
  9820. data: res.data,
  9821. }));
  9822. }).finally(function () {
  9823. view.setLoading(false);
  9824. });
  9825. };
  9826. Controller.prototype.onDblClick = function (sender) {
  9827. this.devOpsTerminal();
  9828. };
  9829. Controller.prototype.devOpsTerminal = function () {
  9830. // @ts-ignore
  9831. var view = this.getView();
  9832. var _a = __read(view.getSelection(), 1), record = _a[0];
  9833. if (record) {
  9834. var name = record.get('name');
  9835. var opsId = record.get('ops_id');
  9836. var instance = new DevOpsTerminal();
  9837. instance.showPage({
  9838. id: 'ops_' + opsId,
  9839. path: 'ops_' + opsId,
  9840. }, {
  9841. data: {
  9842. opsId: opsId,
  9843. name: name,
  9844. }
  9845. });
  9846. instance.dialogSuccess = function () {
  9847. };
  9848. }
  9849. };
  9850. return Controller;
  9851. }());
  9852. var controller$3 = new Controller$3();
  9853. function initDevOpsTree () {
  9854. Ext.define('com.yvan.studio.DevOpsGrid', {
  9855. extend: 'Ext.grid.Panel',
  9856. xtype: 'devopsgrid',
  9857. controller: controller$3,
  9858. scope: controller$3,
  9859. referenceHolder: true,
  9860. tooltip: '运维',
  9861. iconCls: 'x-fa fa-terminal',
  9862. useArrows: true,
  9863. reference: 'devopsgrid',
  9864. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  9865. listeners: {
  9866. afterrender: 'onLoad',
  9867. itemdblclick: 'onDblClick',
  9868. },
  9869. viewConfig: {
  9870. // listeners: {
  9871. // itemcontextmenu: 'onGridContextMenu',
  9872. // },
  9873. },
  9874. tbar: {
  9875. xtype: 'toolbar',
  9876. items: [
  9877. {
  9878. xtype: 'button',
  9879. tooltip: '刷新',
  9880. iconCls: 'x-fa fa-refresh',
  9881. listeners: {
  9882. click: 'reload'
  9883. }
  9884. },
  9885. {
  9886. xtype: 'textfield',
  9887. flex: 1,
  9888. emptyText: '搜索过滤',
  9889. enableKeyEvents: true,
  9890. listeners: {
  9891. change: {
  9892. fn: 'filterChanged',
  9893. buffer: 50
  9894. }
  9895. }
  9896. },
  9897. ]
  9898. },
  9899. columns: [
  9900. {
  9901. text: 'ID', dataIndex: 'report_id',
  9902. hidden: true,
  9903. },
  9904. {
  9905. text: '服务器',
  9906. dataIndex: 'host',
  9907. width: 100,
  9908. menuDisabled: true,
  9909. },
  9910. {
  9911. text: '操作名称',
  9912. dataIndex: 'name',
  9913. flex: 1,
  9914. menuDisabled: true,
  9915. },
  9916. ]
  9917. });
  9918. }
  9919. //# sourceMappingURL=DevOpsTree.js.map
  9920. function initTerminal () {
  9921. Ext.define('com.yvan.studio.Terminal', {
  9922. extend: 'Ext.panel.Panel',
  9923. alias: 'widget.terminal',
  9924. xtype: 'terminal',
  9925. layout: 'fit',
  9926. border: false,
  9927. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  9928. config: {},
  9929. write: function (str) {
  9930. if (this.term) {
  9931. this.term.write(str);
  9932. }
  9933. },
  9934. initComponent: function () {
  9935. var that = this;
  9936. this.superclass.initComponent.call(this, arguments);
  9937. that.on({
  9938. resize: function () {
  9939. var _a;
  9940. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  9941. that.fitAddon.fit();
  9942. }
  9943. },
  9944. destory: function () {
  9945. if (that.term) {
  9946. that.term.dispose();
  9947. delete that.term;
  9948. }
  9949. if (that.fitAddon) {
  9950. that.fitAddon.dispose();
  9951. delete that.fitAddon;
  9952. }
  9953. },
  9954. afterrender: function (sender) {
  9955. _.defer(function () {
  9956. var $dom = $(that.el.dom).find('.terminal');
  9957. that.term = new xterm.Terminal({
  9958. // cursorBlink: false,
  9959. // cursorStyle: 'bar', // block underline bar
  9960. // enableBold: false,
  9961. // bellStyle: "sound",
  9962. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  9963. // scrollback: 10000,
  9964. // tabStopWidth: 4,
  9965. disableStdin: true,
  9966. theme: {
  9967. // foreground: "#111",
  9968. // background: "#fdfdfd",
  9969. // background: "#fafafa",
  9970. },
  9971. });
  9972. that.fitAddon = new xtermAddonFit.FitAddon();
  9973. that.term.loadAddon(that.fitAddon);
  9974. that.term.open($dom[0]);
  9975. that.fitAddon.fit();
  9976. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  9977. });
  9978. }
  9979. });
  9980. }
  9981. });
  9982. }
  9983. //# sourceMappingURL=Terminal.js.map
  9984. var vjson$9 = {
  9985. title: '接口统计',
  9986. layout: 'fit',
  9987. items: [
  9988. {
  9989. title: '接口统计',
  9990. xtype: 'yvgrid',
  9991. enableLocking: false,
  9992. reference: 'grid1',
  9993. pagination: false,
  9994. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  9995. tbar: {
  9996. xtype: 'form',
  9997. items: [
  9998. {
  9999. xtype: 'cols',
  10000. items: [
  10001. {
  10002. xtype: 'textfield',
  10003. fieldLabel: '搜索',
  10004. listeners: {
  10005. change: 'scope.requestFilterChange'
  10006. }
  10007. },
  10008. ]
  10009. },
  10010. ]
  10011. },
  10012. columns: [
  10013. { text: '地址', dataIndex: 'url', flex: 1 },
  10014. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  10015. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10016. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10017. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10018. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10019. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10020. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10021. ],
  10022. leadingBufferZone: 8,
  10023. trailingBufferZone: 8,
  10024. viewConfig: {
  10025. listeners: {
  10026. expandbody: 'scope.onChildExpand'
  10027. }
  10028. },
  10029. listeners: {
  10030. itemdblclick: 'scope.itemClick1'
  10031. },
  10032. plugins: {
  10033. rowwidget: {
  10034. widget: {
  10035. xtype: 'yvgrid',
  10036. hideFootbar: true,
  10037. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10038. listeners: {
  10039. itemdblclick: 'scope.itemClick1'
  10040. },
  10041. columns: [
  10042. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10043. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10044. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10045. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10046. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10047. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10048. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10049. ]
  10050. }
  10051. }
  10052. }
  10053. },
  10054. ]
  10055. };
  10056. //# sourceMappingURL=InterfaceStatistics.view.js.map
  10057. var model$9 = {
  10058. data: {
  10059. count: 0,
  10060. dataSourceName: '',
  10061. sql: "",
  10062. histogram: '',
  10063. maxCost: 0,
  10064. minCost: 0,
  10065. avgCost: '',
  10066. sumCost: 0,
  10067. histogramInfos: [
  10068. // count: 1
  10069. // gteCost: 20
  10070. // ltCost: 50
  10071. // 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"
  10072. // topN: [
  10073. // cost: 24
  10074. // occurrenceTime: "1648004895171"
  10075. // 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"
  10076. // ]
  10077. ]
  10078. }
  10079. };
  10080. //# sourceMappingURL=PerformDialog.model.js.map
  10081. var vjson$a = {
  10082. title: '性能统计详情',
  10083. height: 400,
  10084. width: 800,
  10085. modal: true,
  10086. layout: 'fit',
  10087. items: [
  10088. {
  10089. xtype: 'tabpanel',
  10090. items: [
  10091. {
  10092. title: '摘要',
  10093. key: "1",
  10094. layout: 'border',
  10095. items: [
  10096. {
  10097. region: 'north',
  10098. border: false,
  10099. defaults: {
  10100. margin: '8 0 0 0'
  10101. },
  10102. items: [
  10103. {
  10104. xtype: 'cols',
  10105. defaultType: 'displayfield',
  10106. defaults: {
  10107. labelWidth: 70,
  10108. },
  10109. items: [
  10110. {
  10111. fieldLabel: 'count',
  10112. bind: {
  10113. value: '{count}'
  10114. }
  10115. },
  10116. {
  10117. fieldLabel: 'maxCost',
  10118. bind: {
  10119. value: '{maxCost}'
  10120. }
  10121. },
  10122. {
  10123. fieldLabel: 'minCost',
  10124. bind: {
  10125. value: '{minCost}'
  10126. }
  10127. },
  10128. {
  10129. fieldLabel: 'avgCost',
  10130. bind: {
  10131. value: '{avgCost}'
  10132. }
  10133. },
  10134. {
  10135. fieldLabel: 'sumCost',
  10136. bind: {
  10137. value: '{sumCost}'
  10138. }
  10139. },
  10140. ]
  10141. },
  10142. {
  10143. xtype: 'cols',
  10144. items: [
  10145. {
  10146. flex: 5,
  10147. border: false,
  10148. items: [
  10149. {
  10150. xtype: 'segmentedbutton',
  10151. reference: 'histogram',
  10152. allowToggle: false,
  10153. border: false,
  10154. items: []
  10155. }
  10156. ]
  10157. },
  10158. ]
  10159. },
  10160. ],
  10161. },
  10162. {
  10163. region: 'center',
  10164. xtype: 'sqleditor',
  10165. reference: 'sqlEditor',
  10166. },
  10167. ]
  10168. },
  10169. {
  10170. title: '直方图',
  10171. key: "2",
  10172. }
  10173. ]
  10174. }
  10175. ]
  10176. };
  10177. //# sourceMappingURL=PerformDialog.view.js.map
  10178. var PerformDialog = /** @class */ (function (_super) {
  10179. __extends(PerformDialog, _super);
  10180. function PerformDialog() {
  10181. return _super.call(this, { model: model$9, vjson: vjson$a }) || this;
  10182. }
  10183. PerformDialog.prototype.onLoad = function () {
  10184. var _this = this;
  10185. var sql = this.viewModel.get('sql');
  10186. var sql2 = sqlFormat.format(sql, {
  10187. indent: ' ',
  10188. uppercase: true,
  10189. });
  10190. var histogramInfos = this.viewModel.get('histogramInfos');
  10191. var vs = _$2.map(histogramInfos, function (v) {
  10192. if (v.ltCost > 2100000000) {
  10193. return {
  10194. text: "[" + v.gteCost + ", \u221E):" + v.count
  10195. };
  10196. }
  10197. return {
  10198. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  10199. };
  10200. });
  10201. this.refs.sqlEditor.setCode(sql2);
  10202. _$2.forEach(vs, function (v) {
  10203. _this.refs.histogram.add(v);
  10204. });
  10205. };
  10206. return PerformDialog;
  10207. }(Scope));
  10208. //# sourceMappingURL=PerformDialog.js.map
  10209. var model$a = {
  10210. data: {}
  10211. };
  10212. var PerformStats = /** @class */ (function (_super) {
  10213. __extends(PerformStats, _super);
  10214. function PerformStats() {
  10215. var _this = _super.call(this, { model: model$a, vjson: vjson$9 }) || this;
  10216. _this.requestFilterChange = _.debounce(function (sender, value) {
  10217. var store = _this.refs.grid1.store;
  10218. store.clearFilter();
  10219. if (value) {
  10220. store.filterBy(function (record, id) {
  10221. var text = toString(record.get('url'));
  10222. // 用拼音筛选的方式
  10223. return text.includes(value);
  10224. });
  10225. }
  10226. }, 100);
  10227. return _this;
  10228. }
  10229. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10230. widget.setData(record.data.children);
  10231. };
  10232. PerformStats.prototype.itemClick1 = function (sender, record) {
  10233. console.log('itemClick1', record.data);
  10234. new PerformDialog().showDialog(sender, {}, {
  10235. data: record.data
  10236. });
  10237. };
  10238. PerformStats.prototype.onLoad = function () {
  10239. var _this = this;
  10240. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10241. .then(function (_a) {
  10242. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10243. var resData = reqRes.data;
  10244. var jdbcData = jdbcRes.data;
  10245. _.forEach(jdbcData, function (item) {
  10246. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10247. });
  10248. _.forEach(resData, function (item) {
  10249. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10250. if (_.isArray(item.sqls)) {
  10251. item.children = _.map(item.sqls, function (sql) {
  10252. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10253. }).filter(function (v) { return !!v; });
  10254. }
  10255. item.jdbcCount = _.size(item.children);
  10256. });
  10257. _this.refs.grid1.setData(resData);
  10258. // this.refs.grid2.setData(jdbcData)
  10259. });
  10260. };
  10261. return PerformStats;
  10262. }(Scope));
  10263. //# sourceMappingURL=InterfaceStatistics.js.map
  10264. var vjson$b = {
  10265. title: '性能统计',
  10266. layout: 'fit',
  10267. items: [
  10268. {
  10269. title: '数据库统计',
  10270. xtype: 'yvgrid',
  10271. enableLocking: false,
  10272. reference: 'grid2',
  10273. pagination: false,
  10274. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10275. tbar: {
  10276. xtype: 'form',
  10277. items: [
  10278. {
  10279. xtype: 'cols',
  10280. items: [
  10281. {
  10282. fieldLabel: '搜索',
  10283. listeners: {
  10284. change: 'scope.jdbcFilterChange'
  10285. }
  10286. },
  10287. ]
  10288. },
  10289. ]
  10290. },
  10291. listeners: {
  10292. itemdblclick: 'scope.itemClick1'
  10293. },
  10294. columns: [
  10295. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10296. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10297. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10298. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10299. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10300. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10301. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10302. ]
  10303. },
  10304. ]
  10305. };
  10306. //# sourceMappingURL=DatabaseStatistics.view.js.map
  10307. var model$b = {
  10308. data: {}
  10309. };
  10310. var PerformStats$1 = /** @class */ (function (_super) {
  10311. __extends(PerformStats, _super);
  10312. function PerformStats() {
  10313. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  10314. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  10315. var store = _this.refs.grid2.store;
  10316. store.clearFilter();
  10317. if (value) {
  10318. store.filterBy(function (record, id) {
  10319. var text = toString(record.get('sql'));
  10320. // 用拼音筛选的方式
  10321. return text.includes(value);
  10322. });
  10323. }
  10324. }, 100);
  10325. return _this;
  10326. }
  10327. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10328. widget.setData(record.data.children);
  10329. };
  10330. PerformStats.prototype.itemClick1 = function (sender, record) {
  10331. console.log('itemClick1', record.data);
  10332. new PerformDialog().showDialog(sender, {}, {
  10333. data: record.data
  10334. });
  10335. };
  10336. PerformStats.prototype.onLoad = function () {
  10337. var _this = this;
  10338. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10339. .then(function (_a) {
  10340. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10341. var resData = reqRes.data;
  10342. var jdbcData = jdbcRes.data;
  10343. _.forEach(jdbcData, function (item) {
  10344. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10345. });
  10346. _.forEach(resData, function (item) {
  10347. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10348. if (_.isArray(item.sqls)) {
  10349. item.children = _.map(item.sqls, function (sql) {
  10350. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10351. }).filter(function (v) { return !!v; });
  10352. }
  10353. item.jdbcCount = _.size(item.children);
  10354. });
  10355. _this.refs.grid2.setData(jdbcData);
  10356. });
  10357. };
  10358. return PerformStats;
  10359. }(Scope));
  10360. //# sourceMappingURL=DatabaseStatistics.js.map
  10361. var Controller$4 = /** @class */ (function () {
  10362. function Controller() {
  10363. }
  10364. Controller.prototype.onDblClick = function (sender, record) {
  10365. var data = record.raw;
  10366. if (data.text === "接口统计") {
  10367. var page = new PerformStats();
  10368. page.showPage({
  10369. title: "接口统计",
  10370. id: '_InterfaceStatistics',
  10371. path: '_InterfaceStatistics',
  10372. }, {});
  10373. }
  10374. else if (data.text === "数据库统计") {
  10375. var page = new PerformStats$1();
  10376. page.showPage({
  10377. title: "数据库统计",
  10378. id: '_DatabaseStatistics',
  10379. path: '_DatabaseStatistics',
  10380. }, {});
  10381. }
  10382. };
  10383. Controller.prototype.onLoad = function () {
  10384. var me = this;
  10385. //@ts-ignore
  10386. var view = me.getView();
  10387. view.setRootNode({
  10388. expanded: true,
  10389. leaf: false,
  10390. children: [
  10391. { leaf: true, text: '接口统计' },
  10392. { leaf: true, text: '数据库统计' },
  10393. ]
  10394. });
  10395. };
  10396. return Controller;
  10397. }());
  10398. var controller$4 = new Controller$4();
  10399. function initMonitorTree () {
  10400. Ext.define('com.yvan.studio.MonitorTree', {
  10401. extend: 'Ext.tree.Panel',
  10402. xtype: 'monitortree',
  10403. controller: controller$4,
  10404. scope: controller$4,
  10405. reference: 'roleGrid',
  10406. tooltip: '表单定义',
  10407. iconCls: 'x-fa fa-bar-chart',
  10408. useArrows: true,
  10409. rootVisible: false,
  10410. colspan: 2,
  10411. lines: true,
  10412. multiSelect: false,
  10413. referenceHolder: true,
  10414. // openNode() {
  10415. // const selection = this.getSelection()
  10416. // const [record] = selection
  10417. // if (!record) {
  10418. // return
  10419. // }
  10420. //
  10421. // const {raw} = record;
  10422. // if (raw.type === 'Dir') {
  10423. // return
  10424. // }
  10425. // if (raw.type === "Module" && raw.module) {
  10426. // // eventBus.publish(EventType.ModuleOpen, raw)
  10427. // }
  10428. // },
  10429. listeners: {
  10430. itemdblclick: 'onDblClick',
  10431. afterrender: "onLoad",
  10432. },
  10433. });
  10434. }
  10435. //# sourceMappingURL=MonitorTree.js.map
  10436. var Controller$5 = /** @class */ (function () {
  10437. function Controller() {
  10438. }
  10439. return Controller;
  10440. }());
  10441. var controller$5 = new Controller$5();
  10442. function initHomeTree () {
  10443. Ext.define('com.yvan.studio.HomeTree', {
  10444. extend: 'Ext.Panel',
  10445. xtype: 'hometree',
  10446. controller: controller$5,
  10447. scope: controller$5,
  10448. referenceHolder: true,
  10449. bodyCls: 'home',
  10450. // layout: 'fit',
  10451. tbar: {
  10452. xtype: 'toolbar',
  10453. items: [
  10454. {
  10455. xtype: 'button',
  10456. iconCls: 'x-fa fa-exchange',
  10457. text: '数据结构同步',
  10458. handler: function (sender) {
  10459. handles$1.mainWindow.showDataSync(sender);
  10460. }
  10461. },
  10462. {
  10463. xtype: 'button',
  10464. iconCls: 'x-fa fa-cubes',
  10465. text: '数据域管理',
  10466. handler: function (sender) {
  10467. handles$1.mainWindow.showColumnDomain();
  10468. }
  10469. },
  10470. ],
  10471. },
  10472. // items: [
  10473. //
  10474. // ],
  10475. layout: {
  10476. type: 'vbox',
  10477. pack: 'start',
  10478. align: 'stretch',
  10479. },
  10480. items: [
  10481. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  10482. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  10483. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  10484. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  10485. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  10486. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  10487. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  10488. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  10489. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  10490. ],
  10491. });
  10492. }
  10493. //# sourceMappingURL=HomeTree.js.map
  10494. var WidgetStore = /** @class */ (function (_super) {
  10495. __extends(WidgetStore, _super);
  10496. function WidgetStore() {
  10497. return _super !== null && _super.apply(this, arguments) || this;
  10498. }
  10499. WidgetStore.prototype.getCacheKey = function (param) {
  10500. return "widget_data.json";
  10501. };
  10502. /*invokeApi(param: any): Promise<any> {
  10503. return new Promise<any>(resolve => {
  10504. //@ts-ignore
  10505. require(["../../widget/all"], function (res) {
  10506. const widgetList = res.default
  10507. resolve(widgetList)
  10508. })
  10509. })
  10510. }*/
  10511. WidgetStore.prototype.invokeApi = function (param) {
  10512. return widgetListApi(param);
  10513. };
  10514. return WidgetStore;
  10515. }(CacheStore));
  10516. var instance$2 = new WidgetStore();
  10517. //# sourceMappingURL=WidgetStore.js.map
  10518. var WidgetGridController = /** @class */ (function () {
  10519. function WidgetGridController() {
  10520. }
  10521. WidgetGridController.prototype.onLoad = function (sender) {
  10522. var me = this;
  10523. setWidget(me);
  10524. instance$2.registe(me.reloadData.bind(this));
  10525. instance$2.reloadIfNeed(undefined);
  10526. };
  10527. WidgetGridController.prototype.widgetAdd = function (sender) {
  10528. var me = this;
  10529. var win = new Ext.Window({
  10530. autoDestroy: true,
  10531. title: "新建弹框",
  10532. width: 400,
  10533. height: 220,
  10534. resizable: true,
  10535. closable: true,
  10536. maximizable: true,
  10537. minimizable: true,
  10538. plain: true,
  10539. // constrainHeader: true,
  10540. constrain: true,
  10541. layout: 'fit',
  10542. animateTarget: sender,
  10543. buttonAlign: 'center',
  10544. items: [
  10545. {
  10546. xtype: "form",
  10547. layout: "hbox",
  10548. margin: '10px 20px',
  10549. border: 0,
  10550. items: [
  10551. {
  10552. flex: 1,
  10553. layout: 'vbox',
  10554. items: [
  10555. {
  10556. xtype: "textfield",
  10557. name: "widgetcode",
  10558. fieldLabel: "弹窗文件",
  10559. flex: 1,
  10560. allowBlank: false,
  10561. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  10562. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  10563. labelWidth: 80,
  10564. width: "100%",
  10565. },
  10566. {
  10567. xtype: "textfield",
  10568. name: "widgetname",
  10569. fieldLabel: "弹窗名称",
  10570. flex: 1,
  10571. allowBlank: false,
  10572. labelWidth: 80,
  10573. width: "100%",
  10574. },
  10575. ]
  10576. },
  10577. ]
  10578. }
  10579. ],
  10580. //窗口按钮
  10581. buttons: [
  10582. {
  10583. xtype: 'button', text: '保存', handler: function (btn) {
  10584. //窗口获取表单
  10585. var form = win.down('form');
  10586. var vaildSuccess = form.isValid();
  10587. if (!vaildSuccess) {
  10588. return;
  10589. }
  10590. var title = form.down('textfield[name="widgetname"]').getValue();
  10591. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  10592. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  10593. if (res.success) {
  10594. msg$1('添加成功');
  10595. // 添加
  10596. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  10597. me.reload();
  10598. });
  10599. win.close();
  10600. }
  10601. });
  10602. }
  10603. },
  10604. {
  10605. xtype: 'button', text: '取消', handler: function (btn) {
  10606. //窗口关闭
  10607. win.close();
  10608. }
  10609. }
  10610. ]
  10611. });
  10612. win.show();
  10613. };
  10614. WidgetGridController.prototype.widgetRemove = function (sender) {
  10615. var _this = this;
  10616. //@ts-ignore
  10617. var record = this.getView().selection.data;
  10618. if (!record) {
  10619. msg$1('请选择一行');
  10620. return;
  10621. }
  10622. var widgetPath = record.widget_path;
  10623. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  10624. if (btn === 'yes') {
  10625. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  10626. if (res.success) {
  10627. msg$1(res.msg);
  10628. _this.reload();
  10629. }
  10630. });
  10631. }
  10632. });
  10633. };
  10634. WidgetGridController.prototype.widgetEdit = function (record) {
  10635. var _this = this;
  10636. if (record) {
  10637. var widgetPath = record.widget_path;
  10638. var widgetName = record.widget_name;
  10639. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  10640. _this.reload();
  10641. });
  10642. }
  10643. };
  10644. WidgetGridController.prototype.onDestory = function (sender) {
  10645. var me = this;
  10646. setWidget(undefined);
  10647. instance$2.unregiste(me.reloadData.bind(this));
  10648. };
  10649. WidgetGridController.prototype.reloadData = function (res) {
  10650. var me = this;
  10651. //@ts-ignore
  10652. var view = me.getView();
  10653. if (typeof res === 'object') {
  10654. // const data = []
  10655. // _.forOwn(res, (v, k) => {
  10656. // data.push({
  10657. // widget_path: k,
  10658. // widget_name: v.title,
  10659. // vjson : v
  10660. // })
  10661. // })
  10662. view.setStore(new Ext.data.Store({
  10663. fields: ['widget_path', 'widget_name'],
  10664. data: res.data,
  10665. }));
  10666. }
  10667. else if (typeof res === 'boolean') {
  10668. view.setLoading(res);
  10669. }
  10670. };
  10671. WidgetGridController.prototype.reload = function () {
  10672. instance$2.reloadForce(undefined);
  10673. };
  10674. WidgetGridController.prototype.filterChanged = function (sender, value) {
  10675. //@ts-ignore
  10676. this.view.store.clearFilter();
  10677. if (value) {
  10678. //@ts-ignore
  10679. this.view.store.filterBy(function (record) {
  10680. var widget_path = record.get('widget_path');
  10681. var widget_name = record.get('widget_name');
  10682. return (window['system'].pinyinMatch(widget_name, value) ||
  10683. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10684. });
  10685. }
  10686. };
  10687. WidgetGridController.prototype.onClearClick = function () {
  10688. var _a, _b;
  10689. //@ts-ignore
  10690. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10691. };
  10692. WidgetGridController.prototype.onDblClick = function (sender, record) {
  10693. this.widgetEdit(record.data);
  10694. };
  10695. return WidgetGridController;
  10696. }());
  10697. //# sourceMappingURL=WidgetGridController.js.map
  10698. function initWidget () {
  10699. var controller = new WidgetGridController();
  10700. Ext.define('com.yvan.studio.WidgetGrid', {
  10701. extend: 'Ext.grid.Panel',
  10702. xtype: 'widgetgrid',
  10703. controller: controller,
  10704. scope: controller,
  10705. referenceHolder: true,
  10706. tooltip: '检索窗口',
  10707. iconCls: 'x-fa fa-search',
  10708. useArrows: true,
  10709. reference: 'widgetgrid',
  10710. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10711. listeners: {
  10712. itemdblclick: 'onDblClick',
  10713. afterrender: 'onLoad',
  10714. destory: 'onDestory',
  10715. },
  10716. viewConfig: {
  10717. listeners: {
  10718. itemcontextmenu: 'onGridContextMenu',
  10719. },
  10720. },
  10721. tbar: [
  10722. {
  10723. xtype: 'button',
  10724. tooltip: '刷新',
  10725. iconCls: 'x-fa fa-refresh',
  10726. listeners: {
  10727. click: 'reload'
  10728. }
  10729. },
  10730. {
  10731. xtype: 'button',
  10732. tooltip: '添加',
  10733. iconCls: 'x-fa fa-plus-circle',
  10734. listeners: {
  10735. click: 'widgetAdd'
  10736. }
  10737. },
  10738. {
  10739. xtype: 'button',
  10740. tooltip: '删除',
  10741. iconCls: 'x-fa fa-minus-circle',
  10742. listeners: {
  10743. click: 'widgetRemove'
  10744. }
  10745. },
  10746. ],
  10747. fbar: [
  10748. {
  10749. xtype: 'textfield',
  10750. flex: 1,
  10751. reference: "txtFilter",
  10752. emptyText: '搜索过滤',
  10753. enableKeyEvents: true,
  10754. listeners: {
  10755. change: {
  10756. fn: 'filterChanged',
  10757. buffer: 50
  10758. }
  10759. }
  10760. },
  10761. ],
  10762. columns: [
  10763. {
  10764. text: '弹窗文件', dataIndex: 'widget_path',
  10765. menuDisabled: true, flex: 1,
  10766. },
  10767. {
  10768. text: '弹窗名称', dataIndex: 'widget_name',
  10769. menuDisabled: true, flex: 1,
  10770. },
  10771. ]
  10772. });
  10773. }
  10774. //# sourceMappingURL=WidgetGrid.js.map
  10775. var WhLayoutController = /** @class */ (function () {
  10776. function WhLayoutController() {
  10777. }
  10778. WhLayoutController.prototype.onLoad = function (sender) {
  10779. var _this = this;
  10780. var me = this;
  10781. setWhLayout(me);
  10782. _$2.defer(function () {
  10783. _this.reload();
  10784. });
  10785. };
  10786. WhLayoutController.prototype.reload = function () {
  10787. //@ts-ignore
  10788. var view = this.getView();
  10789. view.setLoading(true);
  10790. loadWhLayoutAll().then(function (res) {
  10791. view.setStore(new Ext.data.Store({
  10792. fields: ['layout_code', 'layout_name'],
  10793. data: res.data,
  10794. }));
  10795. }).finally(function () {
  10796. view.setLoading(false);
  10797. });
  10798. };
  10799. WhLayoutController.prototype.add = function () {
  10800. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  10801. };
  10802. WhLayoutController.prototype.edit = function (data) {
  10803. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  10804. };
  10805. WhLayoutController.prototype.remove = function () {
  10806. var _this = this;
  10807. var _a;
  10808. //@ts-ignore
  10809. var view = this.getView();
  10810. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  10811. if (!record) {
  10812. msg$1('请选择一行数据');
  10813. return;
  10814. }
  10815. var layoutCode = record.layout_code;
  10816. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  10817. if (btn === 'yes') {
  10818. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  10819. if (res.success) {
  10820. msg$1(res.msg);
  10821. _this.reload();
  10822. }
  10823. });
  10824. }
  10825. });
  10826. };
  10827. WhLayoutController.prototype.onDblClick = function () {
  10828. var _a;
  10829. //@ts-ignore
  10830. var view = this.getView();
  10831. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  10832. if (!record) {
  10833. msg$1('请选择一行数据');
  10834. return;
  10835. }
  10836. this.edit(record);
  10837. };
  10838. WhLayoutController.prototype.filterChanged = function (sender, value) {
  10839. //@ts-ignore
  10840. this.view.store.clearFilter();
  10841. if (value) {
  10842. //@ts-ignore
  10843. this.view.store.filterBy(function (record) {
  10844. var widget_path = record.get('widget_path');
  10845. var widget_name = record.get('widget_name');
  10846. return (window['system'].pinyinMatch(widget_name, value) ||
  10847. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10848. });
  10849. }
  10850. };
  10851. WhLayoutController.prototype.onClearClick = function () {
  10852. var _a, _b;
  10853. //@ts-ignore
  10854. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10855. };
  10856. return WhLayoutController;
  10857. }());
  10858. //# sourceMappingURL=WhLayoutController.js.map
  10859. function initWhLayout () {
  10860. var controller = new WhLayoutController();
  10861. Ext.define('com.yvan.studio.WhLayout', {
  10862. extend: 'Ext.grid.Panel',
  10863. xtype: 'whlayout',
  10864. alias: 'widget.whlayout',
  10865. controller: controller,
  10866. scope: controller,
  10867. referenceHolder: true,
  10868. tooltip: '检索窗口',
  10869. iconCls: 'x-fa fa-search',
  10870. useArrows: true,
  10871. reference: 'whlayout',
  10872. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10873. listeners: {
  10874. itemdblclick: 'onDblClick',
  10875. afterrender: 'onLoad',
  10876. destory: 'onDestory',
  10877. },
  10878. viewConfig: {
  10879. listeners: {
  10880. itemcontextmenu: 'onGridContextMenu',
  10881. },
  10882. },
  10883. tbar: [
  10884. {
  10885. xtype: 'button',
  10886. tooltip: '刷新',
  10887. iconCls: 'x-fa fa-refresh',
  10888. listeners: {
  10889. click: 'reload'
  10890. }
  10891. },
  10892. {
  10893. xtype: 'button',
  10894. tooltip: '添加',
  10895. iconCls: 'x-fa fa-plus-circle',
  10896. listeners: {
  10897. click: 'add'
  10898. }
  10899. },
  10900. {
  10901. xtype: 'button',
  10902. tooltip: '删除',
  10903. iconCls: 'x-fa fa-minus-circle',
  10904. listeners: {
  10905. click: 'remove'
  10906. }
  10907. },
  10908. ],
  10909. fbar: [
  10910. {
  10911. xtype: 'textfield',
  10912. flex: 1,
  10913. reference: "txtFilter",
  10914. emptyText: '搜索过滤',
  10915. enableKeyEvents: true,
  10916. listeners: {
  10917. change: {
  10918. fn: 'filterChanged',
  10919. buffer: 50
  10920. }
  10921. }
  10922. },
  10923. ],
  10924. columns: [
  10925. {
  10926. text: '图编号', dataIndex: 'layout_code',
  10927. menuDisabled: true, flex: 1,
  10928. },
  10929. {
  10930. text: '图名称', dataIndex: 'layout_name',
  10931. menuDisabled: true, flex: 1,
  10932. },
  10933. ]
  10934. });
  10935. }
  10936. //# sourceMappingURL=WhLayout.js.map
  10937. var BpmnTreeController = /** @class */ (function () {
  10938. function BpmnTreeController() {
  10939. }
  10940. BpmnTreeController.prototype.onLoad = function (sender) {
  10941. this.reload();
  10942. };
  10943. BpmnTreeController.prototype.reload = function () {
  10944. var me = this;
  10945. me.getView().setLoading(true);
  10946. exporerList().then(function (res) {
  10947. // handles.mainWindow.modules = res.data
  10948. // const rootNode = modulesToTreeData(res.data)
  10949. var rootNode = res.data.tree;
  10950. me.getView().setRootNode({
  10951. expanded: true,
  10952. leaf: false,
  10953. children: rootNode
  10954. });
  10955. // const lastId = window.location.hash.substring(1);
  10956. // file.selectPath(lastId)
  10957. // if (lastId) {
  10958. // const node = getModuleById(rootNode, lastId)
  10959. // if (node) {
  10960. // showDesign(node.id, node.path, node.text, node.module)
  10961. // }
  10962. // }
  10963. // this.restoreState()
  10964. }).finally(function () {
  10965. me.getView().setLoading(false);
  10966. });
  10967. };
  10968. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  10969. var _this = this;
  10970. e.preventDefault();
  10971. var raw = node.raw;
  10972. //const me = sender.up("treepanel").scope
  10973. var option;
  10974. if (raw.exporerType === 1) ;
  10975. else if (raw.exporerType === 21) {
  10976. if (raw.type === 'Dir') {
  10977. option = {
  10978. shadow: 'frame', allowOtherMenus: true,
  10979. items: [
  10980. {
  10981. text: '添加',
  10982. iconCls: 'x-fa fa-plus-circle',
  10983. handler: function (sender) {
  10984. var dirPath = raw.dirPath;
  10985. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  10986. }
  10987. },
  10988. '-',
  10989. {
  10990. text: '新建文件夹',
  10991. iconCls: 'x-fa fa-folder-o',
  10992. handler: function (sender) {
  10993. }
  10994. }
  10995. ]
  10996. };
  10997. }
  10998. else if (raw.type === 'Model') {
  10999. option = {
  11000. shadow: 'frame', allowOtherMenus: true,
  11001. items: [
  11002. {
  11003. text: '编辑',
  11004. iconCls: 'x-fa fa-edit',
  11005. handler: function (sender) {
  11006. }
  11007. },
  11008. {
  11009. text: '删除',
  11010. iconCls: 'x-fa fa-minus-circle',
  11011. handler: function (sender) {
  11012. }
  11013. },
  11014. '-',
  11015. {
  11016. text: '注册(至菜单)',
  11017. iconCls: 'x-fa fa-sign-in',
  11018. handler: function (sender) {
  11019. }
  11020. },
  11021. {
  11022. text: '新建文件夹',
  11023. iconCls: 'x-fa fa-folder-o',
  11024. handler: function (sender) {
  11025. }
  11026. }
  11027. ]
  11028. };
  11029. }
  11030. }
  11031. else if (raw.exporerType === 22) {
  11032. if (raw.type === 'Dir') {
  11033. option = {
  11034. shadow: 'frame', allowOtherMenus: true,
  11035. items: [
  11036. {
  11037. text: '添加',
  11038. iconCls: 'x-fa fa-plus-circle',
  11039. handler: function (sender) {
  11040. var dirPath = raw.dirPath;
  11041. handles$1.mainWindow.showFormBill();
  11042. }
  11043. },
  11044. '-',
  11045. {
  11046. text: '新建文件夹',
  11047. iconCls: 'x-fa fa-folder-o',
  11048. handler: function (sender) {
  11049. }
  11050. }
  11051. ]
  11052. };
  11053. }
  11054. else if (raw.type === 'Model') {
  11055. option = {
  11056. shadow: 'frame', allowOtherMenus: true,
  11057. items: [
  11058. {
  11059. text: '编辑',
  11060. iconCls: 'x-fa fa-edit',
  11061. handler: function (sender) {
  11062. }
  11063. },
  11064. {
  11065. text: '删除',
  11066. iconCls: 'x-fa fa-minus-circle',
  11067. handler: function (sender) {
  11068. }
  11069. },
  11070. '-',
  11071. {
  11072. text: '注册(至菜单)',
  11073. iconCls: 'x-fa fa-sign-in',
  11074. handler: function (sender) {
  11075. }
  11076. },
  11077. {
  11078. text: '新建文件夹',
  11079. iconCls: 'x-fa fa-folder-o',
  11080. handler: function (sender) {
  11081. }
  11082. }
  11083. ]
  11084. };
  11085. }
  11086. }
  11087. else if (raw.exporerType === 3) ;
  11088. else if (raw.exporerType === 50) {
  11089. option = {
  11090. shadow: 'frame', allowOtherMenus: true,
  11091. items: [
  11092. {
  11093. text: '新建流程',
  11094. iconCls: 'x-fa fa-new',
  11095. handler: function (sender) {
  11096. _this.bpmnAdd(sender);
  11097. }
  11098. },
  11099. ]
  11100. };
  11101. }
  11102. else if (raw.exporerType === 51) {
  11103. option = {
  11104. shadow: 'frame', allowOtherMenus: true,
  11105. items: [
  11106. {
  11107. text: '新建流程',
  11108. iconCls: 'x-fa fa-new',
  11109. handler: function (sender) {
  11110. _this.bpmnAdd(sender);
  11111. }
  11112. },
  11113. {
  11114. text: '删除',
  11115. iconCls: 'x-fa fa-minus-circle',
  11116. handler: function (sender) {
  11117. _this.bpmnDelete(sender, raw);
  11118. }
  11119. },
  11120. ]
  11121. };
  11122. }
  11123. else {
  11124. throw Error('暂时不支持!');
  11125. }
  11126. if (option) {
  11127. var treeMenu = new Ext.menu.Menu(option);
  11128. treeMenu.showAt(e.getXY());
  11129. }
  11130. };
  11131. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  11132. var _this = this;
  11133. prompt$2('输入工作流名称').then(function (name) {
  11134. createBpmn("", name).then(function (res) {
  11135. if (res.success) {
  11136. msg$1('添加成功');
  11137. }
  11138. _this.reload();
  11139. });
  11140. });
  11141. };
  11142. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  11143. var _this = this;
  11144. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  11145. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  11146. if (res.success) {
  11147. msg$1('添加成功');
  11148. }
  11149. _this.reload();
  11150. });
  11151. });
  11152. };
  11153. BpmnTreeController.prototype.reportAdd = function (sender) {
  11154. var _this = this;
  11155. prompt$2('请输入报表名称').then(function (name) {
  11156. createReportApi(name).then(function (res) {
  11157. if (res.success) {
  11158. msg$1('添加成功');
  11159. handles$1.mainWindow.showReport(res.data, name, function () {
  11160. _this.reload();
  11161. });
  11162. }
  11163. _this.reload();
  11164. });
  11165. });
  11166. };
  11167. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  11168. if (record) {
  11169. var reportName = record.get('report_name');
  11170. var reportId = record.get('report_id');
  11171. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  11172. }
  11173. };
  11174. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  11175. var _this = this;
  11176. if (record) {
  11177. var reportName = record.get('report_name');
  11178. var reportId_1 = record.get('report_id');
  11179. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  11180. delReportApi(reportId_1).then(function (res) {
  11181. if (res.success) {
  11182. msg$1('删除成功');
  11183. _this.reload();
  11184. }
  11185. });
  11186. });
  11187. }
  11188. };
  11189. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  11190. var _this = this;
  11191. if (!record || record.type !== 'Module') {
  11192. return;
  11193. }
  11194. var reportName = record.text;
  11195. var reportId = record.target;
  11196. handles$1.mainWindow.showReport(reportId, reportName, function () {
  11197. _this.reload();
  11198. });
  11199. };
  11200. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  11201. var data = record.raw;
  11202. if (data.type !== 'Module' && data.type !== 'Dir') {
  11203. return;
  11204. }
  11205. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  11206. if (data.exporerType === 10) { // 表单
  11207. // this.reportEdit(sender, data)
  11208. handles$1.mainWindow.showReport();
  11209. }
  11210. else if (data.exporerType === 21) {
  11211. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  11212. }
  11213. else if (data.exporerType === 22) {
  11214. handles$1.mainWindow.showFormBill();
  11215. }
  11216. else if (data.exporerType === 30) {
  11217. handles$1.mainWindow.showWidgetDesign();
  11218. }
  11219. else if (data.exporerType === 51) {
  11220. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  11221. }
  11222. else {
  11223. throw Error('暂时不支持!');
  11224. }
  11225. };
  11226. return BpmnTreeController;
  11227. }());
  11228. var controller$6 = new BpmnTreeController();
  11229. function initBpmnTree () {
  11230. Ext.define('com.yvan.studio.BpmnTree', {
  11231. extend: 'Ext.tree.Panel',
  11232. //extend: 'com.yvan.studio.StateTree',
  11233. xtype: 'bpmntree',
  11234. controller: controller$6,
  11235. scope: controller$6,
  11236. tooltip: '表单定义',
  11237. iconCls: 'x-fa fa-random',
  11238. useArrows: true,
  11239. rootVisible: false,
  11240. colspan: 2,
  11241. lines: true,
  11242. multiSelect: true,
  11243. reload: function () {
  11244. this.controller.reload.call(this, arguments);
  11245. },
  11246. openNode: function () {
  11247. var selection = this.getSelection();
  11248. var _a = __read(selection, 1), record = _a[0];
  11249. if (!record) {
  11250. return;
  11251. }
  11252. var raw = record.raw;
  11253. if (raw.type === 'Dir') {
  11254. return;
  11255. }
  11256. if (raw.type === "Module" && raw.module) ;
  11257. },
  11258. listeners: {
  11259. itemdblclick: 'onDblClick',
  11260. afterrender: 'onLoad',
  11261. // itemverify() {
  11262. // this.openNode()
  11263. // },
  11264. itemcontextmenu: 'onLisenContextMenu'
  11265. },
  11266. tbar: {
  11267. xtype: 'toolbar',
  11268. items: [
  11269. {
  11270. xtype: 'button',
  11271. tooltip: '刷新',
  11272. iconCls: 'x-fa fa-refresh',
  11273. listeners: {
  11274. click: 'reload'
  11275. }
  11276. },
  11277. /*{
  11278. xtype: 'button',
  11279. tooltip: '添加',
  11280. iconCls: 'x-fa fa-plus-circle',
  11281. menu: [
  11282. {
  11283. text: '类别',
  11284. listeners: {
  11285. click: 'classAdd'
  11286. }
  11287. },
  11288. {
  11289. text: '查询',
  11290. listeners: {
  11291. click: 'reportAdd'
  11292. }
  11293. },
  11294. '-',
  11295. {
  11296. text: '单表定义',
  11297. listeners: {
  11298. click: 'singleTableAdd'
  11299. }
  11300. },
  11301. {
  11302. text: '多表定义',
  11303. listeners: {
  11304. click: 'complexTableAdd'
  11305. }
  11306. },
  11307. {
  11308. text: '查询窗口定义',
  11309. listeners: {
  11310. click: 'widgetAdd'
  11311. }
  11312. },
  11313. ],
  11314. },
  11315. {
  11316. xtype: 'button',
  11317. tooltip: '删除',
  11318. iconCls: 'x-fa fa-minus-circle',
  11319. listeners: {
  11320. click: 'reportRemove'
  11321. }
  11322. },*/
  11323. {
  11324. xtype: 'textfield',
  11325. flex: 1,
  11326. reference: "txtFilter",
  11327. emptyText: '搜索过滤',
  11328. enableKeyEvents: true,
  11329. listeners: {
  11330. change: {
  11331. fn: 'filterChanged',
  11332. buffer: 50
  11333. }
  11334. }
  11335. },
  11336. ]
  11337. },
  11338. });
  11339. }
  11340. //# sourceMappingURL=BpmnTree.js.map
  11341. // export const idPrefix = "_ds_"
  11342. var _designInstance;
  11343. function setDesignInstance(instance) {
  11344. _designInstance = instance;
  11345. }
  11346. function getDesignInstance() {
  11347. return _designInstance;
  11348. }
  11349. function delegateDragmove(node, source, info) {
  11350. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  11351. //@ts-ignore
  11352. _designInstance.dragmove(node, source, info);
  11353. }
  11354. }
  11355. function delegateDragend(node, source, info) {
  11356. if (_designInstance && typeof _designInstance.dragend === 'function') {
  11357. //@ts-ignore
  11358. _designInstance.dragend(node, source, info);
  11359. }
  11360. }
  11361. //# sourceMappingURL=DropHelper.js.map
  11362. function initToolBox () {
  11363. Ext.define('com.yvan.studio.ToolBox', {
  11364. extend: 'Ext.panel.Panel',
  11365. xtype: 'toolbox',
  11366. tooltip: '工具箱',
  11367. layout: 'fit',
  11368. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  11369. border: false,
  11370. beforeRender: function () {
  11371. console.log('beforeRender', this);
  11372. },
  11373. afterRender: function () {
  11374. var $dom = $(this.body.dom).children('div');
  11375. $dom.append(createComponent());
  11376. $dom.css("height", '100%');
  11377. // @ts-ignore
  11378. $('#_toolbox_list').find('li').each(function () {
  11379. var id = $(this).children(':first').attr('drag_id');
  11380. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  11381. setDrag(this, node);
  11382. });
  11383. }
  11384. });
  11385. }
  11386. function setDrag(el, node) {
  11387. new Ext.drag.Source({
  11388. element: el,
  11389. proxy: {
  11390. type: 'placeholder',
  11391. getElement: function (info) {
  11392. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  11393. return Ext.getBody().createChild({
  11394. html: html
  11395. });
  11396. }
  11397. },
  11398. listeners: {
  11399. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  11400. dragend: delegateDragend.bind(getDesignInstance(), node),
  11401. },
  11402. sourceVjson: node.code,
  11403. dragType: node.dragType
  11404. });
  11405. }
  11406. function createComponent() {
  11407. var template = [];
  11408. for (var i = 0; i < codeLines.length; i++) {
  11409. var item = codeLines[i];
  11410. if (!item.dragHtml) {
  11411. continue;
  11412. }
  11413. var $ele = $("<li>" + item.dragHtml + "</li>");
  11414. $ele.children(':first').attr('drag_id', item.id);
  11415. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  11416. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  11417. }
  11418. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  11419. return html;
  11420. }
  11421. var codeLines = [
  11422. {
  11423. id: '$label',
  11424. value: layoutOrXtypeNameMap.label + ' - label',
  11425. icon: "fa fa-font",
  11426. dragType: "col-item",
  11427. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11428. code: {
  11429. xtype: 'label',
  11430. text: '文本' + _$2.uniqueId('_l')
  11431. }
  11432. },
  11433. {
  11434. id: '$text',
  11435. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  11436. icon: "fa fa-edit",
  11437. dragType: "col-item",
  11438. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11439. code: {
  11440. xtype: 'textfield',
  11441. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11442. }
  11443. },
  11444. {
  11445. id: '$textarea',
  11446. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  11447. icon: "fa fa-edit",
  11448. dragType: "col-item",
  11449. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11450. code: {
  11451. xtype: 'textareafield',
  11452. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11453. }
  11454. },
  11455. {
  11456. id: '$number',
  11457. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  11458. icon: "fa fa-edit",
  11459. dragType: "col-item",
  11460. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11461. code: {
  11462. xtype: 'numberfield',
  11463. fieldLabel: '数字框' + _$2.uniqueId('_n')
  11464. }
  11465. },
  11466. {
  11467. id: '$combo',
  11468. value: layoutOrXtypeNameMap.combo + ' - combo',
  11469. icon: "fa fa-angle-double-down",
  11470. dragType: "col-item",
  11471. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11472. code: {
  11473. xtype: 'combo',
  11474. fieldLabel: '请选择',
  11475. data: [
  11476. { id: 'id1', text: '选项1' },
  11477. { id: 'id2', text: '选项2' },
  11478. { id: 'id3', text: '选项3' },
  11479. ],
  11480. }
  11481. },
  11482. {
  11483. id: '$datebox',
  11484. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  11485. icon: "fa fa-calendar",
  11486. dragType: "col-item",
  11487. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11488. code: {
  11489. xtype: "datefield",
  11490. fieldLabel: '日期',
  11491. }
  11492. },
  11493. {
  11494. id: '$searchbox',
  11495. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  11496. icon: "fa fa-search",
  11497. dragType: "col-item",
  11498. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11499. code: {
  11500. xtype: 'searchfield',
  11501. fieldLabel: '搜索框',
  11502. }
  11503. },
  11504. {
  11505. id: '$combogrid',
  11506. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  11507. icon: "fa fa-table",
  11508. dragType: "col-item",
  11509. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11510. code: {
  11511. xtype: 'combogrid',
  11512. fieldLabel: '下拉表'
  11513. }
  11514. },
  11515. {
  11516. id: '$combotree',
  11517. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  11518. icon: "fa fa-tree",
  11519. dragType: "col-item",
  11520. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11521. code: {
  11522. xtype: 'combotree',
  11523. fieldLabel: '下拉树',
  11524. displayField: 'text',
  11525. rootVisible: false
  11526. }
  11527. },
  11528. {
  11529. id: '$button',
  11530. value: layoutOrXtypeNameMap.button + ' - button',
  11531. icon: 'fa fa-sign-in',
  11532. dragType: "col-item",
  11533. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11534. code: {
  11535. text: '按钮',
  11536. iconCls: 'x-fa fa-bars',
  11537. xtype: 'button'
  11538. }
  11539. },
  11540. {
  11541. id: '$checkbox',
  11542. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  11543. icon: 'fa fa-check-square',
  11544. dragType: "col-item",
  11545. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11546. code: {
  11547. xtype: 'checkbox',
  11548. boxLabel: '勾选框',
  11549. hideLabel: true,
  11550. margin: '0 0 0 15',
  11551. flex: 0,
  11552. }
  11553. },
  11554. {
  11555. id: '$checkboxgroup',
  11556. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  11557. icon: 'fa fa-check-square',
  11558. dragType: "col-item",
  11559. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11560. code: {
  11561. xtype: 'checkboxgroup',
  11562. fieldLabel: '勾选组',
  11563. items: [
  11564. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11565. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11566. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11567. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11568. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11569. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11570. ]
  11571. }
  11572. },
  11573. {
  11574. id: '$radio',
  11575. value: layoutOrXtypeNameMap.radio + ' - radio',
  11576. icon: 'fa fa-dot-circle-o',
  11577. dragType: "col-item",
  11578. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11579. code: {
  11580. xtype: "radio",
  11581. fieldLabel: "请选择",
  11582. }
  11583. },
  11584. {
  11585. id: '$radiogroup',
  11586. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  11587. icon: 'fa fa-dot-circle-o',
  11588. dragType: "col-item",
  11589. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11590. code: {
  11591. xtype: "radiogroup",
  11592. fieldLabel: "请选择",
  11593. items: [
  11594. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11595. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11596. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11597. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11598. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11599. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11600. ]
  11601. }
  11602. },
  11603. {
  11604. id: '$cols',
  11605. value: layoutOrXtypeNameMap.cols + ' - cols',
  11606. icon: 'fa fa-list-alt',
  11607. dragType: "cols-container",
  11608. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11609. code: {
  11610. xtype: 'cols',
  11611. items: [
  11612. {
  11613. xtype: 'textfield',
  11614. fieldLabel: '输入框',
  11615. },
  11616. ],
  11617. }
  11618. },
  11619. {
  11620. id: '$container',
  11621. value: layoutOrXtypeNameMap.container + ' - container',
  11622. icon: 'fa fa-flag',
  11623. dragType: "col-item",
  11624. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11625. code: {
  11626. xtype: 'container',
  11627. border: false,
  11628. layout: 'hbox',
  11629. }
  11630. },
  11631. {
  11632. id: '$fit',
  11633. value: layoutOrXtypeNameMap.fit + ' - fit',
  11634. icon: 'fa fa-flag',
  11635. dragType: "rows-container",
  11636. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11637. code: {
  11638. border: false,
  11639. layout: 'fit',
  11640. items: [
  11641. {
  11642. xtype: 'container',
  11643. border: false,
  11644. layout: 'hbox',
  11645. }
  11646. ]
  11647. }
  11648. },
  11649. ];
  11650. // @ts-ignore
  11651. // export default ToolBoxCmp
  11652. //# sourceMappingURL=ToolBox.js.map
  11653. var that = undefined;
  11654. function initPropertyDesign () {
  11655. Ext.define('com.yvan.studio.PropertyDesign', {
  11656. extend: 'Ext.panel.Panel',
  11657. xtype: 'propertydesign',
  11658. name: "PropertyDesign",
  11659. tooltip: '属性',
  11660. iconCls: 'x-fa fa-newspaper-o',
  11661. reference: 'propertygrid',
  11662. layout: 'border',
  11663. border: false,
  11664. moduleId: null,
  11665. currentComponentVJson: null,
  11666. currentComponentPropertyEditSource: null,
  11667. vjson: null,
  11668. propertyHandle: null,
  11669. moduleSubscribe: null,
  11670. items: [
  11671. new Ext.grid.property.Grid({
  11672. sortableColumns: false,
  11673. region: 'center',
  11674. listeners: {
  11675. propertychange: function (source, propName, value, oldValue, eOpts) {
  11676. value = _.trim(value);
  11677. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  11678. return item.label === propName;
  11679. });
  11680. if (a.type === 'listeners') {
  11681. if (value) {
  11682. if (that.currentComponentVJson.listeners) {
  11683. that.currentComponentVJson.listeners[propName] = value;
  11684. }
  11685. else {
  11686. var t = {};
  11687. t[propName] = value;
  11688. that.currentComponentVJson.listeners = t;
  11689. }
  11690. }
  11691. else {
  11692. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  11693. if (!value1) {
  11694. delete that.currentComponentVJson.listeners[key];
  11695. }
  11696. else if (key === propName) {
  11697. delete that.currentComponentVJson.listeners[key];
  11698. }
  11699. });
  11700. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  11701. delete that.currentComponentVJson.listeners;
  11702. }
  11703. }
  11704. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11705. vjson: that.vjson,
  11706. from: that.name,
  11707. ignoreRenderUI: true
  11708. });
  11709. }
  11710. else if (a.type === 'fix') {
  11711. if (!value) {
  11712. delete that.currentComponentVJson[propName];
  11713. }
  11714. else {
  11715. that.currentComponentVJson[propName] = value.split("\r\n");
  11716. }
  11717. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11718. vjson: that.vjson,
  11719. from: that.name,
  11720. ignoreRenderUI: true
  11721. });
  11722. }
  11723. else if (a.type === 'bind') {
  11724. var bind_1 = that.currentComponentVJson.bind;
  11725. if (typeof bind_1 === 'string' && a.id === "value") {
  11726. if (value) {
  11727. that.currentComponentVJson.bind = value;
  11728. }
  11729. else {
  11730. delete that.currentComponentVJson.bind;
  11731. }
  11732. }
  11733. else {
  11734. // 转成bind对象
  11735. if (typeof bind_1 === 'string') {
  11736. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  11737. }
  11738. if (value) {
  11739. if (bind_1) {
  11740. bind_1[a.id] = value;
  11741. }
  11742. else {
  11743. var t = {};
  11744. t[a.id] = value;
  11745. that.currentComponentVJson.bind = t;
  11746. }
  11747. }
  11748. else {
  11749. _.forOwn(bind_1, function (value1, key) {
  11750. if (!value1) {
  11751. delete bind_1[key];
  11752. }
  11753. else if (key === a.id) {
  11754. delete bind_1[key];
  11755. }
  11756. });
  11757. if (Object.keys(bind_1).length <= 0) {
  11758. delete that.currentComponentVJson.bind;
  11759. }
  11760. }
  11761. }
  11762. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11763. vjson: that.vjson,
  11764. from: that.name,
  11765. ignoreRenderUI: true
  11766. });
  11767. }
  11768. else if (a.type === 'boolean') {
  11769. if (!value) {
  11770. delete that.currentComponentVJson[propName];
  11771. }
  11772. else if (value === 'false') {
  11773. that.currentComponentVJson[propName] = false;
  11774. }
  11775. else if (value === 'true') {
  11776. that.currentComponentVJson[propName] = true;
  11777. }
  11778. else {
  11779. that.currentComponentVJson[propName] = value;
  11780. }
  11781. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11782. vjson: that.vjson,
  11783. from: that.name
  11784. });
  11785. }
  11786. else {
  11787. that.currentComponentVJson[propName] = value;
  11788. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11789. vjson: that.vjson,
  11790. from: that.name
  11791. });
  11792. }
  11793. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  11794. },
  11795. }
  11796. })
  11797. ],
  11798. listeners: {
  11799. // afterrender() {
  11800. // this.propertyHandle.setSource({
  11801. // "(name)": "My Object",
  11802. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  11803. // "Available": false, // boolean type
  11804. // "Version": .01, // decimal type
  11805. // "Description": "A test object"
  11806. // });
  11807. // }
  11808. },
  11809. initComponent: function () {
  11810. var _this = this;
  11811. this.propertyHandle = this.items[0];
  11812. setPropertyPanel(this);
  11813. that = this;
  11814. eventBus.subscribe(EventType.SetVjson, function (_a) {
  11815. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11816. _this.setVjson(moduleId, from, ignoreRenderUI);
  11817. });
  11818. return this.superclass.initComponent.apply(this, arguments);
  11819. },
  11820. setVjson: function (moduleId, from, ignoreRenderUI) {
  11821. var _this = this;
  11822. // if (this.moduleId === null && moduleId) {
  11823. // this.moduleId = moduleId
  11824. // }
  11825. if (moduleId !== this.moduleId || from === this.name) {
  11826. return;
  11827. }
  11828. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  11829. if (!moduleObj) {
  11830. return;
  11831. }
  11832. this.vjson = moduleObj.moduleObj.vjson;
  11833. this.setPropertyAndEventSource();
  11834. if (this.componentSelectionChangeSubscribe) {
  11835. this.componentSelectionChangeSubscribe.cancel();
  11836. this.componentSelectionChangeSubscribe = null;
  11837. }
  11838. if (this.updateVjsonChangeSubscribe) {
  11839. this.updateVjsonChangeSubscribe.cancel();
  11840. this.updateVjsonChangeSubscribe = null;
  11841. }
  11842. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11843. var id = _a.id, from = _a.from;
  11844. _this.onComponentSelectionChange(id, from);
  11845. });
  11846. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11847. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11848. _this.updateVjson(vjson, from, ignoreRenderUI);
  11849. });
  11850. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11851. this.onComponentSelectionChange(id, from);
  11852. },
  11853. updateVjson: function (vjson, from, ignoreRenderUI) {
  11854. if (!vjson || from === this.name) {
  11855. return;
  11856. }
  11857. this.vjson = vjson;
  11858. this.setPropertyAndEventSource();
  11859. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11860. this.onComponentSelectionChange(id, from);
  11861. },
  11862. onComponentSelectionChange: function (id, from) {
  11863. if (from !== this.name) {
  11864. this.currentComponentVJson = findInCode(this.vjson, id);
  11865. this.setPropertyAndEventSource();
  11866. }
  11867. },
  11868. setPropertyAndEventSource: function () {
  11869. var _this = this;
  11870. this.propertyHandle.setSource({});
  11871. if (!this.currentComponentVJson) {
  11872. return;
  11873. }
  11874. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  11875. var v = xtype;
  11876. // 选中的对象可能是组
  11877. if (!v) {
  11878. if (_.has(this.currentComponentVJson, "cols")) {
  11879. v = "cols";
  11880. }
  11881. else if (_.has(this.currentComponentVJson, "rows")) {
  11882. v = "rows";
  11883. }
  11884. }
  11885. var pd = YvanUI.PropertyDescriptionTable.get(v);
  11886. if (!pd) {
  11887. // 这个组件没有属性
  11888. this.propertyHandle.setSource({});
  11889. return;
  11890. }
  11891. var funcArr = this.getAllfuncs();
  11892. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  11893. // disabled: true,
  11894. displayField: 'name',
  11895. valueField: 'name',
  11896. store: funcArr,
  11897. }); };
  11898. // ====================== 属性
  11899. var elements = [];
  11900. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  11901. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  11902. var props = pd.getPropsByGroup(group);
  11903. if (props.length <= 0)
  11904. return; //没有这一组属性
  11905. // 显示 group 的中文名
  11906. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  11907. if (caption[i] === '绑定') {
  11908. _.each(props, function (prop) {
  11909. elements.push({
  11910. label: "_" + prop.name,
  11911. type: "bind",
  11912. id: prop.name,
  11913. desc: prop.desc,
  11914. editor: new Ext.form.field.Text()
  11915. });
  11916. });
  11917. }
  11918. else {
  11919. _.each(props, function (prop) {
  11920. if (_.isArray(prop.type)) {
  11921. elements.push({
  11922. label: prop.name,
  11923. type: "combo",
  11924. options: prop.type,
  11925. id: prop.name,
  11926. desc: prop.desc
  11927. });
  11928. return;
  11929. }
  11930. switch (prop.type) {
  11931. case 'boolean': {
  11932. elements.push({
  11933. label: prop.name,
  11934. id: prop.name,
  11935. desc: prop.desc,
  11936. type: 'boolean',
  11937. editor: new Ext.form.field.ComboBox({
  11938. displayField: 'text',
  11939. valueField: 'id',
  11940. store: new Ext.data.Store({
  11941. field: ['id', 'text'],
  11942. data: [
  11943. { id: 'true', text: 'True' },
  11944. { id: 'false', text: 'False' },
  11945. ]
  11946. })
  11947. }),
  11948. });
  11949. break;
  11950. }
  11951. case 'number': {
  11952. elements.push({
  11953. label: prop.name,
  11954. type: "number",
  11955. id: prop.name,
  11956. isNum: true,
  11957. desc: prop.desc,
  11958. editor: new Ext.form.field.Number()
  11959. });
  11960. break;
  11961. }
  11962. case 'string': {
  11963. elements.push({
  11964. label: prop.name,
  11965. type: "string",
  11966. id: prop.name,
  11967. desc: prop.desc,
  11968. editor: new Ext.form.field.Text()
  11969. });
  11970. break;
  11971. }
  11972. case 'listeners': {
  11973. elements.push({
  11974. label: prop.name,
  11975. type: "listeners",
  11976. id: prop.name,
  11977. desc: prop.desc,
  11978. editor: createFuncEditor()
  11979. });
  11980. break;
  11981. }
  11982. case 'fix': {
  11983. elements.push({
  11984. label: prop.name,
  11985. type: "fix",
  11986. id: prop.name,
  11987. desc: prop.desc,
  11988. editor: new Ext.form.field.Text()
  11989. });
  11990. break;
  11991. }
  11992. case 'object': {
  11993. break;
  11994. }
  11995. // case 'dataSource' : {
  11996. // break;
  11997. // }
  11998. case 'valid': {
  11999. break;
  12000. }
  12001. default:
  12002. elements.push({
  12003. label: prop.name,
  12004. type: prop.type,
  12005. id: prop.name,
  12006. desc: prop.desc,
  12007. editor: new Ext.form.field.Text({ disabled: true })
  12008. });
  12009. console.error('不支持的编辑类型', prop);
  12010. }
  12011. });
  12012. }
  12013. });
  12014. this.currentComponentPropertyEditSource = elements;
  12015. var panel1Source = {};
  12016. var panel1SourceConfig = {};
  12017. _.each(elements, function (item) {
  12018. var _a;
  12019. if (item.type === "listeners") {
  12020. var listeners = _this.currentComponentVJson.listeners;
  12021. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  12022. }
  12023. else if (item.type === "fix") {
  12024. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  12025. }
  12026. else if (item.type === "bind") {
  12027. var bind = _this.currentComponentVJson.bind;
  12028. if (typeof bind === 'string' && item.id === 'value') {
  12029. panel1Source[item.label] = bind;
  12030. }
  12031. else {
  12032. panel1Source[item.label] = bind ? bind[item.id] : '';
  12033. }
  12034. }
  12035. else {
  12036. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  12037. }
  12038. panel1Source[item.label] = panel1Source[item.label] || '';
  12039. panel1SourceConfig[item.label] = { editor: item.editor };
  12040. });
  12041. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  12042. },
  12043. getAllfuncs: function () {
  12044. var _a, _b;
  12045. 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;
  12046. var scopeFuncs = [];
  12047. _.forEach(arr, function (item) {
  12048. scopeFuncs.push({ name: "scope." + item.name });
  12049. });
  12050. return scopeFuncs;
  12051. }
  12052. });
  12053. }
  12054. //# sourceMappingURL=PropertyDesign.js.map
  12055. function initViewOutlineTree () {
  12056. Ext.define('com.yvan.studio.ViewOutlineTree', {
  12057. extend: 'Ext.tree.Panel',
  12058. xtype: 'viewoutlinetree',
  12059. name: "ViewOutlineTree",
  12060. tooltip: '设计大纲',
  12061. iconCls: 'x-fa fa-list',
  12062. rootVisible: false,
  12063. useArrows: true,
  12064. allowDeselect: true,
  12065. colspan: 2,
  12066. lines: false,
  12067. reference: 'viewoutlinetree',
  12068. multiSelect: true,
  12069. _saveStateFlag: true,
  12070. keyMapEnabled: true,
  12071. moduleId: null,
  12072. vjson: null,
  12073. columns: [
  12074. {
  12075. xtype: 'treecolumn',
  12076. text: '布局',
  12077. dataIndex: 'layoutNameDesc',
  12078. flex: 2,
  12079. sortable: true
  12080. }, {
  12081. text: '组件',
  12082. dataIndex: 'xtype',
  12083. flex: 1,
  12084. sortable: true,
  12085. align: 'center',
  12086. }
  12087. ],
  12088. listeners: {
  12089. itemcontextmenu: function (sender, node, element, idx, e) {
  12090. e.preventDefault();
  12091. this.rightClickTreeNode(sender, node, element, idx, e);
  12092. },
  12093. select: function (sender, node, index, e) {
  12094. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  12095. },
  12096. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  12097. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  12098. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  12099. }
  12100. }
  12101. },
  12102. initComponent: function () {
  12103. var _this = this;
  12104. setViewoutlinetree(this);
  12105. eventBus.subscribe(EventType.SetVjson, function (_a) {
  12106. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12107. return _this.setVjson(moduleId, from, ignoreRenderUI);
  12108. });
  12109. return this.superclass.initComponent.apply(this, arguments);
  12110. },
  12111. clear: function () {
  12112. this.setRootNode(null);
  12113. },
  12114. onChangModule: function (moduleId, oldModuleId, from) {
  12115. if (!moduleId || moduleId !== this.moduleId) {
  12116. return;
  12117. }
  12118. if (moduleStore.getModuleObject(moduleId)) {
  12119. this.setVjson(moduleId, from);
  12120. }
  12121. },
  12122. setVjson: function (moduleId, from, ignoreRenderUI) {
  12123. var _this = this;
  12124. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  12125. return;
  12126. }
  12127. this.moduleId = moduleId;
  12128. // if (from === this.name) {
  12129. // return
  12130. // }
  12131. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  12132. this.setTreeValue();
  12133. if (this.componentSelectionChangeSubscribe) {
  12134. this.componentSelectionChangeSubscribe.cancel();
  12135. this.componentSelectionChangeSubscribe = null;
  12136. }
  12137. if (this.setVjsonChangeSubscribe) {
  12138. this.setVjsonChangeSubscribe.cancel();
  12139. this.setVjsonChangeSubscribe = null;
  12140. }
  12141. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  12142. var id = _a.id, from = _a.from;
  12143. return _this.onComponentSelectionChange(id, from);
  12144. });
  12145. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  12146. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12147. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  12148. });
  12149. },
  12150. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  12151. if (!vjson || from === this.name) {
  12152. return;
  12153. }
  12154. this.vjson = vjson;
  12155. this.setTreeValue();
  12156. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  12157. if (id) {
  12158. this.selectPath(id);
  12159. }
  12160. },
  12161. onComponentSelectionChange: function (id, from) {
  12162. if (from !== this.name) {
  12163. if (id) {
  12164. this.selectPath(id);
  12165. }
  12166. else {
  12167. this.setTreeValue();
  12168. }
  12169. }
  12170. },
  12171. setTreeValue: function () {
  12172. var outlineVj = {};
  12173. _.forOwn(this.vjson, function (obj, key) {
  12174. if (key !== 'viewModel' && key !== 'store') {
  12175. outlineVj[key] = _.cloneDeep(obj);
  12176. }
  12177. });
  12178. getLayoutOutline(outlineVj);
  12179. this.setRootNode(outlineVj);
  12180. },
  12181. rightClickTreeNode: function (sender, node, element, idx, e) {
  12182. var raw = node.data;
  12183. var option = {};
  12184. // 右键
  12185. option = {
  12186. shadow: 'frame',
  12187. allowOtherMenus: true,
  12188. items: []
  12189. };
  12190. var switchType = raw.layoutName;
  12191. if (raw.layoutName === 'north' ||
  12192. raw.layoutName === 'south' ||
  12193. raw.layoutName === 'west' ||
  12194. raw.layoutName === 'east' ||
  12195. raw.layoutName === 'center' ||
  12196. raw.layoutName === 'tbar' ||
  12197. raw.layoutName === 'fbar') {
  12198. switchType = raw.xtype || raw.layout;
  12199. }
  12200. var itemArr = [];
  12201. var hasTbar = false, hasFbar = false, hasBody = false;
  12202. if (raw.hasOwnProperty("children")) {
  12203. _.forEach(raw.children, function (value) {
  12204. if (value.layoutName === 'tbar') {
  12205. hasTbar = true;
  12206. }
  12207. else if (value.layoutName === 'fbar') {
  12208. hasFbar = true;
  12209. }
  12210. else {
  12211. hasBody = true;
  12212. }
  12213. });
  12214. }
  12215. switch (switchType) {
  12216. case 'fit':
  12217. if (!hasTbar) {
  12218. itemArr.push('tbar');
  12219. }
  12220. if (!hasFbar) {
  12221. itemArr.push('fbar');
  12222. }
  12223. if (!hasBody) {
  12224. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12225. }
  12226. option.items = this.menuNew(itemArr, raw);
  12227. break;
  12228. case 'border':
  12229. if (!hasTbar) {
  12230. itemArr.push('tbar');
  12231. }
  12232. if (!hasFbar) {
  12233. itemArr.push('fbar');
  12234. }
  12235. itemArr.push('cnsew');
  12236. option.items = this.menuNew(itemArr, raw);
  12237. break;
  12238. // case 'tbar':
  12239. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  12240. // break;
  12241. // case 'fbar':
  12242. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  12243. // break;
  12244. case 'tabpanel':
  12245. if (!hasTbar) {
  12246. itemArr.push('tbar');
  12247. }
  12248. if (!hasFbar) {
  12249. itemArr.push('fbar');
  12250. }
  12251. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12252. option.items = this.menuNew(itemArr, raw);
  12253. break;
  12254. case 'yvgrid':
  12255. if (!hasTbar) {
  12256. itemArr.push('tbar');
  12257. }
  12258. option.items = this.menuNew(itemArr, raw);
  12259. break;
  12260. case 'tree':
  12261. if (!hasTbar) {
  12262. itemArr.push('tbar');
  12263. }
  12264. if (!hasFbar) {
  12265. itemArr.push('fbar');
  12266. }
  12267. option.items = this.menuNew(itemArr, raw);
  12268. break;
  12269. case 'fieldset':
  12270. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  12271. break;
  12272. case 'form':
  12273. if (!hasTbar) {
  12274. itemArr.push('tbar');
  12275. }
  12276. if (!hasFbar) {
  12277. itemArr.push('fbar');
  12278. }
  12279. itemArr.push('form', 'fieldset', 'cols');
  12280. option.items = this.menuNew(itemArr, raw);
  12281. break;
  12282. case 'toolbar':
  12283. itemArr.push('button', 'textfield', 'label', 'combo');
  12284. option.items = this.menuNew(itemArr, raw);
  12285. break;
  12286. // case 'fbar':
  12287. // itemArr.push('button', 'textfield', 'label', 'combo')
  12288. // option.items = this.menuNew(itemArr, raw)
  12289. // break
  12290. default:
  12291. option.items = this.menuNew(itemArr, raw);
  12292. break;
  12293. }
  12294. var treeMenu = new Ext.menu.Menu(option);
  12295. treeMenu.showAt(e.getXY());
  12296. },
  12297. newItem: function (viewType, raw, region) {
  12298. var itemVjson = {};
  12299. switch (viewType) {
  12300. case 'fit':
  12301. itemVjson.layout = 'fit';
  12302. itemVjson.items = [];
  12303. break;
  12304. case 'border':
  12305. itemVjson.layout = 'border';
  12306. itemVjson.items = [];
  12307. break;
  12308. case 'toolbar':
  12309. itemVjson.xtype = 'toolbar';
  12310. itemVjson.title = 'toolbar';
  12311. itemVjson.items = [
  12312. {
  12313. xtype: 'button',
  12314. text: 'button'
  12315. }
  12316. ];
  12317. break;
  12318. case 'tabpanel':
  12319. itemVjson.xtype = 'tabpanel';
  12320. itemVjson.layout = 'fit';
  12321. itemVjson.items = [];
  12322. break;
  12323. case 'yvgrid':
  12324. itemVjson.xtype = 'yvgrid';
  12325. itemVjson.layout = 'fit';
  12326. itemVjson.pagination = false;
  12327. itemVjson.columns = [
  12328. {
  12329. dataIndex: "skuId",
  12330. header: "SKU_ID",
  12331. },
  12332. ];
  12333. break;
  12334. case 'tree':
  12335. itemVjson.xtype = 'treepanel';
  12336. itemVjson.layout = 'fit';
  12337. break;
  12338. case 'fieldset':
  12339. case 'form':
  12340. itemVjson.xtype = viewType;
  12341. itemVjson.title = viewType;
  12342. itemVjson.items = [
  12343. {
  12344. xtype: 'cols',
  12345. items: [
  12346. {
  12347. xtype: 'textfield',
  12348. fieldLabel: '输入框'
  12349. }
  12350. ]
  12351. }
  12352. ];
  12353. break;
  12354. case 'cols':
  12355. itemVjson.xtype = 'cols';
  12356. itemVjson.items = [
  12357. {
  12358. xtype: 'textfield',
  12359. fieldLabel: '输入框'
  12360. }
  12361. ];
  12362. break;
  12363. case 'button':
  12364. itemVjson.xtype = 'button';
  12365. itemVjson.text = '按钮';
  12366. itemVjson.iconCls = 'x-fa fa-plus';
  12367. break;
  12368. case 'textfield':
  12369. itemVjson.xtype = 'textfield';
  12370. itemVjson.fieldLabel = '输入框';
  12371. break;
  12372. case 'combo':
  12373. itemVjson.xtype = 'combo';
  12374. itemVjson.fieldLabel = '下拉框';
  12375. break;
  12376. case 'label':
  12377. itemVjson.xtype = 'label';
  12378. itemVjson.text = '文本';
  12379. break;
  12380. }
  12381. var target = findInCode(this.vjson, raw.id);
  12382. if (region) {
  12383. if (region === 'tbar' || region === 'fbar') {
  12384. target[region] = itemVjson;
  12385. }
  12386. else {
  12387. itemVjson.region = region;
  12388. itemVjson.split = true;
  12389. if (region === 'north' || region === 'south') {
  12390. itemVjson.height = '30%';
  12391. itemVjson.collapsible = true;
  12392. }
  12393. else if (region === 'west' || region === 'east') {
  12394. itemVjson.width = '30%';
  12395. itemVjson.collapsible = true;
  12396. }
  12397. target.items.push(itemVjson);
  12398. }
  12399. }
  12400. else {
  12401. if (target.xtype === 'tabpanel') {
  12402. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  12403. }
  12404. target.items.push(itemVjson);
  12405. }
  12406. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12407. },
  12408. menuNew: function (typeArr, raw, region) {
  12409. var that = this;
  12410. var reArr = [];
  12411. typeArr.forEach(function (value) {
  12412. if (value === 'cnsew') {
  12413. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  12414. }
  12415. else if (value === 'tbar' || value === 'fbar') {
  12416. reArr.push(that.menuNewTFBar(value, raw));
  12417. }
  12418. else {
  12419. reArr.push({
  12420. text: '新建' + layoutOrXtypeNameMap[value],
  12421. iconCls: 'x-fa fa-plus',
  12422. handler: function (sender) {
  12423. that.newItem(value, raw, region);
  12424. }
  12425. });
  12426. }
  12427. reArr.push("-");
  12428. });
  12429. if (region) {
  12430. reArr.pop();
  12431. return reArr;
  12432. }
  12433. reArr.push({
  12434. text: '高级属性',
  12435. iconCls: 'x-fa fa-cog',
  12436. handler: function (sender) {
  12437. var vj = findInCode(that.vjson, raw.id);
  12438. that.advancedSettingWindow(vj);
  12439. }
  12440. }, {
  12441. text: '上移',
  12442. iconCls: 'x-fa fa-trash',
  12443. handler: function (sender) {
  12444. that.moveCmp(raw.id, 'up');
  12445. }
  12446. }, {
  12447. text: '置顶',
  12448. iconCls: 'x-fa fa-trash',
  12449. handler: function (sender) {
  12450. that.moveCmp(raw.id, 'top');
  12451. }
  12452. }, {
  12453. text: '置底',
  12454. iconCls: 'x-fa fa-trash',
  12455. handler: function (sender) {
  12456. that.moveCmp(raw.id, 'bottom');
  12457. }
  12458. }, {
  12459. text: '下移',
  12460. iconCls: 'x-fa fa-trash',
  12461. handler: function (sender) {
  12462. that.moveCmp(raw.id, 'down');
  12463. }
  12464. }, {
  12465. text: '删除',
  12466. iconCls: 'x-fa fa-trash',
  12467. handler: function (sender) {
  12468. deletVjsonById(that.vjson, raw.id);
  12469. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  12470. }
  12471. });
  12472. return reArr;
  12473. },
  12474. menuNewCNSEW: function (raw) {
  12475. var that = this;
  12476. var arr = ['center', 'north', 'south', 'west', 'east'];
  12477. if (raw.hasOwnProperty("children")) {
  12478. _.forEach(raw.children, function (value) {
  12479. _.remove(arr, function (it) {
  12480. return it === value.layoutName;
  12481. });
  12482. });
  12483. }
  12484. var reArr = [];
  12485. arr.forEach(function (value) {
  12486. reArr.push({
  12487. text: layoutOrXtypeNameMap[value],
  12488. iconCls: 'x-fa fa-plus',
  12489. menu: {
  12490. showSeparator: true,
  12491. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  12492. }
  12493. });
  12494. reArr.push("-");
  12495. });
  12496. reArr.pop();
  12497. return reArr;
  12498. },
  12499. menuNewTFBar: function (barType, raw) {
  12500. var that = this;
  12501. var reObj = {
  12502. text: layoutOrXtypeNameMap[barType],
  12503. iconCls: 'x-fa fa-plus',
  12504. menu: {
  12505. showSeparator: true,
  12506. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  12507. }
  12508. };
  12509. return reObj;
  12510. },
  12511. moveCmp: function (id, moveType) {
  12512. var arr = findArrayContainer(this.vjson, id);
  12513. var index = _.findIndex(arr, function (v) { return v.id === id; });
  12514. if (index < 0) {
  12515. return;
  12516. }
  12517. switch (moveType) {
  12518. case 'up':
  12519. if (index > 0) {
  12520. var o = arr[index];
  12521. arr[index] = arr[index - 1];
  12522. arr[index - 1] = o;
  12523. }
  12524. else {
  12525. return;
  12526. }
  12527. break;
  12528. case 'down':
  12529. if (index < arr.length - 1) {
  12530. var o = arr[index];
  12531. arr[index] = arr[index + 1];
  12532. arr[index + 1] = o;
  12533. }
  12534. else {
  12535. return;
  12536. }
  12537. break;
  12538. case 'top':
  12539. if (index > 0) {
  12540. var o = arr[index];
  12541. arr[index] = arr[0];
  12542. arr[0] = o;
  12543. }
  12544. else {
  12545. return;
  12546. }
  12547. break;
  12548. case 'bottom':
  12549. if (index < arr.length - 1) {
  12550. var o = arr[index];
  12551. arr[index] = arr[arr.length - 1];
  12552. arr[arr.length - 1] = o;
  12553. }
  12554. else {
  12555. return;
  12556. }
  12557. break;
  12558. }
  12559. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12560. }
  12561. });
  12562. }
  12563. //# sourceMappingURL=ViewOutlineTree.js.map
  12564. function init$1 () {
  12565. window['native'] = native;
  12566. native.init();
  12567. init();
  12568. initStateTree();
  12569. initDashboard();
  12570. initFileTree();
  12571. initDbTree();
  12572. initReportGrid();
  12573. initGroovyEditor();
  12574. initJsEditor();
  12575. initJsonEditor();
  12576. initSqlEditor();
  12577. initTemplateEditor();
  12578. initDict();
  12579. initBpmnTree();
  12580. initToolBox();
  12581. initPropertyDesign();
  12582. initViewOutlineTree();
  12583. initWidget();
  12584. initWhLayout();
  12585. initApiTree();
  12586. initTaskTree();
  12587. initLogsTree();
  12588. initDevOpsTree();
  12589. initTerminal();
  12590. initMonitorTree();
  12591. initHomeTree();
  12592. }
  12593. //# sourceMappingURL=init.js.map
  12594. var model$c = {
  12595. data: {
  12596. leftTabTitle: ''
  12597. }
  12598. };
  12599. //# sourceMappingURL=Workbench.model.js.map
  12600. var vjson$c = {
  12601. frame: false,
  12602. layout: 'border',
  12603. width: '100%',
  12604. height: '100%',
  12605. border: false,
  12606. defaults: {
  12607. border: false
  12608. },
  12609. items: [
  12610. {
  12611. region: 'north',
  12612. height: 60,
  12613. cls: 'main-header',
  12614. reference: 'mainTop',
  12615. layout: 'hbox',
  12616. items: [
  12617. {
  12618. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  12619. flex: 1,
  12620. border: false
  12621. },
  12622. {
  12623. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  12624. menu: [
  12625. {
  12626. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  12627. reference: 'commonSetting'
  12628. },
  12629. {
  12630. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  12631. listeners: {
  12632. // click: 'scope.ready_api_click'
  12633. }
  12634. },
  12635. ]
  12636. },
  12637. {
  12638. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  12639. cls: 'header-menu',
  12640. menu: [
  12641. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  12642. ]
  12643. },
  12644. ]
  12645. },
  12646. {
  12647. region: 'west',
  12648. bind: {
  12649. title: '{leftTabTitle}',
  12650. },
  12651. titleAlign: 'center',
  12652. border: true, split: true, width: 340, collapsible: true,
  12653. reference: 'leftTab',
  12654. xtype: 'tabpanel',
  12655. tabPosition: 'left',
  12656. tabRotation: 0,
  12657. tabBar: {
  12658. border: false
  12659. },
  12660. listeners: {
  12661. tabchange: 'scope.leftTabChange',
  12662. },
  12663. items: [
  12664. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  12665. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  12666. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  12667. { tooltip: '表单转换', iconCls: 'x-fa fa-exchange', },
  12668. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  12669. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  12670. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  12671. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  12672. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  12673. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  12674. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  12675. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  12676. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  12677. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  12678. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  12679. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  12680. ]
  12681. },
  12682. {
  12683. region: 'east',
  12684. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  12685. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  12686. },
  12687. {
  12688. region: 'center',
  12689. split: true, border: true,
  12690. xtype: 'maintab', reference: 'tt', id: 'TT',
  12691. plain: true,
  12692. listeners: {
  12693. restorypage: 'scope.openScope',
  12694. tabchange: 'scope.tabchange'
  12695. },
  12696. items: []
  12697. },
  12698. ],
  12699. };
  12700. //# sourceMappingURL=Workbench.view.js.map
  12701. var model$d = {
  12702. data: {
  12703. dataSync_isStart: false,
  12704. dataSync: {
  12705. skipError: false,
  12706. clearData: false,
  12707. tables: []
  12708. },
  12709. dataSyncResult: {
  12710. jobId: ''
  12711. },
  12712. dataSource1: '',
  12713. dataSource2: '',
  12714. schema1: '',
  12715. schema2: '',
  12716. hasDiff: false,
  12717. }
  12718. };
  12719. //# sourceMappingURL=DbSync.model.js.map
  12720. var vjson$d = {
  12721. title: '数据库同步',
  12722. layout: 'fit',
  12723. items: [
  12724. {
  12725. reference: 'wizard1',
  12726. layout: 'card',
  12727. items: [
  12728. {
  12729. reference: 'first',
  12730. layout: 'fit',
  12731. bbar: [
  12732. '->',
  12733. {
  12734. xtype: 'button',
  12735. iconCls: 'x-fa fa-road',
  12736. text: '结构同步 &raquo;',
  12737. bind: {
  12738. disabled: '{!hasDiff}'
  12739. },
  12740. listeners: {
  12741. click: 'scope.structCopyTo',
  12742. }
  12743. },
  12744. {
  12745. xtype: 'button',
  12746. iconCls: 'x-fa fa-files-o',
  12747. text: '数据同步 &raquo;',
  12748. bind: {
  12749. disabled: '{!hasDiff}'
  12750. },
  12751. listeners: {
  12752. click: 'scope.dataCopyTo',
  12753. }
  12754. },
  12755. {
  12756. xtype: 'button',
  12757. iconCls: 'x-fa fa-sort-alpha-desc',
  12758. text: '索引同步 &raquo;',
  12759. bind: {
  12760. disabled: '{!hasDiff}'
  12761. },
  12762. listeners: {
  12763. click: 'scope.indexCopyTo',
  12764. }
  12765. },
  12766. {
  12767. xtype: 'button',
  12768. iconCls: 'x-fa fa-product-hunt',
  12769. text: '存储过程同步 &raquo;',
  12770. bind: {
  12771. disabled: '{!hasDiff}'
  12772. },
  12773. listeners: {
  12774. click: 'scope.procedureCopyTo',
  12775. }
  12776. },
  12777. ],
  12778. items: [
  12779. {
  12780. title: '数据库对比',
  12781. reference: 'grid1',
  12782. xtype: 'yvgrid',
  12783. pagination: false,
  12784. border: false,
  12785. cellTip: true,
  12786. selModel: {
  12787. type: 'checkboxmodel',
  12788. mode: 'MULTI',
  12789. },
  12790. tbar: {
  12791. xtype: 'toolbar',
  12792. items: [
  12793. {
  12794. xtype: 'combo',
  12795. fieldLabel: '源数据库',
  12796. bind: {
  12797. value: '{dataSource1}'
  12798. },
  12799. dataSource: 'scope.getDataBaseName'
  12800. },
  12801. {
  12802. xtype: 'combo',
  12803. fieldLabel: '目标数据库',
  12804. bind: {
  12805. value: '{dataSource2}'
  12806. },
  12807. dataSource: 'scope.getDataBaseName'
  12808. },
  12809. {
  12810. xtype: 'button',
  12811. iconCls: 'x-fa fa-flash',
  12812. text: '对比',
  12813. bind: {
  12814. disabled: '{!dataSource1 || !dataSource2}'
  12815. },
  12816. listeners: {
  12817. click: 'scope.diff',
  12818. }
  12819. },
  12820. {
  12821. xtype: 'button',
  12822. iconCls: 'x-fa fa-cloud-download',
  12823. text: '重新拉取结构(耗时!)',
  12824. bind: {
  12825. disabled: '{!dataSource1 || !dataSource2}'
  12826. },
  12827. listeners: {
  12828. click: 'scope.dbToMeta',
  12829. }
  12830. },
  12831. ]
  12832. },
  12833. columns: [
  12834. {
  12835. dataIndex: 'table_name1',
  12836. header: '源表',
  12837. width: 300,
  12838. },
  12839. {
  12840. dataIndex: 'table_name2',
  12841. header: '目标表',
  12842. width: 300,
  12843. },
  12844. {
  12845. dataIndex: 'diff',
  12846. header: '对比结果',
  12847. width: 100,
  12848. },
  12849. {
  12850. xtype: 'actioncolumn',
  12851. width: 30,
  12852. sortable: false,
  12853. menuDisabled: true,
  12854. items: [
  12855. {
  12856. iconCls: 'x-fa fa-bars',
  12857. text: '打开',
  12858. handler: 'scope.showDetail',
  12859. }
  12860. ]
  12861. },
  12862. {
  12863. dataIndex: 'remark',
  12864. header: '详情',
  12865. width: 200,
  12866. sortable: true,
  12867. },
  12868. ],
  12869. },
  12870. ]
  12871. },
  12872. {
  12873. reference: 'ddl',
  12874. layout: {
  12875. type: 'vbox',
  12876. pack: 'start',
  12877. align: 'stretch'
  12878. },
  12879. items: [
  12880. {
  12881. xtype: 'sqleditor',
  12882. reference: 'ddleditor',
  12883. flex: 1,
  12884. },
  12885. {
  12886. xtype: 'toolbar',
  12887. items: [
  12888. '->',
  12889. {
  12890. xtype: 'button',
  12891. text: '&laquo; 上一步',
  12892. listeners: {
  12893. click: 'scope.back'
  12894. }
  12895. },
  12896. {
  12897. xtype: 'button',
  12898. iconCls: 'x-fa fa-flash',
  12899. text: '执行',
  12900. listeners: {
  12901. click: 'scope.executeDDL'
  12902. }
  12903. },
  12904. ]
  12905. }
  12906. ]
  12907. },
  12908. {
  12909. reference: 'ddl_idx',
  12910. layout: {
  12911. type: 'vbox',
  12912. pack: 'start',
  12913. align: 'stretch'
  12914. },
  12915. items: [
  12916. {
  12917. xtype: 'sqleditor',
  12918. reference: 'ddleditor_idx',
  12919. flex: 1,
  12920. },
  12921. {
  12922. xtype: 'toolbar',
  12923. items: [
  12924. '->',
  12925. {
  12926. xtype: 'button',
  12927. text: '&laquo; 上一步',
  12928. listeners: {
  12929. click: 'scope.back'
  12930. }
  12931. },
  12932. {
  12933. xtype: 'button',
  12934. iconCls: 'x-fa fa-flash',
  12935. text: '执行',
  12936. listeners: {
  12937. click: 'scope.executeDDLIdx'
  12938. }
  12939. },
  12940. ]
  12941. }
  12942. ]
  12943. },
  12944. {
  12945. reference: 'ddl_procedure',
  12946. layout: {
  12947. type: 'vbox',
  12948. pack: 'start',
  12949. align: 'stretch'
  12950. },
  12951. items: [
  12952. {
  12953. xtype: 'sqleditor',
  12954. reference: 'ddleditor_procedure',
  12955. flex: 1,
  12956. },
  12957. {
  12958. xtype: 'toolbar',
  12959. items: [
  12960. '->',
  12961. {
  12962. xtype: 'button',
  12963. text: '&laquo; 上一步',
  12964. listeners: {
  12965. click: 'scope.back'
  12966. }
  12967. },
  12968. {
  12969. xtype: 'button',
  12970. iconCls: 'x-fa fa-flash',
  12971. text: '执行',
  12972. listeners: {
  12973. click: 'scope.executeProcedureSQL'
  12974. }
  12975. },
  12976. ]
  12977. }
  12978. ]
  12979. },
  12980. {
  12981. reference: 'datacopy',
  12982. xtype: 'yvgrid',
  12983. pagination: false,
  12984. tbar: {
  12985. xtype: 'toolbar',
  12986. items: [
  12987. {
  12988. xtype: 'checkbox',
  12989. fieldLabel: '忽略错误',
  12990. bind: {
  12991. value: '{dataSync.skipError}'
  12992. },
  12993. },
  12994. {
  12995. xtype: 'checkbox',
  12996. fieldLabel: '清空数据',
  12997. bind: {
  12998. value: '{dataSync.clearData}'
  12999. },
  13000. },
  13001. {
  13002. xtype: 'button',
  13003. iconCls: 'x-fa fa-play-circle',
  13004. text: '开始',
  13005. bind: {
  13006. disabled: '{dataSync_isStart}'
  13007. },
  13008. listeners: { click: 'scope.dataSync_start' }
  13009. },
  13010. {
  13011. xtype: 'button',
  13012. iconCls: 'x-fa fa-stop-circle',
  13013. text: '停止',
  13014. bind: {
  13015. disabled: '{!dataSync_isStart}'
  13016. },
  13017. listeners: { click: 'scope.dataSync_stop' }
  13018. },
  13019. ]
  13020. },
  13021. columns: [
  13022. {
  13023. dataIndex: 'tableName', header: '表名',
  13024. width: 300,
  13025. },
  13026. {
  13027. dataIndex: 'dataCount', header: '总记录数',
  13028. width: 150,
  13029. },
  13030. {
  13031. dataIndex: 'currentIdx', header: '当前记录数',
  13032. width: 150,
  13033. },
  13034. {
  13035. dataIndex: 'syncCount', header: '同步数',
  13036. width: 150,
  13037. },
  13038. {
  13039. dataIndex: 'deleteCount', header: '删除',
  13040. width: 150,
  13041. },
  13042. {
  13043. dataIndex: 'syncProgress', header: '进度',
  13044. width: 150, dataType: 'int', formatter: 'percentRenderer'
  13045. },
  13046. ]
  13047. }
  13048. ]
  13049. }
  13050. ]
  13051. };
  13052. //# sourceMappingURL=DbSync.view.js.map
  13053. /**
  13054. * 对比两个列 是否存在不一致
  13055. */
  13056. function compareColumn(t1, c1, t2, c2) {
  13057. if (typeof c2 === 'undefined') {
  13058. return 'column_name';
  13059. }
  13060. if (c1.column_name !== c2.column_name) {
  13061. return 'column_name';
  13062. }
  13063. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  13064. return 'default_value';
  13065. }
  13066. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  13067. return 'column_comment';
  13068. }
  13069. if (c1.is_primary_key !== c2.is_primary_key) {
  13070. return 'is_primary_key';
  13071. }
  13072. if (c1.not_null !== c2.not_null) {
  13073. return 'not_null';
  13074. }
  13075. var symbol1 = getDataTypeSymbol(t1, c1);
  13076. var symbol2 = getDataTypeSymbol(t2, c2);
  13077. if (symbol1 !== symbol2) {
  13078. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13079. return 'data_type';
  13080. }
  13081. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13082. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  13083. // 只关注长度
  13084. if (c1.column_size != c2.column_size) {
  13085. return 'column_size';
  13086. }
  13087. }
  13088. else {
  13089. // 其他情况,长度和精度都要关注
  13090. if (c1.column_size != c2.column_size) {
  13091. return 'column_size';
  13092. }
  13093. if (c1.decimal_digits !== c2.decimal_digits) {
  13094. return 'decimal_digits';
  13095. }
  13096. }
  13097. }
  13098. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  13099. var symbol1 = getDataTypeSymbol(tableInfo, column);
  13100. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  13101. if (symbol1 !== symbol2) {
  13102. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13103. return 'data_type';
  13104. }
  13105. if (is_fix_size) {
  13106. // 字段域吧大小限制住了
  13107. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13108. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  13109. // 只关注长度
  13110. if (column.column_size != domain.column_size) {
  13111. return 'column_size';
  13112. }
  13113. }
  13114. else {
  13115. // 其他情况,长度和精度都要关注
  13116. if (column.column_size != domain.column_size) {
  13117. return 'column_size';
  13118. }
  13119. if (column.decimal_digits !== domain.decimal_digits) {
  13120. return 'decimal_digits';
  13121. }
  13122. }
  13123. }
  13124. }
  13125. function checkColumn(table, col) {
  13126. if (isEmpty(col.column_name)) {
  13127. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  13128. }
  13129. if (isKeyword(col.column_name)) {
  13130. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  13131. }
  13132. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  13133. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  13134. }
  13135. return undefined;
  13136. }
  13137. function applyDomain(dbType, domain) {
  13138. var editRow = {
  13139. data_type: domain[dbType + '_datatype'],
  13140. };
  13141. domain = _$2.cloneDeep(domain);
  13142. if (!editRow.data_type) {
  13143. throw Error('字段域没有定义数据类型!');
  13144. }
  13145. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  13146. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  13147. if (match) {
  13148. // 类型里面包含括号
  13149. var sz = parseInt(match[2]);
  13150. if (isNaN(sz)) {
  13151. throw Error('字段域的定义错误:' + editRow.data_type);
  13152. }
  13153. domain.is_fix_size = true;
  13154. editRow.data_type = match[1];
  13155. domain.column_size = sz;
  13156. domain.decimal_digits = 0;
  13157. }
  13158. else {
  13159. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  13160. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  13161. if (match2) {
  13162. // 类型里面包含括号
  13163. var sz = parseInt(match2[2]);
  13164. if (isNaN(sz)) {
  13165. throw Error('字段域的定义错误:' + editRow.data_type);
  13166. }
  13167. var dg = parseInt(match2[3]);
  13168. if (isNaN(dg)) {
  13169. throw Error('字段域的定义错误:' + editRow.data_type);
  13170. }
  13171. domain.is_fix_size = true;
  13172. editRow.data_type = match[1];
  13173. domain.column_size = sz;
  13174. domain.decimal_digits = dg;
  13175. }
  13176. }
  13177. if (domain.domain_column_ui) {
  13178. _$2.extend(editRow, {
  13179. column_ui: domain.domain_column_ui,
  13180. });
  13181. }
  13182. if (domain.domain_column_dict) {
  13183. _$2.extend(editRow, {
  13184. column_dict: domain.domain_column_dict,
  13185. });
  13186. }
  13187. if (domain.is_fix_size) {
  13188. _$2.extend(editRow, {
  13189. column_size: domain.column_size,
  13190. decimal_digits: domain.decimal_digits
  13191. });
  13192. }
  13193. if (domain.is_fix_default_value) {
  13194. _$2.extend(editRow, {
  13195. default_value: domain.default_value,
  13196. });
  13197. }
  13198. return editRow;
  13199. }
  13200. /**
  13201. * 获取字段类型代号(用于做跨数据库数据类型对比)
  13202. */
  13203. function getDataTypeSymbol(table, col) {
  13204. if (table.db_type === 'oracle') {
  13205. switch (col.data_type) {
  13206. case 'number':
  13207. if (col.column_size <= 10 && !col.decimal_digits) {
  13208. return 'integer';
  13209. }
  13210. else if (col.column_size <= 19 && !col.decimal_digits) {
  13211. return 'long';
  13212. }
  13213. return 'bigdecimal';
  13214. case 'char':
  13215. if (col.column_size > 3000) {
  13216. return 'clob';
  13217. }
  13218. return 'char';
  13219. case 'integer':
  13220. return 'integer';
  13221. case 'varchar':
  13222. case 'varchar2':
  13223. if (col.column_size > 3000) {
  13224. return 'clob';
  13225. }
  13226. return 'varchar';
  13227. case 'clob':
  13228. return 'clob';
  13229. case 'blob':
  13230. return 'blob';
  13231. case 'date':
  13232. case 'timestamp':
  13233. case 'timestamp(6)':
  13234. case 'timestamp with local time zone':
  13235. case 'timestamp(6) with local time zone':
  13236. case 'timestamp(6) with time zone':
  13237. return 'timestamp';
  13238. }
  13239. return "undefined";
  13240. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  13241. }
  13242. if (table.db_type === 'pgsql') {
  13243. switch (col.data_type) {
  13244. case 'int4':
  13245. return 'integer';
  13246. case 'int8':
  13247. return 'long';
  13248. case 'char':
  13249. return 'char';
  13250. case 'varchar':
  13251. case 'varchar2':
  13252. if (col.column_size > 3000) {
  13253. return 'clob';
  13254. }
  13255. return 'varchar';
  13256. case 'numeric':
  13257. if (col.column_size <= 10 && !col.decimal_digits) {
  13258. return 'integer';
  13259. }
  13260. else if (col.column_size <= 19 && !col.decimal_digits) {
  13261. return 'long';
  13262. }
  13263. return 'bigdecimal';
  13264. case 'timestamp':
  13265. case 'timestamptz':
  13266. return 'timestamp';
  13267. case 'bytea':
  13268. return 'blob';
  13269. }
  13270. return "undefined";
  13271. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  13272. }
  13273. throw Error('未知数据库类型:' + table.db_type);
  13274. }
  13275. /**
  13276. * 判断对象名称是不是数据库关键字(保留字)
  13277. */
  13278. function isKeyword(word) {
  13279. if (!word || typeof word !== 'string') {
  13280. return false;
  13281. }
  13282. var kk = ['access',
  13283. 'add',
  13284. 'all',
  13285. 'alter',
  13286. 'and',
  13287. 'any',
  13288. 'as',
  13289. 'asc',
  13290. 'audit',
  13291. 'between',
  13292. 'by',
  13293. 'char',
  13294. 'check',
  13295. 'cluster',
  13296. 'column',
  13297. 'comment',
  13298. 'compress',
  13299. 'connect',
  13300. 'create',
  13301. 'current',
  13302. 'date',
  13303. 'decimal',
  13304. 'default',
  13305. 'delete',
  13306. 'desc',
  13307. 'distinct',
  13308. 'drop',
  13309. 'else',
  13310. 'exclusive',
  13311. 'exists',
  13312. 'file',
  13313. 'float',
  13314. 'for',
  13315. 'from',
  13316. 'grant',
  13317. 'group',
  13318. 'having',
  13319. 'identified',
  13320. 'immediate',
  13321. 'in',
  13322. 'increment',
  13323. 'index',
  13324. 'initial',
  13325. 'insert',
  13326. 'integer',
  13327. 'intersect',
  13328. 'into',
  13329. 'is',
  13330. 'level',
  13331. 'like',
  13332. 'lock',
  13333. 'long',
  13334. 'maxextents',
  13335. 'minus',
  13336. 'mlslabel',
  13337. 'mode',
  13338. 'modify',
  13339. 'noaudit',
  13340. 'nocompress',
  13341. 'not',
  13342. 'nowait',
  13343. 'null',
  13344. 'number',
  13345. 'of',
  13346. 'offline',
  13347. 'on',
  13348. 'online',
  13349. 'option',
  13350. 'or',
  13351. 'order',
  13352. 'p',
  13353. 'ctfree',
  13354. 'prior',
  13355. 'privileges',
  13356. 'public',
  13357. 'raw',
  13358. 'rename',
  13359. 'resource',
  13360. 'revoke',
  13361. 'row',
  13362. 'rowid',
  13363. 'rownum',
  13364. 'rows',
  13365. 'select',
  13366. 'session',
  13367. 'set',
  13368. 'share',
  13369. 'size',
  13370. 'smallint',
  13371. 'start',
  13372. 'successful',
  13373. 'synonym',
  13374. 'sysdate',
  13375. 'table',
  13376. 'then',
  13377. 'to',
  13378. 'trigger',
  13379. 'uid',
  13380. 'union',
  13381. 'unique',
  13382. 'update',
  13383. 'user',
  13384. 'validate',
  13385. 'values',
  13386. 'varchar',
  13387. 'varchar2',
  13388. 'view',
  13389. 'whenever',
  13390. 'where',
  13391. 'with'];
  13392. return _$2.includes(kk, word.toLowerCase());
  13393. }
  13394. //# sourceMappingURL=DbUtils.js.map
  13395. var DbSync = /** @class */ (function (_super) {
  13396. __extends(DbSync, _super);
  13397. function DbSync() {
  13398. return _super.call(this, { model: model$d, vjson: vjson$d }) || this;
  13399. }
  13400. DbSync.prototype.onLoad = function () {
  13401. };
  13402. DbSync.prototype.getDataBaseName = function (sender, _a) {
  13403. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  13404. getDataBaseNameApi().then(function (res) {
  13405. successCallback(res.data.map(function (name) {
  13406. return {
  13407. id: name, text: name
  13408. };
  13409. }));
  13410. });
  13411. };
  13412. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  13413. showInfoDialog(record.get('remark'));
  13414. };
  13415. DbSync.prototype.diff = function () {
  13416. var _this = this;
  13417. var promise1 = getMateData({
  13418. datasource: this.viewModel.get('dataSource1')
  13419. });
  13420. var promise2 = getMateData({
  13421. datasource: this.viewModel.get('dataSource2')
  13422. });
  13423. this.viewModel.set('schema1', '');
  13424. this.viewModel.set('schema2', '');
  13425. this.refs.grid1.setLoading(true);
  13426. Promise.all([promise1, promise2]).then(function (_a) {
  13427. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13428. var rows = [];
  13429. if (_$2.size(res1) > 0) {
  13430. // res1 起码有一个 schema
  13431. _this.viewModel.set('schema1', res1[0].schema_name);
  13432. _this.viewModel.set('schema2', res2[0].schema_name);
  13433. if (!_this.viewModel.get('schema1')) {
  13434. msg$1('datasource1 最起码需要一张表');
  13435. return;
  13436. }
  13437. if (!_this.viewModel.get('schema2')) {
  13438. msg$1('datasource2 最起码需要一张表');
  13439. return;
  13440. }
  13441. _$2.forEach(res1[0].table_list, function (table1) {
  13442. var _a;
  13443. 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; });
  13444. if (table1.schema_name) {
  13445. _this.viewModel.set('schema1', table1.schema_name);
  13446. }
  13447. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  13448. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  13449. }
  13450. var row = {
  13451. table_name1: table1.table_name,
  13452. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  13453. table_info: table1
  13454. };
  13455. if (!table2) {
  13456. row.diff = '不一致';
  13457. row.remark = '目标表缺失';
  13458. }
  13459. else if (table1.column_list.length !== table2.column_list.length) {
  13460. row.diff = '不一致';
  13461. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  13462. }
  13463. else {
  13464. row.diff = '一致';
  13465. var remark_1 = [];
  13466. _$2.forEach(table1.column_list, function (col1) {
  13467. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  13468. if (!col2) {
  13469. row.diff = '不一致';
  13470. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  13471. }
  13472. else {
  13473. var colDiff = compareColumn(table1, col1, table2, col2);
  13474. if (colDiff) {
  13475. row.diff = '不一致';
  13476. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  13477. }
  13478. }
  13479. });
  13480. row.remark = remark_1.join('\n');
  13481. }
  13482. rows.push(row);
  13483. });
  13484. }
  13485. _this.refs.grid1.setData(rows);
  13486. _this.viewModel.set('hasDiff', true);
  13487. }).finally(function () {
  13488. _this.refs.grid1.setLoading(false);
  13489. });
  13490. };
  13491. DbSync.prototype.structCopyTo = function () {
  13492. var _this = this;
  13493. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13494. msg$1('选择数据源!');
  13495. return;
  13496. }
  13497. var recordList = this.refs.grid1.getSelection();
  13498. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13499. if (_$2.size(tableNameList) <= 0) {
  13500. msg$1('请选择要同步的表');
  13501. return;
  13502. }
  13503. var error = undefined;
  13504. _$2.forEach(tableNameList, function (tableInfo) {
  13505. _$2.forEach(tableInfo.column_list, function (col) {
  13506. error = checkColumn(tableInfo, col);
  13507. return false;
  13508. });
  13509. if (error) {
  13510. return false;
  13511. }
  13512. });
  13513. if (error) {
  13514. msg$1(error);
  13515. return;
  13516. }
  13517. var schema1 = this.viewModel.get('schema1');
  13518. var schema2 = this.viewModel.get('schema2');
  13519. if (!schema1 || !schema2) {
  13520. msg$1('无法识别 schema 名称');
  13521. return;
  13522. }
  13523. this.refs.grid1.setLoading(true);
  13524. getDiffDDLApi({
  13525. datasource1: this.viewModel.get('dataSource1'),
  13526. datasource2: this.viewModel.get('dataSource2'),
  13527. schema1: this.viewModel.get('schema1'),
  13528. schema2: this.viewModel.get('schema2'),
  13529. tables: tableNameList,
  13530. }).then(function (res) {
  13531. if (res.success) {
  13532. _this.refs.ddleditor.setCode(res.data);
  13533. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  13534. }
  13535. }).finally(function () {
  13536. _this.refs.grid1.setLoading(false);
  13537. });
  13538. };
  13539. DbSync.prototype.indexCopyTo = function () {
  13540. var _this = this;
  13541. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13542. msg$1('选择数据源!');
  13543. return;
  13544. }
  13545. var recordList = this.refs.grid1.getSelection();
  13546. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13547. if (_$2.size(tableNameList) <= 0) {
  13548. msg$1('请选择要同步的表');
  13549. return;
  13550. }
  13551. var schema1 = this.viewModel.get('schema1');
  13552. var schema2 = this.viewModel.get('schema2');
  13553. if (!schema1 || !schema2) {
  13554. msg$1('无法识别 schema 名称');
  13555. return;
  13556. }
  13557. this.refs.grid1.setLoading(true);
  13558. getModifyIdxDDL({
  13559. datasource1: this.viewModel.get('dataSource1'),
  13560. datasource2: this.viewModel.get('dataSource2'),
  13561. schema1: this.viewModel.get('schema1'),
  13562. schema2: this.viewModel.get('schema2'),
  13563. tables: tableNameList,
  13564. }).then(function (res) {
  13565. if (res.success) {
  13566. _this.refs.ddleditor_idx.setCode(res.data);
  13567. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  13568. }
  13569. }).finally(function () {
  13570. _this.refs.grid1.setLoading(false);
  13571. });
  13572. };
  13573. DbSync.prototype.procedureCopyTo = function () {
  13574. var _this = this;
  13575. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13576. msg$1('选择数据源!');
  13577. return;
  13578. }
  13579. var schema1 = this.viewModel.get('schema1');
  13580. var schema2 = this.viewModel.get('schema2');
  13581. if (!schema1 || !schema2) {
  13582. msg$1('无法识别 schema 名称');
  13583. return;
  13584. }
  13585. this.refs.grid1.setLoading(true);
  13586. getModifyProcedureSQL({
  13587. datasource1: this.viewModel.get('dataSource1'),
  13588. datasource2: this.viewModel.get('dataSource2'),
  13589. schema1: this.viewModel.get('schema1'),
  13590. schema2: this.viewModel.get('schema2'),
  13591. }).then(function (res) {
  13592. if (res.success) {
  13593. _this.refs.ddleditor_procedure.setCode(res.data);
  13594. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  13595. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  13596. }
  13597. }).finally(function () {
  13598. _this.refs.grid1.setLoading(false);
  13599. });
  13600. };
  13601. DbSync.prototype.dataSync_start = function () {
  13602. var _this = this;
  13603. this.viewModel.set('dataSync_isStart', true);
  13604. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  13605. this.refs.datacopy.setLoading(true);
  13606. dataSyncApi(dataSync)
  13607. .then(function (res) {
  13608. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  13609. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  13610. })
  13611. .finally(function () {
  13612. _this.refs.datacopy.setLoading(false);
  13613. });
  13614. };
  13615. DbSync.prototype.dataSync_process = function () {
  13616. var _this = this;
  13617. var jobId = this.viewModel.get('dataSyncResult.jobId');
  13618. dataSyncInfoApi({ jobId: jobId })
  13619. .then(function (res) {
  13620. if (_$2.isArray(res.tableSyncInfos)) {
  13621. var scrollPosition = _this.refs.datacopy.scrollable.position;
  13622. _this.refs.datacopy.setData(res.tableSyncInfos);
  13623. try {
  13624. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  13625. }
  13626. catch (e) {
  13627. }
  13628. }
  13629. if (res.endTime) {
  13630. // 已经结束
  13631. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  13632. if (res.success) {
  13633. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13634. }
  13635. else {
  13636. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13637. }
  13638. _this.dataSync_stop();
  13639. }
  13640. })
  13641. .catch(function (e) {
  13642. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  13643. console.error(e);
  13644. // this.dataSync_stop()
  13645. })
  13646. .finally(function () {
  13647. _this.refs.datacopy.setLoading(false);
  13648. });
  13649. };
  13650. DbSync.prototype.dataSync_stop = function () {
  13651. this.viewModel.set('dataSync_isStart', false);
  13652. clearInterval(this.dataSyncInterval);
  13653. delete this.dataSyncInterval;
  13654. };
  13655. DbSync.prototype.dataCopyTo = function () {
  13656. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13657. msg$1('选择数据源!');
  13658. return;
  13659. }
  13660. var recordList = this.refs.grid1.getSelection();
  13661. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13662. if (_$2.size(tableNameList) <= 0) {
  13663. msg$1('请选择要同步的表');
  13664. return;
  13665. }
  13666. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  13667. this.viewModel.set('dataSync.tables', tableNameList);
  13668. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  13669. };
  13670. DbSync.prototype.next = function () {
  13671. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  13672. };
  13673. DbSync.prototype.back = function () {
  13674. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  13675. };
  13676. DbSync.prototype.dbToMeta = function () {
  13677. var _this = this;
  13678. var dataSource1 = this.viewModel.get('dataSource1');
  13679. var dataSource2 = this.viewModel.get('dataSource2');
  13680. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  13681. var promise1 = dbToMeta({ datasource: dataSource1 });
  13682. var promise2 = dbToMeta({ datasource: dataSource2 });
  13683. _this.refs.grid1.setLoading(true);
  13684. Promise.all([promise1, promise2]).then(function (_a) {
  13685. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13686. _this.diff();
  13687. }).catch(function (res) {
  13688. _this.refs.grid1.setLoading(false);
  13689. showErrorDialog$1(res);
  13690. });
  13691. });
  13692. };
  13693. DbSync.prototype.executeDDL = function () {
  13694. var _this = this;
  13695. var code = this.refs.ddleditor.getValue();
  13696. var dataSource2 = this.viewModel.get('dataSource2');
  13697. var target_schema_name = this.viewModel.get('schema2');
  13698. var recordList = this.refs.grid1.getSelection();
  13699. var table_infos = _$2.map(recordList, function (r) {
  13700. return r.get('table_info');
  13701. });
  13702. this.setLoading(true);
  13703. pushToDbCommitApi({
  13704. datasource: dataSource2,
  13705. ddl: code,
  13706. table_infos: table_infos,
  13707. target_schema_name: target_schema_name,
  13708. }).then(function (res) {
  13709. if (res === null || res === void 0 ? void 0 : res.success) {
  13710. msg$1('执行成功');
  13711. _this.back();
  13712. _this.diff();
  13713. return;
  13714. }
  13715. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13716. }).finally(function () {
  13717. _this.setLoading(false);
  13718. });
  13719. };
  13720. DbSync.prototype.executeDDLIdx = function () {
  13721. var _this = this;
  13722. var code = this.refs.ddleditor_idx.getValue();
  13723. var dataSource2 = this.viewModel.get('dataSource2');
  13724. this.setLoading(true);
  13725. executeDDL({
  13726. datasource: dataSource2,
  13727. ddl: code,
  13728. }).then(function (res) {
  13729. if (res === null || res === void 0 ? void 0 : res.success) {
  13730. msg$1('执行成功');
  13731. _this.back();
  13732. return;
  13733. }
  13734. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13735. }).finally(function () {
  13736. _this.setLoading(false);
  13737. });
  13738. };
  13739. DbSync.prototype.executeProcedureSQL = function () {
  13740. var _this = this;
  13741. this.setLoading(true);
  13742. executeModifyProcedureSQL({
  13743. datasource1: this.viewModel.get('dataSource1'),
  13744. datasource2: this.viewModel.get('dataSource2'),
  13745. schema1: this.viewModel.get('schema1'),
  13746. schema2: this.viewModel.get('schema2'),
  13747. }).then(function (res) {
  13748. if (res === null || res === void 0 ? void 0 : res.success) {
  13749. msg$1('执行成功');
  13750. _this.back();
  13751. return;
  13752. }
  13753. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13754. }).finally(function () {
  13755. _this.setLoading(false);
  13756. });
  13757. };
  13758. return DbSync;
  13759. }(Scope));
  13760. //# sourceMappingURL=DbSync.js.map
  13761. var model$e = {
  13762. data: {}
  13763. };
  13764. //# sourceMappingURL=DbCodeTemplate.model.js.map
  13765. var vjson$e = {
  13766. title: '示例代码',
  13767. layout: 'fit',
  13768. items: [
  13769. {
  13770. layout: 'border',
  13771. items: [
  13772. {
  13773. region: 'north',
  13774. split: true,
  13775. height: 200,
  13776. title: '表格数据',
  13777. reference: 'dataeditor',
  13778. xtype: 'jsoneditor',
  13779. listeners: {
  13780. change: 'scope.dataChanged'
  13781. },
  13782. },
  13783. {
  13784. region: 'west',
  13785. split: true,
  13786. width: 230,
  13787. title: '模板',
  13788. reference: 'tree1',
  13789. xtype: 'treepanel',
  13790. rootVisible: false,
  13791. useArrows: true,
  13792. colspan: 2,
  13793. lines: true,
  13794. multiSelect: false,
  13795. listeners: {
  13796. itemclick: 'scope.templateChange',
  13797. },
  13798. },
  13799. {
  13800. region: 'center',
  13801. title: '参考代码',
  13802. reference: 'preview',
  13803. xtype: 'jsoneditor',
  13804. },
  13805. ]
  13806. }
  13807. ]
  13808. };
  13809. //# sourceMappingURL=DbCodeTemplate.view.js.map
  13810. var rootNode = {
  13811. id: 'ROOT',
  13812. type: "ROOT",
  13813. path: "",
  13814. expanded: true,
  13815. leaf: false,
  13816. children: [
  13817. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  13818. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  13819. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  13820. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  13821. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  13822. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  13823. ],
  13824. };
  13825. var TemplateDev = /** @class */ (function (_super) {
  13826. __extends(TemplateDev, _super);
  13827. function TemplateDev() {
  13828. var _this = _super.call(this, { model: model$e, vjson: vjson$e }) || this;
  13829. _this.dataChanged = _$2.debounce(function () {
  13830. var me = _this;
  13831. if (me.refs.tree1.selection) {
  13832. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  13833. }
  13834. }, 50);
  13835. return _this;
  13836. }
  13837. TemplateDev.prototype.onDestroy = function () {
  13838. setDbCode(undefined);
  13839. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  13840. };
  13841. TemplateDev.prototype.onLoad = function () {
  13842. setDbCode(this);
  13843. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  13844. this.refs.tree1.setRootNode(rootNode);
  13845. getColumnDomainApi({}).then(function (_a) {
  13846. var data = _a.data;
  13847. return window['dev_column_domain'] = data;
  13848. });
  13849. };
  13850. TemplateDev.prototype.dbTreeNodeChange = function () {
  13851. var me = handles$1.dbcode;
  13852. var tables = [];
  13853. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  13854. var raw = _$2.cloneDeep(r.get('raw'));
  13855. raw.id = r.get('id');
  13856. if (r.get('type') === 'table') {
  13857. tables.push(raw);
  13858. return;
  13859. }
  13860. if (r.get('type') === 'column') {
  13861. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  13862. if (!tableInfo) {
  13863. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  13864. tables.push(tableInfo);
  13865. }
  13866. if (!tableInfo.column_list) {
  13867. tableInfo.column_list = [raw];
  13868. }
  13869. else {
  13870. tableInfo.column_list.push(raw);
  13871. }
  13872. }
  13873. });
  13874. // 对于没有选择列的表格,默认加上所有列
  13875. _$2.forEach(tables, function (tableInfo) {
  13876. if (typeof tableInfo.column_list === 'undefined') {
  13877. tableInfo.column_list = [];
  13878. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  13879. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  13880. });
  13881. }
  13882. });
  13883. var code = JSON.stringify(tables, null, ' ');
  13884. me.refs.dataeditor.setCode(code);
  13885. };
  13886. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  13887. var url = record.data.url;
  13888. var rd = _$2.uniqueId('db_code_request');
  13889. if (url) {
  13890. var data = void 0;
  13891. try {
  13892. data = JSON.parse(this.refs.dataeditor.getCode());
  13893. }
  13894. catch (e) {
  13895. return;
  13896. }
  13897. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  13898. // if (typeof node.default === "function") {
  13899. // const v = toString(node.default(data))
  13900. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  13901. // this.refs.preview.setLanguage("plaintext")
  13902. // this.refs.preview.setCode(v)
  13903. // }
  13904. // })
  13905. showErrorDialog$1('没做这里');
  13906. }
  13907. };
  13908. return TemplateDev;
  13909. }(Scope));
  13910. //# sourceMappingURL=DbCodeTemplate.js.map
  13911. var model$f = {
  13912. data: {
  13913. hasChanged: false,
  13914. }
  13915. };
  13916. //# sourceMappingURL=DbDomain.model.js.map
  13917. var vjson$f = {
  13918. bind: {
  13919. title: '字段域{grid1.ischanged?" *":""}',
  13920. },
  13921. layout: 'fit',
  13922. items: [
  13923. {
  13924. layout: 'border',
  13925. items: [
  13926. {
  13927. region: 'center',
  13928. xtype: 'yvgrid',
  13929. selModel: {
  13930. type: 'spreadsheet',
  13931. columnSelect: true,
  13932. pruneRemoved: false,
  13933. extensible: 'y'
  13934. },
  13935. plugins: {
  13936. clipboard: true,
  13937. selectionreplicator: true
  13938. },
  13939. reference: 'grid1',
  13940. pagination: false,
  13941. tbar: {
  13942. xtype: 'toolbar',
  13943. items: [
  13944. {
  13945. xtype: 'button',
  13946. text: '添加',
  13947. iconCls: 'x-fa fa-plus-circle',
  13948. listeners: {
  13949. click: 'scope.addField'
  13950. }
  13951. },
  13952. {
  13953. xtype: 'button',
  13954. text: '删除',
  13955. iconCls: 'x-fa fa-minus-circle',
  13956. listeners: {
  13957. click: 'scope.removeField'
  13958. }
  13959. },
  13960. {
  13961. xtype: 'button',
  13962. text: '保存',
  13963. iconCls: 'x-fa fa-save',
  13964. bind: {
  13965. disabled: '{!grid1.ischanged}'
  13966. },
  13967. listeners: {
  13968. click: 'scope.save'
  13969. }
  13970. },
  13971. ]
  13972. },
  13973. listeners: {
  13974. editfinish: 'scope.gridEditFinish',
  13975. },
  13976. columns: [
  13977. {
  13978. text: '字段域名称', dataIndex: 'domain_name',
  13979. sortable: false,
  13980. menuDisabled: true,
  13981. locked: true,
  13982. editor: {
  13983. selectOnFocus: true
  13984. }
  13985. },
  13986. {
  13987. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  13988. sortable: false, menuDisabled: true,
  13989. editor: {
  13990. selectOnFocus: true
  13991. }
  13992. },
  13993. {
  13994. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  13995. sortable: false, menuDisabled: true,
  13996. editor: {
  13997. selectOnFocus: true
  13998. }
  13999. },
  14000. {
  14001. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  14002. sortable: false, menuDisabled: true,
  14003. editor: {
  14004. selectOnFocus: true
  14005. }
  14006. },
  14007. {
  14008. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  14009. sortable: false, menuDisabled: true,
  14010. editor: {
  14011. selectOnFocus: true
  14012. }
  14013. },
  14014. {
  14015. text: 'Java类型', dataIndex: 'java_datatype',
  14016. sortable: false, menuDisabled: true,
  14017. editor: {
  14018. selectOnFocus: true
  14019. }
  14020. },
  14021. {
  14022. text: '固定长度', dataIndex: 'is_fix_size',
  14023. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14024. width: 88, resizable: false,
  14025. },
  14026. {
  14027. text: '长度', dataIndex: 'column_size',
  14028. sortable: false, menuDisabled: true, dataType: 'int',
  14029. xtype: 'numbercolumn', format: '0',
  14030. editor: { selectOnFocus: true }
  14031. },
  14032. {
  14033. text: '小数位', dataIndex: 'decimal_digits',
  14034. sortable: false, menuDisabled: true, dataType: 'int',
  14035. xtype: 'numbercolumn', format: '0',
  14036. editor: { selectOnFocus: true }
  14037. },
  14038. {
  14039. text: '字典', dataIndex: 'domain_column_dict',
  14040. sortable: false, menuDisabled: true,
  14041. // fix: ['system.getDict("DICT")'],
  14042. width: 200,
  14043. editor: {
  14044. xtype: 'combo',
  14045. listConfig: {
  14046. minWidth: 350
  14047. },
  14048. }
  14049. },
  14050. {
  14051. text: '固定默认值', dataIndex: 'is_fix_default_value',
  14052. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14053. width: 88, resizable: false,
  14054. },
  14055. {
  14056. text: '默认值', dataIndex: 'default_value',
  14057. sortable: false, menuDisabled: true,
  14058. editor: {
  14059. selectOnFocus: true
  14060. }
  14061. },
  14062. {
  14063. text: 'UI建议', dataIndex: 'domain_column_ui',
  14064. sortable: false, menuDisabled: true,
  14065. // fix: ['system.getDict("column_ui")'],
  14066. editor: {
  14067. xtype: 'combo',
  14068. allowBlank: true,
  14069. listConfig: {
  14070. minWidth: 200
  14071. },
  14072. }
  14073. },
  14074. {
  14075. text: '详细描述', dataIndex: 'domain_note',
  14076. sortable: false, menuDisabled: true,
  14077. editor: {}
  14078. },
  14079. {
  14080. text: '责任人', dataIndex: 'domain_person',
  14081. sortable: false, menuDisabled: true,
  14082. editor: {
  14083. selectOnFocus: true
  14084. }
  14085. },
  14086. {
  14087. text: '版本', dataIndex: 'domain_version',
  14088. sortable: false, menuDisabled: true,
  14089. editor: {
  14090. selectOnFocus: true
  14091. }
  14092. },
  14093. ]
  14094. }
  14095. ]
  14096. },
  14097. ]
  14098. };
  14099. //# sourceMappingURL=DbDomain.view.js.map
  14100. // 字段域数据
  14101. var columnDomain = undefined;
  14102. var DomainStore = /** @class */ (function (_super) {
  14103. __extends(DomainStore, _super);
  14104. function DomainStore() {
  14105. return _super !== null && _super.apply(this, arguments) || this;
  14106. }
  14107. DomainStore.prototype.getCacheKey = function (param) {
  14108. return "domain_data.json";
  14109. };
  14110. DomainStore.prototype.invokeApi = function (param) {
  14111. return getColumnDomainApi();
  14112. };
  14113. /**
  14114. * 设置全局可访问的 字段域数据
  14115. */
  14116. DomainStore.prototype.getColumnDomainComboData = function () {
  14117. var _this = this;
  14118. return new Promise(function (resolve) {
  14119. _this.reloadIfNeedPromise(undefined).then(function (res) {
  14120. resolve(_this.apiResponse.data.map(function (v) {
  14121. return { id: v.domain_id, text: v.domain_name };
  14122. }));
  14123. });
  14124. });
  14125. };
  14126. /**
  14127. * 设置全局可访问的 字段域数据
  14128. */
  14129. DomainStore.prototype.getColumnDomainById = function (value) {
  14130. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  14131. };
  14132. DomainStore.prototype.getAllDomain = function () {
  14133. return new Promise(function (resolve, reject) {
  14134. getColumnDomainApi()
  14135. .then(function (res) {
  14136. if (res.success) {
  14137. columnDomain = res.data;
  14138. resolve(res.data);
  14139. }
  14140. else {
  14141. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  14142. console.error('getColumnDomain', res.msg);
  14143. }
  14144. })
  14145. .catch(function (e) {
  14146. window['showErrorDialog']('getColumnDomain error!');
  14147. console.error('getColumnDomain', e);
  14148. reject(e);
  14149. });
  14150. });
  14151. };
  14152. return DomainStore;
  14153. }(CacheStore));
  14154. var instance$3 = new DomainStore();
  14155. //# sourceMappingURL=DomainStore.js.map
  14156. var DbDomain = /** @class */ (function (_super) {
  14157. __extends(DbDomain, _super);
  14158. function DbDomain() {
  14159. return _super.call(this, { model: model$f, vjson: vjson$f }) || this;
  14160. }
  14161. DbDomain.prototype.onLoad = function () {
  14162. var _this = this;
  14163. instance$3.getAllDomain().then(function (data) {
  14164. _this.refs.grid1.setData(data);
  14165. });
  14166. };
  14167. DbDomain.prototype.gridEditFinish = function () {
  14168. this.viewModel.set('hasChanged', true);
  14169. };
  14170. DbDomain.prototype.addField = function () {
  14171. this.refs.grid1.appendEditRow({
  14172. domainName: '',
  14173. pgSqlDataType: '',
  14174. mysqlDataType: '',
  14175. oracleDataType: '',
  14176. sqlserverDataType: '',
  14177. javaDataType: '',
  14178. isFixSize: true,
  14179. size: '',
  14180. decimalDigits: '',
  14181. isFixDefaultValue: false,
  14182. defaultValue: null,
  14183. domainColumnDict: '',
  14184. domainColumnUI: '',
  14185. note: '',
  14186. domainPerson: '',
  14187. domainVersion: '',
  14188. }, 0);
  14189. };
  14190. DbDomain.prototype.removeField = function () {
  14191. var _this = this;
  14192. var rows = [];
  14193. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  14194. rows.push(r);
  14195. });
  14196. _.forEach(rows, function (r) {
  14197. _this.refs.grid1.getStore().remove(r);
  14198. });
  14199. };
  14200. DbDomain.prototype.save = function () {
  14201. var _this = this;
  14202. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  14203. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  14204. if (err) {
  14205. // 如果有异常就不保存
  14206. return;
  14207. }
  14208. // 进行业务上的逻辑校验,比如说必填校验等等
  14209. var hasError = false;
  14210. _.forEach(rows, function (row, i) {
  14211. if (isEmpty(row.domain_name)) {
  14212. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  14213. hasError = true;
  14214. return false;
  14215. }
  14216. if (isEmpty(row.pgsql_datatype) ||
  14217. isEmpty(row.mysql_datatype) ||
  14218. isEmpty(row.oracle_datatype) ||
  14219. isEmpty(row.sqlserver_datatype)) {
  14220. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  14221. hasError = true;
  14222. return false;
  14223. }
  14224. });
  14225. if (hasError) {
  14226. return;
  14227. }
  14228. // 设置当前界面为 "保存中..." 状态
  14229. this.setLoading(true);
  14230. saveColumnDomain({
  14231. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  14232. newRows: newRows,
  14233. modifyRows: modifyRows,
  14234. removeRecords: removeRecords,
  14235. }).then(function (res) {
  14236. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  14237. system.msg(res.msg);
  14238. instance$3.reloadForce({}).then(function () {
  14239. instance$3.getAllDomain().then(function (data) {
  14240. _this.refs.grid1.setData(data);
  14241. });
  14242. }).finally(function () {
  14243. // 无论正常异常,关闭 "保存中..." 状态
  14244. _this.setLoading(false);
  14245. });
  14246. }).catch(function (e) {
  14247. // 无论正常异常,关闭 "保存中..." 状态
  14248. _this.setLoading(false);
  14249. });
  14250. };
  14251. return DbDomain;
  14252. }(Scope));
  14253. //# sourceMappingURL=DbDomain.js.map
  14254. var model$g = {
  14255. data: {
  14256. report_id: '',
  14257. report_name: '',
  14258. report_enable: false,
  14259. report: {
  14260. dataSource: '',
  14261. grid: {
  14262. pagination: true,
  14263. },
  14264. query: [],
  14265. columns: [],
  14266. summary: [],
  14267. },
  14268. querySql: '',
  14269. summarySql: '',
  14270. createAt: '',
  14271. createBy: '',
  14272. updateAt: '',
  14273. updateBy: '',
  14274. }
  14275. };
  14276. //# sourceMappingURL=ReportDesign.model.js.map
  14277. var vjson$g = {
  14278. bind: {
  14279. title: '报表-{report_name}',
  14280. },
  14281. layout: 'fit',
  14282. items: [
  14283. {
  14284. layout: 'border',
  14285. items: [
  14286. {
  14287. region: 'north',
  14288. items: [
  14289. {
  14290. xtype: 'toolbar',
  14291. border: false,
  14292. items: [
  14293. {
  14294. xtype: 'button',
  14295. text: '刷新',
  14296. iconCls: 'x-fa fa-refresh',
  14297. listeners: {
  14298. click: 'scope.load'
  14299. }
  14300. },
  14301. {
  14302. xtype: 'button',
  14303. text: '保存',
  14304. iconCls: 'x-fa fa-save',
  14305. listeners: {
  14306. click: 'scope.save'
  14307. }
  14308. },
  14309. {
  14310. xtype: 'button',
  14311. text: '预览',
  14312. iconCls: 'x-fa fa-play-circle-o',
  14313. listeners: {
  14314. click: 'scope.preview'
  14315. }
  14316. },
  14317. {
  14318. xtype: 'textfield',
  14319. fieldLabel: '报表名称',
  14320. flex: 1,
  14321. bind: {
  14322. value: '{report_name}'
  14323. }
  14324. },
  14325. {
  14326. xtype: 'checkbox',
  14327. fieldLabel: '启用报表',
  14328. checkedValue: 1,
  14329. uncheckedValue: 0,
  14330. bind: {
  14331. value: '{report_enable}'
  14332. }
  14333. },
  14334. {
  14335. xtype: 'checkbox',
  14336. fieldLabel: '启用分页',
  14337. bind: {
  14338. value: '{report.grid.pagination}'
  14339. }
  14340. },
  14341. {
  14342. xtype: 'textfield',
  14343. fieldLabel: '数据源',
  14344. flex: 1,
  14345. bind: {
  14346. value: '{report.dataSource}'
  14347. }
  14348. },
  14349. ]
  14350. }
  14351. ]
  14352. },
  14353. {
  14354. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  14355. items: [
  14356. {
  14357. title: 'SQL和查询条件',
  14358. layout: 'border',
  14359. border: false,
  14360. items: [
  14361. {
  14362. region: 'north',
  14363. height: 200,
  14364. border: false,
  14365. split: true,
  14366. xtype: 'yvgrid',
  14367. reference: 'gridCondition',
  14368. pagination: false,
  14369. hideFootbar: true,
  14370. plugins: {
  14371. clipboard: true,
  14372. selectionreplicator: true
  14373. },
  14374. selModel: {
  14375. type: 'spreadsheet',
  14376. columnSelect: false,
  14377. pruneRemoved: false,
  14378. extensible: 'y'
  14379. },
  14380. tbar: {
  14381. xtype: 'toolbar',
  14382. border: false,
  14383. items: [
  14384. {
  14385. xtype: 'button',
  14386. text: '添加条件',
  14387. iconCls: 'x-fa fa-plus-circle',
  14388. listeners: {
  14389. click: 'scope.addCondition'
  14390. }
  14391. },
  14392. {
  14393. xtype: 'button',
  14394. text: '删除条件',
  14395. iconCls: 'x-fa fa-minus-circle',
  14396. listeners: {
  14397. click: 'scope.removeCondition'
  14398. }
  14399. },
  14400. '-',
  14401. {
  14402. xtype: 'button',
  14403. text: '自动分析条件变量',
  14404. iconCls: 'x-fa fa-code-fork',
  14405. listeners: {
  14406. click: 'scope.calcCondition'
  14407. }
  14408. },
  14409. {
  14410. xtype: 'button',
  14411. text: '上移',
  14412. iconCls: 'x-fa fa-arrow-up',
  14413. listeners: {
  14414. click: 'scope.moveUp'
  14415. }
  14416. },
  14417. {
  14418. xtype: 'button',
  14419. text: '下移',
  14420. iconCls: 'x-fa fa-arrow-down',
  14421. listeners: {
  14422. click: 'scope.moveDown'
  14423. }
  14424. },
  14425. ]
  14426. },
  14427. columns: [
  14428. {
  14429. text: '条件变量',
  14430. dataIndex: 'conditionFieldBind',
  14431. width: 140,
  14432. sortable: false,
  14433. menuDisabled: true,
  14434. editor: {
  14435. selectOnFocus: true
  14436. },
  14437. },
  14438. {
  14439. text: '中文标题',
  14440. dataIndex: 'conditionFieldLabel',
  14441. width: 120,
  14442. sortable: false,
  14443. menuDisabled: true,
  14444. editor: {
  14445. selectOnFocus: true
  14446. },
  14447. },
  14448. {
  14449. text: '编辑类型',
  14450. dataIndex: 'conditionFieldXtype',
  14451. width: 80,
  14452. sortable: false,
  14453. menuDisabled: true,
  14454. editor: {
  14455. xtype: 'combo',
  14456. typeAhead: true,
  14457. triggerAction: 'all',
  14458. selectOnFocus: true,
  14459. store: [
  14460. ['textfield', 'textfield'],
  14461. ['combo', 'combo'],
  14462. ['datefield', 'datefield'],
  14463. ['datetimefield', 'datetimefield'],
  14464. ['numberfield', 'numberfield'],
  14465. ['multiplesearch', 'multiplesearch'],
  14466. ]
  14467. }
  14468. },
  14469. {
  14470. text: '权重',
  14471. dataIndex: 'conditionFieldFlex',
  14472. align: 'right',
  14473. width: 60,
  14474. sortable: false,
  14475. menuDisabled: true,
  14476. editor: {
  14477. xtype: 'numberfield',
  14478. selectOnFocus: false,
  14479. minValue: 0,
  14480. maxValue: 10
  14481. },
  14482. },
  14483. {
  14484. text: '字典',
  14485. dataIndex: 'conditionFieldDict',
  14486. width: 160,
  14487. sortable: false,
  14488. menuDisabled: true,
  14489. editor: {
  14490. selectOnFocus: false
  14491. },
  14492. },
  14493. {
  14494. xtype: 'checkcolumn',
  14495. dataIndex: "conditionFieldWrap", header: "换行",
  14496. width: 65,
  14497. sortable: false,
  14498. menuDisabled: true,
  14499. },
  14500. {
  14501. text: '扩展参数',
  14502. dataIndex: 'conditionFieldExtend',
  14503. sortable: false,
  14504. menuDisabled: true,
  14505. editor: {
  14506. selectOnFocus: false
  14507. },
  14508. },
  14509. ]
  14510. },
  14511. {
  14512. region: 'center',
  14513. xtype: 'sqleditor',
  14514. layout: 'fit',
  14515. reference: 'sqlEditor',
  14516. split: true,
  14517. },
  14518. ]
  14519. },
  14520. {
  14521. title: '查询结果字段',
  14522. xtype: 'yvgrid',
  14523. reference: 'gridColumn',
  14524. pagination: false,
  14525. hideFootbar: true,
  14526. border: false,
  14527. plugins: {
  14528. clipboard: true,
  14529. selectionreplicator: true
  14530. },
  14531. selModel: {
  14532. type: 'spreadsheet',
  14533. columnSelect: false,
  14534. pruneRemoved: false,
  14535. extensible: 'y'
  14536. },
  14537. tbar: {
  14538. xtype: 'toolbar',
  14539. items: [
  14540. {
  14541. xtype: 'button',
  14542. text: '添加',
  14543. iconCls: 'x-fa fa-plus-circle',
  14544. listeners: {
  14545. click: 'scope.addColumn'
  14546. }
  14547. },
  14548. {
  14549. xtype: 'button',
  14550. text: '删除',
  14551. iconCls: 'x-fa fa-minus-circle',
  14552. listeners: {
  14553. click: 'scope.removeColumn'
  14554. }
  14555. },
  14556. '-',
  14557. {
  14558. xtype: 'button',
  14559. text: '自动分析',
  14560. iconCls: 'x-fa fa-code-fork',
  14561. listeners: {
  14562. click: 'scope.calcColumn'
  14563. }
  14564. },
  14565. {
  14566. xtype: 'button',
  14567. text: '上移',
  14568. iconCls: 'x-fa fa-arrow-up',
  14569. listeners: {
  14570. click: 'scope.moveUp'
  14571. }
  14572. },
  14573. {
  14574. xtype: 'button',
  14575. text: '下移',
  14576. iconCls: 'x-fa fa-arrow-down',
  14577. listeners: {
  14578. click: 'scope.moveDown'
  14579. }
  14580. },
  14581. ]
  14582. },
  14583. columns: [
  14584. { xtype: 'rownumberer' },
  14585. {
  14586. text: '字段',
  14587. dataIndex: 'dataIndex',
  14588. width: 140,
  14589. sortable: false,
  14590. menuDisabled: true,
  14591. editor: {
  14592. selectOnFocus: true
  14593. },
  14594. },
  14595. {
  14596. text: '标题',
  14597. dataIndex: 'header',
  14598. width: 120,
  14599. sortable: false,
  14600. menuDisabled: true,
  14601. editor: {
  14602. selectOnFocus: true
  14603. },
  14604. },
  14605. {
  14606. text: '显示类型',
  14607. dataIndex: 'xtype',
  14608. width: 90,
  14609. sortable: false,
  14610. menuDisabled: true,
  14611. editor: {
  14612. xtype: 'combo',
  14613. typeAhead: true,
  14614. triggerAction: 'all',
  14615. selectOnFocus: true,
  14616. store: [
  14617. ['', ''],
  14618. ['rownum', 'rownum'],
  14619. ['button', 'button'],
  14620. ['checkbox', 'checkbox'],
  14621. ['progres', 'progres'],
  14622. ]
  14623. }
  14624. },
  14625. {
  14626. text: '数据类型',
  14627. dataIndex: 'dataType',
  14628. width: 90,
  14629. sortable: false,
  14630. menuDisabled: true,
  14631. editor: {
  14632. xtype: 'combo',
  14633. typeAhead: true,
  14634. triggerAction: 'all',
  14635. selectOnFocus: true,
  14636. store: [
  14637. ['', ''],
  14638. ['string', 'string'],
  14639. ['number', 'number'],
  14640. ['date', 'date'],
  14641. ]
  14642. }
  14643. },
  14644. {
  14645. text: '宽度',
  14646. dataIndex: 'width',
  14647. align: 'right',
  14648. width: 60,
  14649. sortable: false,
  14650. menuDisabled: true,
  14651. editor: {
  14652. xtype: 'numberfield',
  14653. selectOnFocus: true,
  14654. minValue: 0,
  14655. maxValue: 1000
  14656. },
  14657. },
  14658. {
  14659. text: '权重',
  14660. dataIndex: 'flex',
  14661. align: 'right',
  14662. width: 60,
  14663. sortable: false,
  14664. menuDisabled: true,
  14665. editor: {
  14666. xtype: 'numberfield',
  14667. selectOnFocus: true,
  14668. minValue: 0,
  14669. maxValue: 10
  14670. },
  14671. },
  14672. {
  14673. text: '字典',
  14674. dataIndex: 'dict',
  14675. sortable: false,
  14676. menuDisabled: true,
  14677. width: 120,
  14678. editor: {
  14679. selectOnFocus: true,
  14680. },
  14681. },
  14682. {
  14683. text: '对齐',
  14684. dataIndex: 'align',
  14685. width: 60,
  14686. sortable: false,
  14687. menuDisabled: true,
  14688. editor: {
  14689. xtype: 'combo',
  14690. typeAhead: true,
  14691. triggerAction: 'all',
  14692. selectOnFocus: false,
  14693. store: [
  14694. ['', ''],
  14695. ['start', 'start'],
  14696. ['center', 'center'],
  14697. ['end', 'end'],
  14698. ]
  14699. },
  14700. },
  14701. {
  14702. text: '过滤',
  14703. dataIndex: 'filterable',
  14704. xtype: 'checkcolumn',
  14705. width: 50,
  14706. resizable: false,
  14707. sortable: false,
  14708. menuDisabled: true,
  14709. },
  14710. {
  14711. text: '隐藏',
  14712. dataIndex: 'hidden',
  14713. xtype: 'checkcolumn',
  14714. width: 50,
  14715. resizable: false,
  14716. sortable: false,
  14717. menuDisabled: true,
  14718. },
  14719. {
  14720. text: '排序',
  14721. dataIndex: 'sortable',
  14722. xtype: 'checkcolumn',
  14723. width: 50,
  14724. resizable: false,
  14725. sortable: false,
  14726. menuDisabled: true,
  14727. },
  14728. {
  14729. text: '扩展参数',
  14730. dataIndex: 'fieldExtend',
  14731. sortable: false,
  14732. menuDisabled: true,
  14733. editor: {
  14734. selectOnFocus: false
  14735. },
  14736. },
  14737. ],
  14738. },
  14739. {
  14740. title: '汇总和汇总逻辑',
  14741. layout: 'border',
  14742. border: false,
  14743. items: [
  14744. {
  14745. xtype: 'yvgrid', region: 'north', layout: 'fit',
  14746. reference: 'gridSum',
  14747. pagination: false,
  14748. hideFootbar: true,
  14749. height: 200,
  14750. split: true,
  14751. border: false,
  14752. plugins: {
  14753. clipboard: true,
  14754. selectionreplicator: true
  14755. },
  14756. selModel: {
  14757. type: 'spreadsheet',
  14758. columnSelect: false,
  14759. pruneRemoved: false,
  14760. extensible: 'y'
  14761. },
  14762. tbar: {
  14763. xtype: 'toolbar',
  14764. border: false,
  14765. items: [
  14766. {
  14767. xtype: 'button',
  14768. text: '添加',
  14769. iconCls: 'x-fa fa-plus-circle',
  14770. listeners: {
  14771. click: 'scope.addSum'
  14772. }
  14773. },
  14774. {
  14775. xtype: 'button',
  14776. text: '删除',
  14777. iconCls: 'x-fa fa-minus-circle',
  14778. listeners: {
  14779. click: 'scope.removeSum'
  14780. }
  14781. },
  14782. '-',
  14783. {
  14784. xtype: 'button',
  14785. text: '自动分析',
  14786. iconCls: 'x-fa fa-code-fork',
  14787. listeners: {
  14788. click: 'scope.calcSum'
  14789. }
  14790. },
  14791. {
  14792. xtype: 'button',
  14793. text: '上移',
  14794. iconCls: 'x-fa fa-arrow-up',
  14795. listeners: {
  14796. click: 'scope.moveUp'
  14797. }
  14798. },
  14799. {
  14800. xtype: 'button',
  14801. text: '下移',
  14802. iconCls: 'x-fa fa-arrow-down',
  14803. listeners: {
  14804. click: 'scope.moveDown'
  14805. }
  14806. },
  14807. ]
  14808. },
  14809. columns: [
  14810. {
  14811. text: '字段名',
  14812. dataIndex: 'sumFieldBind',
  14813. width: 140,
  14814. sortable: false,
  14815. menuDisabled: true,
  14816. editor: {
  14817. selectOnFocus: true
  14818. },
  14819. },
  14820. {
  14821. text: '标题',
  14822. dataIndex: 'sumFieldLabel',
  14823. width: 120,
  14824. sortable: false,
  14825. menuDisabled: true,
  14826. editor: {
  14827. selectOnFocus: true
  14828. },
  14829. },
  14830. {
  14831. text: '权重',
  14832. dataIndex: 'sumFieldFlex',
  14833. align: 'right',
  14834. width: 60,
  14835. sortable: false,
  14836. menuDisabled: true,
  14837. editor: {
  14838. xtype: 'numberfield',
  14839. selectOnFocus: false,
  14840. allowBlank: true,
  14841. minValue: 0,
  14842. maxValue: 10
  14843. },
  14844. },
  14845. {
  14846. xtype: 'checkcolumn',
  14847. dataIndex: "sumFieldWrap", header: "换行",
  14848. sortable: false,
  14849. menuDisabled: true,
  14850. width: 65,
  14851. },
  14852. {
  14853. text: '扩展参数',
  14854. dataIndex: 'sumFieldExtend',
  14855. sortable: false,
  14856. menuDisabled: true,
  14857. editor: {
  14858. selectOnFocus: false
  14859. },
  14860. },
  14861. ]
  14862. },
  14863. {
  14864. region: 'center',
  14865. xtype: 'sqleditor',
  14866. layout: 'fit',
  14867. reference: 'sqlSumEditor',
  14868. },
  14869. ]
  14870. },
  14871. ]
  14872. }
  14873. ]
  14874. }
  14875. ]
  14876. }; //
  14877. //
  14878. //# sourceMappingURL=ReportDesign.view.js.map
  14879. var PROJECT_DICT_CACHE = {};
  14880. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  14881. /**
  14882. *项目运行时构建
  14883. **/
  14884. function createRuntime() {
  14885. {
  14886. // 已经构建过了
  14887. return new Promise(function (resolve) {
  14888. resolve();
  14889. });
  14890. }
  14891. }
  14892. //# sourceMappingURL=ProjectRuntime.js.map
  14893. function ReportRunner(reportId, setLoadingFn) {
  14894. return new Promise(function (resolve) {
  14895. setLoadingFn(true);
  14896. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  14897. // const {model, vjson, report} = buildVjson(res.data)
  14898. // const ret = new ReportScope({model, vjson})
  14899. // ret.report_id = reportId
  14900. // ret.report = report
  14901. // resolve(ret)
  14902. var _b = __read(_a, 1), res = _b[0];
  14903. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  14904. resolve(ret);
  14905. }).finally(function () {
  14906. setLoadingFn(false);
  14907. });
  14908. });
  14909. }
  14910. //# sourceMappingURL=ReportRunner.js.map
  14911. //gridCondition
  14912. //gridColumn
  14913. //gridSum
  14914. //sqlSumEditor
  14915. //sqlEditor
  14916. var ReportDesign = /** @class */ (function (_super) {
  14917. __extends(ReportDesign, _super);
  14918. function ReportDesign() {
  14919. return _super.call(this, { model: model$g, vjson: vjson$g }) || this;
  14920. }
  14921. ReportDesign.prototype.onLoad = function () {
  14922. this.load();
  14923. };
  14924. ReportDesign.prototype.save = function (sender) {
  14925. var _this = this;
  14926. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  14927. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  14928. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  14929. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  14930. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  14931. var report = this.viewModel.get('report');
  14932. var data = {
  14933. report_id: this.viewModel.get('report_id'),
  14934. report_name: this.viewModel.get('report_name'),
  14935. report_enable: this.viewModel.get('report_enable'),
  14936. query_sql: this.viewModel.get('querySql'),
  14937. summary_sql: this.viewModel.get('summarySql'),
  14938. report: json5.stringify(report, null, ' '),
  14939. };
  14940. sender.setLoading(true);
  14941. saveReportApi(data).then(function (res) {
  14942. if (res.success) {
  14943. msg$1('保存成功');
  14944. _this.dialogSuccess(data);
  14945. _this.load();
  14946. }
  14947. }).finally(function () {
  14948. sender.setLoading(false);
  14949. });
  14950. };
  14951. ReportDesign.prototype.preview = function (sender) {
  14952. var reportId = this.viewModel.get('report_id');
  14953. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  14954. handles.mainWindow.showReportPreview(reportId, scope);
  14955. });
  14956. };
  14957. ReportDesign.prototype.load = function () {
  14958. var _this = this;
  14959. var reportId = this.viewModel.get('report_id');
  14960. this.setLoading(true);
  14961. reportByIdApi(reportId).then(function (res) {
  14962. 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;
  14963. if (report) {
  14964. report = json5.parse(report);
  14965. }
  14966. else {
  14967. report = {};
  14968. }
  14969. _this.viewModel.set('report_enable', report_enable);
  14970. _this.viewModel.set('report_name', report_name);
  14971. _this.viewModel.set('querySql', query_sql || '');
  14972. _this.viewModel.set('summarySql', summary_sql || '');
  14973. system.mergeViewModel(_this.viewModel, 'report', report, false);
  14974. var query = _this.viewModel.get('report.query') || [];
  14975. var columns = _this.viewModel.get('report.columns') || [];
  14976. var summary = _this.viewModel.get('report.summary') || [];
  14977. var querySql = _this.viewModel.get('querySql');
  14978. var summarySql = _this.viewModel.get('summarySql');
  14979. _this.refs.gridCondition.setData(query);
  14980. _this.refs.gridColumn.setData(columns);
  14981. _this.refs.gridSum.setData(summary);
  14982. _this.refs.sqlEditor.setCode(querySql);
  14983. _this.refs.sqlSumEditor.setCode(summarySql);
  14984. }).finally(function () {
  14985. _this.setLoading(false);
  14986. });
  14987. };
  14988. ReportDesign.prototype.addCondition = function () {
  14989. this.refs.gridCondition.appendEditRow({
  14990. conditionFieldBind: '',
  14991. conditionFieldLabel: '',
  14992. conditionFieldXtype: 'textfield',
  14993. conditionFieldFlex: 1,
  14994. conditionFieldDict: '',
  14995. conditionFieldWrap: false,
  14996. conditionFieldExtend: '{}',
  14997. }, 'conditionFieldBind');
  14998. };
  14999. ReportDesign.prototype.removeCondition = function () {
  15000. var _this = this;
  15001. var rows = [];
  15002. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  15003. rows.push(r);
  15004. });
  15005. _.forEach(rows, function (r) {
  15006. _this.refs.gridCondition.getStore().remove(r);
  15007. });
  15008. };
  15009. ReportDesign.prototype.moveUp = function (sender) {
  15010. var grid = sender.up('grid');
  15011. grid.rowMoveUp();
  15012. };
  15013. ReportDesign.prototype.moveDown = function (sender) {
  15014. var grid = sender.up('grid');
  15015. grid.rowMoveDown();
  15016. };
  15017. ReportDesign.prototype.calcCondition = function () {
  15018. var _this = this;
  15019. var sql = this.refs.sqlEditor.getCode();
  15020. var re = sql.matchAll(/#{(.+?)}/gi);
  15021. var rows = this.refs.gridCondition.getDataRows();
  15022. this.refs.gridCondition.setLoading(true);
  15023. Promise.all([
  15024. parseDynamicSqlApi(sql),
  15025. instance.reloadIfNeedPromise(),
  15026. ]).then(function (_a) {
  15027. var e_1, _b;
  15028. var _c = __read(_a, 1), res1 = _c[0];
  15029. if (res1.success) {
  15030. var tables_1 = [];
  15031. _.forEach(res1.data, function (parseItem) {
  15032. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  15033. if (tableName && !_.includes(tables_1, tableName)) {
  15034. tables_1.push(tableName);
  15035. }
  15036. });
  15037. var _loop_1 = function (m) {
  15038. var e_2, _a;
  15039. var columnName = m[1];
  15040. // 没有这个列才添加
  15041. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  15042. var meta = undefined;
  15043. try {
  15044. 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()) {
  15045. var tableName = tables_2_1.value;
  15046. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  15047. if (meta) {
  15048. break;
  15049. }
  15050. }
  15051. }
  15052. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  15053. finally {
  15054. try {
  15055. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  15056. }
  15057. finally { if (e_2) throw e_2.error; }
  15058. }
  15059. if (meta) {
  15060. // 找到元数据
  15061. var r = {
  15062. conditionFieldBind: meta.column_name,
  15063. conditionFieldLabel: meta.column_comment,
  15064. conditionFieldXtype: 'textfield',
  15065. conditionFieldFlex: 1,
  15066. conditionFieldDict: '',
  15067. conditionFieldWrap: false,
  15068. conditionFieldExtend: '{}',
  15069. };
  15070. if (meta.column_ui === 'combo' && meta.column_dict) {
  15071. r.conditionFieldXtype = 'combo';
  15072. r.conditionFieldDict = meta.column_dict;
  15073. }
  15074. else if (meta.column_ui === "checkbox") {
  15075. r.conditionFieldXtype = 'checkbox';
  15076. }
  15077. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15078. r.conditionFieldXtype = 'numberfield';
  15079. }
  15080. _this.refs.gridCondition.appendEditRow(r);
  15081. }
  15082. else {
  15083. // 没找到元数据,直接添加
  15084. _this.refs.gridCondition.appendEditRow({
  15085. conditionFieldBind: columnName,
  15086. conditionFieldLabel: '',
  15087. conditionFieldXtype: 'textfield',
  15088. conditionFieldFlex: 1,
  15089. conditionFieldDict: '',
  15090. conditionFieldWrap: false,
  15091. conditionFieldExtend: '{}',
  15092. });
  15093. }
  15094. }
  15095. };
  15096. try {
  15097. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  15098. var m = re_1_1.value;
  15099. _loop_1(m);
  15100. }
  15101. }
  15102. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  15103. finally {
  15104. try {
  15105. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  15106. }
  15107. finally { if (e_1) throw e_1.error; }
  15108. }
  15109. }
  15110. }).finally(function () {
  15111. _this.refs.gridCondition.setLoading(false);
  15112. });
  15113. };
  15114. ReportDesign.prototype.addColumn = function () {
  15115. this.refs.gridColumn.appendEditRow({
  15116. dataIndex: '',
  15117. header: '',
  15118. xtype: '',
  15119. dataType: '',
  15120. width: '',
  15121. dict: '',
  15122. align: '',
  15123. filterable: true,
  15124. hidden: false,
  15125. sortable: true,
  15126. fieldExtend: '{}',
  15127. }, 'header');
  15128. };
  15129. ReportDesign.prototype.removeColumn = function () {
  15130. var _this = this;
  15131. var rows = [];
  15132. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  15133. rows.push(r);
  15134. });
  15135. _.forEach(rows, function (r) {
  15136. _this.refs.gridColumn.getStore().remove(r);
  15137. });
  15138. };
  15139. ReportDesign.prototype.calcColumn = function () {
  15140. var _this = this;
  15141. var sql = this.refs.sqlEditor.getCode();
  15142. this.refs.gridColumn.setLoading(true);
  15143. var rows = this.refs.gridColumn.getDataRows();
  15144. Promise.all([
  15145. parseDynamicSqlApi(sql),
  15146. instance.reloadIfNeedPromise(),
  15147. ]).then(function (_a) {
  15148. var _b = __read(_a, 1), res1 = _b[0];
  15149. if (res1.success) {
  15150. _.forEach(res1.data, function (parseItem) {
  15151. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  15152. // 是否找到重复字段
  15153. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  15154. if (exists) {
  15155. if ((columnTypeName || "").toLowerCase() === "number") {
  15156. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  15157. if (record) {
  15158. record.set("dataType", "number");
  15159. record.set("align", "end");
  15160. }
  15161. }
  15162. return;
  15163. }
  15164. if (tableName) {
  15165. // 解出表格名和字段名
  15166. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  15167. if (meta) {
  15168. // 找到了元数据
  15169. var r = {
  15170. dataIndex: meta.column_name,
  15171. header: meta.column_comment,
  15172. xtype: '',
  15173. dataType: '',
  15174. width: '',
  15175. dict: '',
  15176. align: '',
  15177. filterable: true,
  15178. hidden: false,
  15179. sortable: true,
  15180. fieldExtend: '{}',
  15181. };
  15182. if (meta.column_ui === 'combo' && meta.column_dict) {
  15183. r.dict = meta.column_dict;
  15184. }
  15185. else if (meta.column_ui === "checkbox") {
  15186. r.xtype = 'checkbox';
  15187. }
  15188. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15189. r.dataType = meta.data_type;
  15190. r.align = 'end';
  15191. }
  15192. if ((columnTypeName || "").toLowerCase() === "number") {
  15193. r.dataType = "number";
  15194. r.align = 'end';
  15195. }
  15196. _this.refs.gridColumn.appendEditRow(r);
  15197. return;
  15198. }
  15199. }
  15200. if (columnName) {
  15201. // 解出字段名
  15202. var r = {
  15203. dataIndex: columnName,
  15204. header: columnName,
  15205. xtype: '',
  15206. dataType: '',
  15207. width: '',
  15208. dict: '',
  15209. align: '',
  15210. filterable: true,
  15211. hidden: false,
  15212. sortable: true,
  15213. fieldExtend: '{}',
  15214. };
  15215. if ((columnTypeName || "").toLowerCase() === "number") {
  15216. r.dataType = "number";
  15217. r.align = 'end';
  15218. }
  15219. _this.refs.gridColumn.appendEditRow(r);
  15220. }
  15221. });
  15222. }
  15223. }).finally(function () {
  15224. _this.refs.gridColumn.setLoading(false);
  15225. });
  15226. };
  15227. ReportDesign.prototype.addSum = function () {
  15228. this.refs.gridSum.appendEditRow({
  15229. sumFieldBind: '',
  15230. sumFieldLabel: '',
  15231. sumFieldFlex: 1,
  15232. sumFieldWrap: false,
  15233. sumFieldExtend: '{}',
  15234. }, 'sumFieldBind');
  15235. };
  15236. ReportDesign.prototype.removeSum = function () {
  15237. var _this = this;
  15238. var rows = [];
  15239. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  15240. rows.push(r);
  15241. });
  15242. _.forEach(rows, function (r) {
  15243. _this.refs.gridSum.getStore().remove(r);
  15244. });
  15245. };
  15246. ReportDesign.prototype.calcSum = function () {
  15247. var _this = this;
  15248. var sql = this.refs.sqlSumEditor.getCode();
  15249. var rows = this.refs.gridSum.getDataRows();
  15250. this.refs.gridSum.setLoading(true);
  15251. parseDynamicSqlApi(sql).then(function (res1) {
  15252. if (res1.success) {
  15253. _.forEach(res1.data, function (parseItem) {
  15254. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  15255. // 是否找到重复字段
  15256. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  15257. return;
  15258. }
  15259. if (columnName) {
  15260. // 解出字段名
  15261. _this.refs.gridSum.appendEditRow({
  15262. sumFieldBind: columnName,
  15263. sumFieldLabel: columnName,
  15264. sumFieldFlex: 1,
  15265. sumFieldWrap: false,
  15266. sumFieldExtend: '{}',
  15267. });
  15268. }
  15269. });
  15270. }
  15271. }).finally(function () {
  15272. _this.refs.gridSum.setLoading(false);
  15273. });
  15274. };
  15275. Object.defineProperty(ReportDesign.prototype, "reportId", {
  15276. get: function () {
  15277. return this.viewModel.get('report_id');
  15278. },
  15279. enumerable: true,
  15280. configurable: true
  15281. });
  15282. return ReportDesign;
  15283. }(Scope));
  15284. //# sourceMappingURL=ReportDesign.js.map
  15285. var model$h = {
  15286. data: {
  15287. originalTableInfo: {
  15288. table_name: '',
  15289. description: '',
  15290. },
  15291. hasChanged: false,
  15292. schema_name: undefined,
  15293. table_name: undefined,
  15294. column_name: undefined,
  15295. tableInfo: {
  15296. schema_name: '',
  15297. table_name: '',
  15298. description: '',
  15299. biz_category: '',
  15300. note: '',
  15301. archive_enable: false,
  15302. archive_cron: '',
  15303. archive_condition: '',
  15304. column_list: []
  15305. },
  15306. },
  15307. formulas: {
  15308. shouldSave: function (get) {
  15309. // console.log("-->", get('grid1.ischanged'))
  15310. return get('grid1.ischanged')
  15311. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  15312. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  15313. },
  15314. },
  15315. };
  15316. //# sourceMappingURL=DbColumn.model.js.map
  15317. var vjson$h = {
  15318. bind: {
  15319. title: '{tableName}{shouldSave?" *":""}',
  15320. },
  15321. layout: 'fit',
  15322. items: [
  15323. {
  15324. layout: 'border',
  15325. tbar: {
  15326. xtype: 'toolbar',
  15327. items: [
  15328. // {
  15329. // xtype: 'button',
  15330. // text: '拉取库结构',
  15331. // iconCls: 'x-fa fa-cloud-download',
  15332. // listeners: {
  15333. // click: 'scope.pullFromDb'
  15334. // }
  15335. // },
  15336. {
  15337. xtype: 'button',
  15338. text: '保存至数据库',
  15339. iconCls: 'x-fa fa-save',
  15340. bind: {
  15341. disabled: '{!shouldSave}'
  15342. },
  15343. listeners: {
  15344. click: 'scope.pushToDb'
  15345. }
  15346. },
  15347. '-',
  15348. {
  15349. xtype: 'button',
  15350. text: '刷新 QueryDSL',
  15351. iconCls: 'x-fa fa-refresh',
  15352. listeners: {
  15353. click: 'scope.syncQueryDSL'
  15354. }
  15355. },
  15356. {
  15357. xtype: 'button',
  15358. text: '生成 DDL',
  15359. iconCls: 'x-fa fa-file-text',
  15360. listeners: {
  15361. click: 'scope.buildDDL'
  15362. }
  15363. }
  15364. ]
  15365. },
  15366. items: [
  15367. {
  15368. region: 'center',
  15369. xtype: 'tabpanel',
  15370. items: [
  15371. {
  15372. title: '字段',
  15373. xtype: 'yvgrid',
  15374. selModel: {
  15375. type: 'spreadsheet',
  15376. columnSelect: true,
  15377. pruneRemoved: false,
  15378. extensible: 'y'
  15379. },
  15380. enableLocking: false,
  15381. idField: 'column_name',
  15382. plugins: {
  15383. clipboard: true,
  15384. selectionreplicator: true
  15385. },
  15386. reference: 'grid1',
  15387. pagination: false,
  15388. // hideFootbar: true,
  15389. tbar: {
  15390. xtype: 'form',
  15391. items: [
  15392. {
  15393. xtype: 'cols',
  15394. items: [
  15395. {
  15396. xtype: 'textfield',
  15397. fieldLabel: '表格名',
  15398. reference: 'text_table_name',
  15399. readOnly: true,
  15400. bind: {
  15401. value: '{tableInfo.table_name}'
  15402. }
  15403. },
  15404. {
  15405. xtype: 'textfield',
  15406. fieldLabel: '描述',
  15407. // readOnly: true,
  15408. bind: {
  15409. value: '{tableInfo.description}'
  15410. }
  15411. },
  15412. ]
  15413. },
  15414. {
  15415. xtype: 'toolbar',
  15416. items: [
  15417. {
  15418. xtype: 'button',
  15419. text: '添加',
  15420. iconCls: 'x-fa fa-plus-circle',
  15421. listeners: {
  15422. click: 'scope.addField'
  15423. }
  15424. },
  15425. {
  15426. xtype: 'button',
  15427. text: '删除',
  15428. iconCls: 'x-fa fa-minus-circle',
  15429. listeners: {
  15430. click: 'scope.removeField'
  15431. }
  15432. },
  15433. ]
  15434. },
  15435. ]
  15436. },
  15437. listeners: {
  15438. editbefore: 'scope.gridEditBefore'
  15439. },
  15440. columns: [
  15441. {
  15442. text: '字段名', dataIndex: 'column_name',
  15443. sortable: false,
  15444. menuDisabled: true,
  15445. width: 120,
  15446. editor: {
  15447. allowBlank: true,
  15448. selectOnFocus: false
  15449. }
  15450. },
  15451. {
  15452. text: '字段中文', dataIndex: 'column_comment',
  15453. width: 130,
  15454. sortable: false,
  15455. menuDisabled: true,
  15456. editor: {
  15457. allowBlank: true,
  15458. selectOnFocus: false
  15459. }
  15460. },
  15461. {
  15462. text: '主键', dataIndex: 'is_primary_key',
  15463. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15464. width: 48, resizable: false,
  15465. },
  15466. {
  15467. text: '必填', dataIndex: 'not_null',
  15468. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15469. width: 48, resizable: false,
  15470. },
  15471. {
  15472. text: '字段域', dataIndex: 'column_domain',
  15473. sortable: false, menuDisabled: true,
  15474. width: 148,
  15475. fix: ['system.getDict("column_domain")'],
  15476. editor: {
  15477. xtype: 'combo',
  15478. allowBlank: true,
  15479. selectOnFocus: true,
  15480. fix: ['system.getDict("column_domain")'],
  15481. listConfig: {
  15482. minWidth: 200
  15483. },
  15484. listeners: {
  15485. change: 'scope.columnDomainChange',
  15486. }
  15487. }
  15488. },
  15489. {
  15490. text: '数据类型', dataIndex: 'data_type',
  15491. sortable: false, menuDisabled: true,
  15492. editor: { allowBlank: true, selectOnFocus: true }
  15493. },
  15494. {
  15495. text: '长度', dataIndex: 'column_size',
  15496. sortable: false, menuDisabled: true,
  15497. xtype: 'numbercolumn', format: '0',
  15498. editor: { allowBlank: true, selectOnFocus: true }
  15499. },
  15500. {
  15501. text: '小数位', dataIndex: 'decimal_digits',
  15502. sortable: false, menuDisabled: true,
  15503. xtype: 'numbercolumn', format: '0',
  15504. editor: { allowBlank: true, selectOnFocus: true }
  15505. },
  15506. {
  15507. text: '默认值', dataIndex: 'default_value',
  15508. sortable: false, menuDisabled: true,
  15509. editor: { allowBlank: true, selectOnFocus: true }
  15510. },
  15511. {
  15512. text: '字典', dataIndex: 'column_dict',
  15513. sortable: false, menuDisabled: true,
  15514. // fix: ['system.getDict("DICT")'],
  15515. width: 200,
  15516. editor: {
  15517. xtype: 'combo',
  15518. allowBlank: true,
  15519. listConfig: {
  15520. minWidth: 350
  15521. },
  15522. }
  15523. },
  15524. {
  15525. text: 'UI建议', dataIndex: 'column_ui',
  15526. sortable: false, menuDisabled: true,
  15527. // fix: ['system.getDict("column_ui")'],
  15528. editor: {
  15529. xtype: 'combo',
  15530. allowBlank: true,
  15531. listConfig: {
  15532. minWidth: 200
  15533. },
  15534. }
  15535. },
  15536. {
  15537. text: '详细描述', dataIndex: 'column_note',
  15538. sortable: false, menuDisabled: true,
  15539. editor: { allowBlank: true, }
  15540. },
  15541. ]
  15542. },
  15543. {
  15544. title: '高级属性',
  15545. xtype: 'form',
  15546. items: [
  15547. // {
  15548. // xtype: 'textfield',
  15549. // fieldLabel: '表格名',
  15550. // bind: {
  15551. // value: '{tableName}'
  15552. // }
  15553. // },
  15554. // {
  15555. // xtype: 'textfield',
  15556. // fieldLabel: '中文含义',
  15557. // bind: {
  15558. // value: '{tableInfo.description}'
  15559. // }
  15560. // },
  15561. {
  15562. xtype: 'combo',
  15563. fieldLabel: '业务类型',
  15564. bind: {
  15565. value: '{tableInfo.biz_category}'
  15566. },
  15567. store: [
  15568. '基础资料',
  15569. '系统',
  15570. '账目与库存',
  15571. '单据',
  15572. '指令',
  15573. '规则与流程',
  15574. '开发辅助',
  15575. ]
  15576. },
  15577. {
  15578. xtype: 'textfield',
  15579. fieldLabel: '详细描述',
  15580. bind: {
  15581. value: '{tableInfo.note}'
  15582. },
  15583. },
  15584. {
  15585. xtype: 'checkbox',
  15586. fieldLabel: '允许归档',
  15587. bind: "{tableInfo.archive_enable}",
  15588. },
  15589. {
  15590. xtype: 'textfield',
  15591. fieldLabel: '归档周期',
  15592. bind: {
  15593. value: '{tableInfo.archive_cron}',
  15594. hidden: '{!tableInfo.archive_enable}',
  15595. }
  15596. },
  15597. {
  15598. xtype: 'textfield',
  15599. fieldLabel: '归档条件',
  15600. bind: {
  15601. value: '{tableInfo.archive_condition}',
  15602. hidden: '{!tableInfo.archive_enable}',
  15603. }
  15604. },
  15605. ]
  15606. },
  15607. ]
  15608. }
  15609. ]
  15610. },
  15611. ]
  15612. };
  15613. //# sourceMappingURL=DbColumn.view.js.map
  15614. var DbColumn = /** @class */ (function (_super) {
  15615. __extends(DbColumn, _super);
  15616. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  15617. var _this = _super.call(this, {
  15618. model: getModel(model$h, schemaName, tableName, columnName, isCreateTable),
  15619. vjson: vjson$h
  15620. }) || this;
  15621. _this.isCreate = false;
  15622. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  15623. return _this;
  15624. }
  15625. DbColumn.prototype.onLoad = function () {
  15626. var _this = this;
  15627. var _a, _b, _c, _d, _e, _f, _g, _h;
  15628. console.log('me', this);
  15629. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  15630. this.refs.grid1.autoSizeColumns();
  15631. // this.refs.grid1.columns[0].hide()
  15632. // 自动定位到选定的列
  15633. if (this.viewModel.get('column_name')) {
  15634. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  15635. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  15636. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  15637. return;
  15638. }
  15639. }
  15640. }
  15641. instance$3.getColumnDomainComboData().then(function () {
  15642. _this.checkDomain();
  15643. });
  15644. 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 : "");
  15645. 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 : "");
  15646. if (this.isCreate)
  15647. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  15648. };
  15649. DbColumn.prototype.checkDomain = function () {
  15650. // 走查一遍 domain
  15651. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15652. var dbType = this.viewModel.get('tableInfo.db_type');
  15653. var diffColumnName = [];
  15654. var tableInfo = this.viewModel.get('tableInfo');
  15655. this.refs.grid1.store.data.items.forEach(function (record) {
  15656. var data = record.data;
  15657. var column_domain = data.column_domain;
  15658. var domain = instance$3.getColumnDomainById(column_domain);
  15659. if (!domain) {
  15660. // 没有找到 domain
  15661. return;
  15662. }
  15663. var editRow = applyDomain(dbType, domain);
  15664. // 字段跟领域做对比
  15665. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  15666. if (typeof compareResult === 'string') {
  15667. // 不一样的情况下,要改成一致
  15668. _$2.forOwn(editRow, function (value, key) {
  15669. // 改成与 domain 一致
  15670. record.set(key, value);
  15671. });
  15672. diffColumnName.push(data.column_name + '.' + compareResult);
  15673. }
  15674. });
  15675. if (diffColumnName.length > 0) {
  15676. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  15677. }
  15678. };
  15679. DbColumn.prototype.addField = function () {
  15680. this.refs.grid1.appendEditRow({
  15681. column_name: '',
  15682. column_comment: '',
  15683. is_primary_key: false,
  15684. not_null: true,
  15685. column_domain: '',
  15686. data_type: '',
  15687. column_size: 0,
  15688. decimal_digits: 0,
  15689. default_value: '',
  15690. column_dict: '',
  15691. column_ui: '',
  15692. column_note: '',
  15693. }, 'column_name');
  15694. };
  15695. DbColumn.prototype.removeField = function () {
  15696. var _this = this;
  15697. var rows = [];
  15698. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  15699. rows.push(r);
  15700. });
  15701. _$2.forEach(rows, function (r) {
  15702. _this.refs.grid1.getStore().remove(r);
  15703. });
  15704. };
  15705. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  15706. instance$3.getColumnDomainComboData().then(function (data) {
  15707. editor.cmp.columns[5].getEditor().setStore({ data: data });
  15708. });
  15709. // 被字段域锁定的内容,不允许修改
  15710. var record = context.record, field = context.field;
  15711. var domainId = record.get('column_domain');
  15712. if (!domainId) {
  15713. return;
  15714. }
  15715. var domain = instance$3.getColumnDomainById(domainId);
  15716. if (!domain) {
  15717. msg$1('没有找到字段域' + domainId);
  15718. return;
  15719. }
  15720. if (field === "data_type") {
  15721. // 字段类型不允许修改
  15722. context.cancel = true;
  15723. return;
  15724. }
  15725. if (domain.is_fix_size &&
  15726. (field === "column_size" ||
  15727. field === "decimal_digits")) {
  15728. // 锁定长度的情况下,大小不允许修改
  15729. context.cancel = true;
  15730. return;
  15731. }
  15732. if (domain.is_fix_default_value && field === "default_value") {
  15733. // 锁定默认值的情况下,默认值不允许修改
  15734. context.cancel = true;
  15735. return;
  15736. }
  15737. };
  15738. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  15739. if (!newValue) {
  15740. return;
  15741. }
  15742. var grid = editor.up('grid').ownerGrid;
  15743. var domain = instance$3.getColumnDomainById(newValue);
  15744. if (!domain) {
  15745. msg$1('没有找到 domain:' + newValue);
  15746. return;
  15747. }
  15748. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15749. var dbType = this.viewModel.get('tableInfo.db_type');
  15750. var editRow = applyDomain(dbType, domain);
  15751. grid.setEditRow(editRow);
  15752. };
  15753. DbColumn.prototype.pullFromDb = function () {
  15754. };
  15755. DbColumn.prototype.pushToDb = function (sender) {
  15756. var _this = this;
  15757. // 设置当前界面为 "保存中..." 状态
  15758. var me = this;
  15759. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  15760. this.viewModel.set('tableInfo.table_name', table_name);
  15761. this.viewModel.set('tableInfo.schema_name', schema_name);
  15762. var tableInfo = this.viewModel.get('tableInfo');
  15763. var column_list = this.refs.grid1.getDataRows();
  15764. var hasError = false;
  15765. if (column_list.length <= 0) {
  15766. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  15767. hasError = true;
  15768. }
  15769. var columnNameExistsCheck = {};
  15770. _$2.forEach(column_list, function (row, i) {
  15771. var checkResult = checkColumn(tableInfo, row);
  15772. if (typeof checkResult !== 'undefined') {
  15773. msg$1(checkResult);
  15774. hasError = true;
  15775. _this.refs.grid1.beginEdit(i, 'column_name');
  15776. return false;
  15777. }
  15778. if (!row.column_domain || row.column_domain === '0') {
  15779. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  15780. hasError = true;
  15781. _this.refs.grid1.beginEdit(i, 'column_domain');
  15782. return false;
  15783. }
  15784. if (isEmpty(row.data_type)) {
  15785. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  15786. hasError = true;
  15787. _this.refs.grid1.beginEdit(i, 'data_type');
  15788. return false;
  15789. }
  15790. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  15791. // 列名已存在
  15792. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  15793. hasError = true;
  15794. _this.refs.grid1.beginEdit(i, 'column_name');
  15795. return false;
  15796. }
  15797. columnNameExistsCheck[row.column_name] = true;
  15798. });
  15799. if (hasError)
  15800. return;
  15801. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  15802. me.setLoading(true);
  15803. instance.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  15804. .then(function (res) {
  15805. var _a;
  15806. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  15807. // 返回 DDL 就要显示出来
  15808. var window_1 = Ext.create('Ext.window.Window', {
  15809. title: 'SQL 预览',
  15810. height: 400,
  15811. width: 600,
  15812. modal: true,
  15813. animateTarget: sender,
  15814. maximizable: true,
  15815. layout: 'fit',
  15816. items: {
  15817. xtype: 'sqleditor',
  15818. value: res.data.ddl
  15819. },
  15820. buttons: [
  15821. {
  15822. xtype: 'button',
  15823. text: '执行',
  15824. iconCls: 'x-fa fa-save',
  15825. handler: function (sender) {
  15826. var editor = sender.up('window').down('sqleditor');
  15827. var ddl = editor.getValue();
  15828. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  15829. }
  15830. },
  15831. {
  15832. xtype: 'button',
  15833. text: '取消',
  15834. iconCls: 'x-fa fa-times',
  15835. handler: function () {
  15836. window_1.close();
  15837. }
  15838. }
  15839. ]
  15840. }).show();
  15841. return;
  15842. }
  15843. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15844. var tableRow = instance.getTableByName(schema_name, table_name);
  15845. if (!tableRow) {
  15846. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15847. console.log('这是一个新 table');
  15848. instance.appendNewTable(tableInfo);
  15849. }
  15850. _this.viewModel.set('schema_name', schema_name);
  15851. _this.viewModel.set('table_name', table_name);
  15852. _this.viewModel.set('tableInfo', tableInfo);
  15853. _this.refs.grid1.setData(tableInfo.column_list);
  15854. if (tableRow)
  15855. Object.assign(tableRow, tableInfo);
  15856. msg$1('保存成功');
  15857. _this.viewModel.set('hasChanged', false);
  15858. })
  15859. .finally(function () {
  15860. me.setLoading(false);
  15861. });
  15862. };
  15863. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  15864. var _this = this;
  15865. window.setLoading(true);
  15866. instance.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  15867. .then(function (res) {
  15868. var _a, _b, _c, _d;
  15869. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15870. // 保存成功就提示一下,并重新载入数据
  15871. msg$1(res.msg);
  15872. instance.reloadForce(undefined);
  15873. var tableRow = instance.getTableByName(schema_name, table_name);
  15874. if (!tableRow) {
  15875. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15876. console.log('这是一个新 table');
  15877. instance.appendNewTable(tableInfo);
  15878. }
  15879. _this.viewModel.set('schema_name', schema_name);
  15880. _this.viewModel.set('table_name', table_name);
  15881. _this.viewModel.set('tableInfo', tableInfo);
  15882. _this.refs.grid1.setData(tableInfo.column_list);
  15883. if (tableRow)
  15884. Object.assign(tableRow, tableInfo);
  15885. instance.notifyRefresh();
  15886. window.close();
  15887. _this.viewModel.set('hasChanged', false);
  15888. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  15889. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  15890. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  15891. })
  15892. .finally(function () {
  15893. // 无论正常异常,关闭 "保存中..." 状态
  15894. window.setLoading(false);
  15895. });
  15896. };
  15897. DbColumn.prototype.syncQueryDSL = function () {
  15898. var _this = this;
  15899. var tableInfo = this.viewModel.get("tableInfo");
  15900. this.setLoading(true);
  15901. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  15902. .then(function () {
  15903. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  15904. })
  15905. .finally(function () {
  15906. _this.setLoading(false);
  15907. });
  15908. };
  15909. DbColumn.prototype.buildDDL = function () {
  15910. };
  15911. return DbColumn;
  15912. }(Scope));
  15913. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  15914. model.data.schema_name = schemaName;
  15915. model.data.table_name = tableName;
  15916. model.data.column_name = columnName;
  15917. if (isCreateTable) {
  15918. var dbType = instance.getSchemaDbType(schemaName);
  15919. if (!dbType) {
  15920. throw Error('无法识别数据库类型' + schemaName);
  15921. }
  15922. model.data.tableInfo.schema_name = model.data.schema_name;
  15923. model.data.tableInfo.table_name = model.data.table_name;
  15924. model.data.tableInfo.db_type = dbType;
  15925. model.data.tableInfo.column_list = [];
  15926. model.data.tableInfo.is_create = true;
  15927. return model;
  15928. }
  15929. var tableRow = instance.getTableByName(schemaName, tableName);
  15930. if (!tableRow) {
  15931. throw Error('没有找到 table' + schemaName + tableName + columnName);
  15932. }
  15933. model.data.tableInfo = _$2.cloneDeep(tableRow);
  15934. model.data.tableInfo.is_create = false;
  15935. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  15936. return model;
  15937. }
  15938. //# sourceMappingURL=DbColumn.js.map
  15939. var model$i = {
  15940. data: {
  15941. id: '',
  15942. path: '',
  15943. form: {
  15944. title: '',
  15945. sqlId: '',
  15946. }
  15947. }
  15948. };
  15949. //# sourceMappingURL=WidgetDesign.model.js.map
  15950. var vjson$i = {
  15951. bind: {
  15952. title: '{title}',
  15953. },
  15954. layout: 'fit',
  15955. items: [
  15956. {
  15957. layout: 'border',
  15958. items: [
  15959. {
  15960. region: 'center',
  15961. layout: 'border',
  15962. items: [
  15963. {
  15964. region: 'north',
  15965. items: [
  15966. {
  15967. xtype: 'toolbar',
  15968. border: false,
  15969. items: [
  15970. {
  15971. xtype: 'button',
  15972. text: '刷新',
  15973. iconCls: 'x-fa fa-refresh',
  15974. listeners: {
  15975. click: 'scope.load'
  15976. }
  15977. },
  15978. {
  15979. xtype: 'button',
  15980. text: '保存',
  15981. iconCls: 'x-fa fa-save',
  15982. listeners: {
  15983. click: 'scope.widgetSave'
  15984. }
  15985. },
  15986. {
  15987. xtype: 'button',
  15988. text: '预览',
  15989. iconCls: 'x-fa fa-play-circle-o',
  15990. listeners: {
  15991. //click: 'scope.preview'
  15992. }
  15993. },
  15994. {
  15995. xtype: 'textfield',
  15996. fieldLabel: '弹窗文件',
  15997. reference: "wPath",
  15998. labelWidth: 80,
  15999. //width: 200,
  16000. bind: {
  16001. value: '{widgetPath}',
  16002. },
  16003. readOnly: true,
  16004. },
  16005. {
  16006. xtype: 'textfield',
  16007. fieldLabel: '弹窗名称',
  16008. reference: "wTitle",
  16009. labelWidth: 80,
  16010. //width: 200,
  16011. bind: {
  16012. value: '{form.title}',
  16013. },
  16014. readOnly: true,
  16015. },
  16016. {
  16017. xtype: 'textfield',
  16018. fieldLabel: 'sqlId',
  16019. bind: {
  16020. value: '{form.sqlId}',
  16021. },
  16022. readOnly: true,
  16023. },
  16024. ]
  16025. },
  16026. ]
  16027. },
  16028. {
  16029. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  16030. items: [
  16031. {
  16032. title: "SQL和条件",
  16033. layout: 'border',
  16034. border: false,
  16035. items: [
  16036. {
  16037. region: 'north',
  16038. height: 200,
  16039. xtype: 'yvgrid',
  16040. reference: "grid2",
  16041. split: true,
  16042. selModel: {
  16043. selType: 'rowmodel',
  16044. mode: 'SINGLE',
  16045. },
  16046. store: {},
  16047. pagination: false,
  16048. hideFootbar: true,
  16049. tbar: {
  16050. xtype: 'toolbar',
  16051. items: [
  16052. {
  16053. xtype: 'button',
  16054. text: '添加',
  16055. iconCls: 'x-fa fa-plus-circle',
  16056. listeners: {}
  16057. },
  16058. {
  16059. xtype: 'button',
  16060. text: '删除',
  16061. iconCls: 'x-fa fa-minus-circle',
  16062. listeners: {
  16063. click: 'scope.delCondition'
  16064. }
  16065. },
  16066. '-',
  16067. {
  16068. xtype: 'button',
  16069. text: '上移',
  16070. iconCls: 'x-fa fa-refresh',
  16071. listeners: {
  16072. //click: 'scope.saveAll'
  16073. }
  16074. },
  16075. {
  16076. xtype: 'button',
  16077. text: '下移',
  16078. iconCls: 'x-fa fa-refresh',
  16079. listeners: {
  16080. //click: 'scope.saveAll'
  16081. }
  16082. },
  16083. '-',
  16084. {
  16085. xtype: 'button',
  16086. text: '自动分析',
  16087. iconCls: 'x-fa fa-refresh',
  16088. listeners: {
  16089. click: 'scope.calcCondition'
  16090. }
  16091. },
  16092. ]
  16093. },
  16094. columns: [
  16095. {
  16096. text: '条件变量',
  16097. dataIndex: 'conditionFieldBind',
  16098. width: 140,
  16099. sortable: false,
  16100. menuDisabled: true,
  16101. editor: {
  16102. selectOnFocus: true
  16103. },
  16104. },
  16105. {
  16106. text: '中文标题',
  16107. dataIndex: 'conditionFieldLabel',
  16108. width: 120,
  16109. sortable: false,
  16110. menuDisabled: true,
  16111. editor: {
  16112. selectOnFocus: true
  16113. },
  16114. },
  16115. {
  16116. text: '编辑类型',
  16117. dataIndex: 'xtype',
  16118. sortable: false,
  16119. menuDisabled: true,
  16120. editor: {
  16121. xtype: 'combo',
  16122. typeAhead: true,
  16123. triggerAction: 'all',
  16124. selectOnFocus: true,
  16125. store: [
  16126. ['textfield', 'textfield'],
  16127. ['combo', 'combo'],
  16128. ['datefield', 'datefield'],
  16129. ['datetimefield', 'datetimefield'],
  16130. ['numberfield', 'numberfield'],
  16131. ['multiplesearch', 'multiplesearch'],
  16132. ]
  16133. }
  16134. },
  16135. {
  16136. text: '权重',
  16137. dataIndex: 'conditionFieldFlex',
  16138. align: 'right',
  16139. sortable: false,
  16140. menuDisabled: true,
  16141. editor: {
  16142. xtype: 'numberfield',
  16143. selectOnFocus: false,
  16144. minValue: 0,
  16145. maxValue: 10
  16146. },
  16147. },
  16148. {
  16149. text: '字典',
  16150. dataIndex: 'conditionFieldDict',
  16151. width: 160,
  16152. sortable: false,
  16153. menuDisabled: true,
  16154. editor: {
  16155. selectOnFocus: false
  16156. },
  16157. },
  16158. {
  16159. xtype: 'checkcolumn',
  16160. dataIndex: "conditionFieldWrap", header: "换行",
  16161. width: 65,
  16162. sortable: false,
  16163. menuDisabled: true,
  16164. },
  16165. ]
  16166. },
  16167. {
  16168. region: 'center',
  16169. xtype: 'sqleditor',
  16170. layout: 'fit',
  16171. reference: 'sqlEditor',
  16172. split: true,
  16173. bind: {
  16174. value: "{form.sql}"
  16175. },
  16176. },
  16177. ]
  16178. },
  16179. {
  16180. title: "结果字段定义",
  16181. border: false,
  16182. xtype: 'yvgrid',
  16183. reference: "grid3",
  16184. selModel: {
  16185. selType: 'rowmodel',
  16186. mode: 'SINGLE',
  16187. },
  16188. store: {},
  16189. pagination: false,
  16190. hideFootbar: true,
  16191. tbar: {
  16192. xtype: 'toolbar',
  16193. items: [
  16194. {
  16195. xtype: 'button',
  16196. text: '添加',
  16197. iconCls: 'x-fa fa-plus-circle',
  16198. listeners: {}
  16199. },
  16200. {
  16201. xtype: 'button',
  16202. text: '删除',
  16203. iconCls: 'x-fa fa-minus-circle',
  16204. listeners: {
  16205. click: 'scope.delColumn'
  16206. }
  16207. },
  16208. '-',
  16209. {
  16210. xtype: 'button',
  16211. text: '上移',
  16212. iconCls: 'x-fa fa-refresh',
  16213. listeners: {
  16214. //click: 'scope.saveAll'
  16215. }
  16216. },
  16217. {
  16218. xtype: 'button',
  16219. text: '下移',
  16220. iconCls: 'x-fa fa-refresh',
  16221. listeners: {
  16222. //click: 'scope.saveAll'
  16223. }
  16224. },
  16225. '-',
  16226. {
  16227. xtype: 'button',
  16228. text: '自动分析',
  16229. iconCls: 'x-fa fa-refresh',
  16230. listeners: {
  16231. click: 'scope.calcColumn'
  16232. }
  16233. },
  16234. ]
  16235. },
  16236. columns: [
  16237. { xtype: 'rownumberer' },
  16238. {
  16239. text: '字段',
  16240. dataIndex: 'dataIndex',
  16241. width: 140,
  16242. sortable: false,
  16243. menuDisabled: true,
  16244. editor: {
  16245. selectOnFocus: true
  16246. },
  16247. },
  16248. {
  16249. text: '标题',
  16250. dataIndex: 'header',
  16251. width: 120,
  16252. sortable: false,
  16253. menuDisabled: true,
  16254. editor: {
  16255. selectOnFocus: true
  16256. },
  16257. },
  16258. {
  16259. text: '显示类型',
  16260. dataIndex: 'xtype',
  16261. width: 90,
  16262. sortable: false,
  16263. menuDisabled: true,
  16264. editor: {
  16265. xtype: 'combo',
  16266. typeAhead: true,
  16267. triggerAction: 'all',
  16268. selectOnFocus: true,
  16269. store: [
  16270. ['', ''],
  16271. ['rownum', 'rownum'],
  16272. ['button', 'button'],
  16273. ['checkbox', 'checkbox'],
  16274. ['progres', 'progres'],
  16275. ]
  16276. }
  16277. },
  16278. {
  16279. text: '数据类型',
  16280. dataIndex: 'dataType',
  16281. width: 90,
  16282. sortable: false,
  16283. menuDisabled: true,
  16284. editor: {
  16285. xtype: 'combo',
  16286. typeAhead: true,
  16287. triggerAction: 'all',
  16288. selectOnFocus: true,
  16289. store: [
  16290. ['', ''],
  16291. ['string', 'string'],
  16292. ['number', 'number'],
  16293. ['date', 'date'],
  16294. ]
  16295. }
  16296. },
  16297. {
  16298. text: '数据字典',
  16299. dataIndex: 'dict',
  16300. sortable: false,
  16301. menuDisabled: true,
  16302. width: 120,
  16303. editor: {
  16304. selectOnFocus: true,
  16305. },
  16306. },
  16307. ],
  16308. },
  16309. ]
  16310. },
  16311. ]
  16312. },
  16313. ]
  16314. }
  16315. ]
  16316. }; //
  16317. //
  16318. //# sourceMappingURL=WidgetDesign.view.js.map
  16319. var WidgetDesign = /** @class */ (function (_super) {
  16320. __extends(WidgetDesign, _super);
  16321. function WidgetDesign(widgetPath, widgetName) {
  16322. var _this = _super.call(this, { model: model$i, vjson: vjson$i }) || this;
  16323. _this.widgetPath = widgetPath;
  16324. _this.widgetName = widgetName;
  16325. return _this;
  16326. }
  16327. WidgetDesign.prototype.onLoad = function () {
  16328. if (this.widgetPath) {
  16329. this.loadForm(this.widgetPath);
  16330. this.viewModel.set("widgetPath", this.widgetPath);
  16331. this.refs.wTitle.setReadOnly(true);
  16332. this.refs.wPath.setReadOnly(true);
  16333. }
  16334. else {
  16335. this.refs.wTitle.setReadOnly(false);
  16336. this.refs.wPath.setReadOnly(false);
  16337. }
  16338. };
  16339. WidgetDesign.prototype.load = function () {
  16340. var widgetPath = this.viewModel.get("widgetPath");
  16341. if (widgetPath) {
  16342. this.loadForm(widgetPath);
  16343. }
  16344. };
  16345. WidgetDesign.prototype.loadForm = function (widgetPath) {
  16346. var _this = this;
  16347. var me = this;
  16348. me.setLoading(true);
  16349. readWidget({ widgetPath: widgetPath }).then(function (res) {
  16350. msg$1(res.msg);
  16351. if (res.success) {
  16352. _this.viewModel.set("widgetPath", widgetPath);
  16353. me.refs.grid3.getStore().removeAll();
  16354. if (res.data.form.columns) {
  16355. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  16356. }
  16357. _this.viewModel.set("form.title", res.data.form.title);
  16358. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  16359. // set sql
  16360. _this.refs.sqlEditor.setCode(res.data.sql);
  16361. }
  16362. }).finally(function () {
  16363. me.setLoading(false);
  16364. });
  16365. };
  16366. WidgetDesign.prototype.widgetAdd = function (sender) {
  16367. var _this = this;
  16368. var title = this.viewModel.get("form.title");
  16369. if (title) {
  16370. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  16371. if (btn == 'yes') {
  16372. alert(1);
  16373. }
  16374. else {
  16375. alert(2);
  16376. }
  16377. });
  16378. }
  16379. else {
  16380. var me_1 = this;
  16381. var win_1 = new Ext.Window({
  16382. autoDestroy: true,
  16383. title: "新建弹框",
  16384. width: 400,
  16385. height: 220,
  16386. resizable: true,
  16387. closable: true,
  16388. maximizable: true,
  16389. minimizable: true,
  16390. plain: true,
  16391. // constrainHeader: true,
  16392. constrain: true,
  16393. layout: 'fit',
  16394. animateTarget: sender,
  16395. buttonAlign: 'center',
  16396. items: [
  16397. {
  16398. xtype: "form",
  16399. layout: "hbox",
  16400. margin: '10px 20px',
  16401. border: 0,
  16402. items: [
  16403. {
  16404. flex: 1,
  16405. layout: 'vbox',
  16406. items: [
  16407. {
  16408. xtype: "textfield",
  16409. name: "widgetcode",
  16410. fieldLabel: "弹框编号",
  16411. flex: 1,
  16412. allowBlank: false,
  16413. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  16414. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  16415. labelWidth: 50,
  16416. width: "100%",
  16417. },
  16418. {
  16419. xtype: "textfield",
  16420. name: "widgetname",
  16421. fieldLabel: "弹框名称",
  16422. flex: 1,
  16423. allowBlank: false,
  16424. labelWidth: 50,
  16425. width: "100%",
  16426. },
  16427. ]
  16428. },
  16429. ]
  16430. }
  16431. ],
  16432. //窗口按钮
  16433. buttons: [
  16434. {
  16435. xtype: 'button', text: '保存', handler: function (btn) {
  16436. //窗口获取表单
  16437. var form = win_1.down('form');
  16438. var vaildSuccess = form.isValid();
  16439. if (!vaildSuccess) {
  16440. return;
  16441. }
  16442. var title = form.down('textfield[name="widgetname"]').getValue();
  16443. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  16444. me_1.viewModel.set("form.title", title);
  16445. me_1.viewModel.set("widgetPath", widgetPath);
  16446. var formdata = _this.viewModel.get("form");
  16447. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  16448. if (res.success) {
  16449. msg$1('添加成功');
  16450. }
  16451. me_1.loadForm(widgetPath);
  16452. win_1.close();
  16453. });
  16454. }
  16455. },
  16456. {
  16457. xtype: 'button', text: '取消', handler: function (btn) {
  16458. //窗口关闭
  16459. win_1.close();
  16460. }
  16461. }
  16462. ]
  16463. });
  16464. win_1.show();
  16465. }
  16466. };
  16467. WidgetDesign.prototype.widgetSave = function () {
  16468. var _this = this;
  16469. var _a, _b;
  16470. var widgetPath = this.viewModel.get("widgetPath");
  16471. if (!widgetPath) {
  16472. msg$1("请选择或添加弹框后再保存!");
  16473. return;
  16474. }
  16475. var title = this.viewModel.get("form.title");
  16476. if (!title) {
  16477. msg$1("请选择或添加弹框后再保存!");
  16478. return;
  16479. }
  16480. // 获取条件
  16481. 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) {
  16482. delete r.id;
  16483. return r;
  16484. });
  16485. this.viewModel.set("form.conditions", conditions);
  16486. // 获取查询列
  16487. 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) {
  16488. delete r.id;
  16489. if (r.dict) {
  16490. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  16491. }
  16492. return r;
  16493. });
  16494. this.viewModel.set("form.columns", columns);
  16495. // sql
  16496. var sql = this.refs.sqlEditor.getCode();
  16497. this.viewModel.set("form.sql", sql);
  16498. var form = this.viewModel.get("form");
  16499. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  16500. msg$1(res.msg);
  16501. if (res.success) {
  16502. msg$1('保存成功');
  16503. _this.loadForm(widgetPath);
  16504. }
  16505. }).catch(function (res) {
  16506. });
  16507. };
  16508. WidgetDesign.prototype.delCondition = function () {
  16509. var _a;
  16510. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16511. };
  16512. WidgetDesign.prototype.delColumn = function () {
  16513. var _a;
  16514. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16515. };
  16516. WidgetDesign.prototype.calcCondition = function () {
  16517. var _this = this;
  16518. var sql = this.refs.sqlEditor.getCode();
  16519. var re = sql.matchAll(/#{(.+?)}/gi);
  16520. var rows = this.refs.grid2.getDataRows();
  16521. this.refs.grid2.setLoading(true);
  16522. parseDynamicSqlApi(sql).then(function (res) {
  16523. var e_1, _a;
  16524. if (res.success) {
  16525. var tables_1 = [];
  16526. _.forEach(res.data, function (parseItem) {
  16527. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  16528. if (tableName && !_.includes(tables_1, tableName)) {
  16529. tables_1.push(tableName);
  16530. }
  16531. });
  16532. var _loop_1 = function (m) {
  16533. var e_2, _a;
  16534. var columnName = m[1];
  16535. // 没有这个列才添加
  16536. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  16537. var meta = undefined;
  16538. try {
  16539. 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()) {
  16540. var tableName = tables_2_1.value;
  16541. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16542. if (meta) {
  16543. break;
  16544. }
  16545. }
  16546. }
  16547. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  16548. finally {
  16549. try {
  16550. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  16551. }
  16552. finally { if (e_2) throw e_2.error; }
  16553. }
  16554. if (meta) {
  16555. // 没找到元数据,直接添加
  16556. _this.refs.grid2.appendEditRow({
  16557. conditionFieldBind: columnName,
  16558. conditionFieldLabel: meta.column_comment,
  16559. conditionFieldXtype: 'textfield',
  16560. conditionFieldFlex: 1,
  16561. conditionFieldDict: '',
  16562. conditionFieldWrap: false,
  16563. });
  16564. }
  16565. else {
  16566. _this.refs.grid2.appendEditRow({
  16567. conditionFieldBind: columnName,
  16568. conditionFieldLabel: '',
  16569. conditionFieldXtype: 'textfield',
  16570. conditionFieldFlex: 1,
  16571. conditionFieldDict: '',
  16572. conditionFieldWrap: false,
  16573. });
  16574. }
  16575. }
  16576. };
  16577. try {
  16578. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  16579. var m = re_1_1.value;
  16580. _loop_1(m);
  16581. }
  16582. }
  16583. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  16584. finally {
  16585. try {
  16586. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  16587. }
  16588. finally { if (e_1) throw e_1.error; }
  16589. }
  16590. }
  16591. }).finally(function () {
  16592. _this.refs.grid2.setLoading(false);
  16593. });
  16594. };
  16595. WidgetDesign.prototype.calcColumn = function () {
  16596. var _this = this;
  16597. var sql = this.refs.sqlEditor.getCode();
  16598. var rows = this.refs.grid3.getDataRows();
  16599. this.refs.grid3.setLoading(true);
  16600. parseDynamicSqlApi(sql).then(function (res) {
  16601. _.forEach(res.data, function (parseItem) {
  16602. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  16603. // 是否找到重复字段
  16604. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  16605. if (exists) {
  16606. return;
  16607. }
  16608. if (tableName) {
  16609. // 解出表格名和字段名
  16610. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16611. if (meta) {
  16612. // 找到了元数据
  16613. var r = {
  16614. dataIndex: meta.column_name,
  16615. header: meta.column_comment,
  16616. xtype: '',
  16617. dataType: 'string',
  16618. dict: '',
  16619. };
  16620. if (meta.column_ui === 'combo' && meta.column_dict) {
  16621. r.dict = meta.column_dict;
  16622. }
  16623. else if (meta.column_ui === "checkbox") {
  16624. r.xtype = 'checkbox';
  16625. }
  16626. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  16627. r.dataType = meta.data_type;
  16628. }
  16629. _this.refs.grid3.appendEditRow(r);
  16630. return;
  16631. }
  16632. }
  16633. if (columnName) {
  16634. // 解出字段名
  16635. var r = {
  16636. dataIndex: columnName,
  16637. header: columnName,
  16638. xtype: '',
  16639. dataType: 'string',
  16640. dict: '',
  16641. };
  16642. _this.refs.grid3.appendEditRow(r);
  16643. }
  16644. });
  16645. }).finally(function () {
  16646. _this.refs.grid3.setLoading(false);
  16647. });
  16648. };
  16649. return WidgetDesign;
  16650. }(Scope));
  16651. //# sourceMappingURL=WidgetDesign.js.map
  16652. var model$j = {
  16653. data: {
  16654. // spreadsheet: false,
  16655. // multSelect: false,
  16656. // showCheckColumn: false,
  16657. // checkColumncheckOnly: false,
  16658. // disableSelection: false,
  16659. vjson: {
  16660. reference: '',
  16661. pagination: false,
  16662. pageSize: false,
  16663. pageSizeOption: false,
  16664. hideFootbar: false,
  16665. hideRefresh: false,
  16666. hideExport: false,
  16667. hideAutoSize: false,
  16668. hideClearFilter: false,
  16669. hideSaveGridUIConfig: false,
  16670. hideClearGridUIConfig: false,
  16671. selectMode: '',
  16672. cellediting_clicksToEdit: 1,
  16673. columnLines: false,
  16674. rowLines: false,
  16675. border: false,
  16676. autoLoad: false,
  16677. remoteSort: false,
  16678. remoteFilter: false,
  16679. enableLocking: false,
  16680. enableColumnHide: false,
  16681. enableColumnMove: false,
  16682. gridfilters: false,
  16683. enableColumnResize: false,
  16684. sortOnClick: false,
  16685. hidden: false,
  16686. cls: '',
  16687. dataSource: {
  16688. url: '',
  16689. params: {
  16690. formData: '{form}',
  16691. },
  16692. },
  16693. listeners: {
  16694. beforeselect: '',
  16695. selectionchange: '',
  16696. itemclick: '',
  16697. itemdblclick: '',
  16698. cellClick: '',
  16699. celldblclick: '',
  16700. afterrender: '',
  16701. destory: '',
  16702. }
  16703. },
  16704. }
  16705. };
  16706. //# sourceMappingURL=YvgridDesign.model.js.map
  16707. var vjson$j = {
  16708. title: '表格-高级',
  16709. height: 450,
  16710. width: 970,
  16711. layout: 'fit',
  16712. modal: true,
  16713. items: [
  16714. {
  16715. xtype: 'tabpanel',
  16716. items: [
  16717. {
  16718. title: '属性',
  16719. xtype: 'form',
  16720. scrollable: true,
  16721. items: [
  16722. {
  16723. xtype: 'cols',
  16724. items: [
  16725. {
  16726. xtype: 'textfield',
  16727. fieldLabel: '引用名',
  16728. tooltip: 'reference',
  16729. bind: '{vjson.reference}',
  16730. },
  16731. ]
  16732. },
  16733. {
  16734. xtype: 'cols',
  16735. border: false,
  16736. items: [
  16737. // 允许分页、页大小、页大小选项
  16738. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  16739. // 多选、显示勾选、自动勾选、
  16740. // 单击编辑、列分割线、行分割线、边框
  16741. // 数据源自动加载、后端排序、后端过滤
  16742. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  16743. {
  16744. xtype: 'checkbox',
  16745. fieldLabel: '允许分页',
  16746. bind: {
  16747. value: "{vjson.pagination}"
  16748. }
  16749. },
  16750. {
  16751. xtype: 'numberfield',
  16752. fieldLabel: '页大小',
  16753. bind: '{vjson.pageSize}',
  16754. },
  16755. {
  16756. xtype: 'textfield',
  16757. fieldLabel: '页大小选项',
  16758. flex: 2,
  16759. bind: '{vjson.pageSizeOption}',
  16760. },
  16761. ]
  16762. },
  16763. {
  16764. layout: 'hbox',
  16765. border: false,
  16766. items: [
  16767. {
  16768. xtype: 'combo',
  16769. fieldLabel: '选择模式',
  16770. flex: 4,
  16771. data: [
  16772. { id: 'spreadsheet', text: 'Excel模式' },
  16773. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  16774. { id: 'checkColumn', text: '勾选框' },
  16775. { id: 'row_mulity', text: '行选择-允许多选' },
  16776. { id: 'row_single', text: '行选择-单选' },
  16777. { id: 'disableSelection', text: '禁用' },
  16778. ],
  16779. bind: {
  16780. value: '{vjson.selectMode}'
  16781. }
  16782. }
  16783. ]
  16784. },
  16785. {
  16786. layout: 'hbox',
  16787. border: false,
  16788. defaults: {
  16789. xtype: 'checkbox',
  16790. margin: '0 15 0 0',
  16791. },
  16792. items: [
  16793. {
  16794. xtype: 'container',
  16795. margin: '3',
  16796. border: false,
  16797. width: 80,
  16798. },
  16799. {
  16800. boxLabel: '隐藏底部',
  16801. bind: {
  16802. value: "{vjson.hideFootbar}"
  16803. }
  16804. },
  16805. {
  16806. boxLabel: '隐藏刷新',
  16807. bind: {
  16808. value: "{vjson.hideRefresh}"
  16809. }
  16810. },
  16811. {
  16812. boxLabel: '隐藏导出',
  16813. bind: {
  16814. value: "{vjson.hideExport}"
  16815. }
  16816. },
  16817. {
  16818. boxLabel: '隐藏自动调宽',
  16819. bind: {
  16820. value: "{vjson.hideAutoSize}"
  16821. }
  16822. },
  16823. {
  16824. boxLabel: '隐藏清空筛选',
  16825. bind: {
  16826. value: "{vjson.hideClearFilter}"
  16827. }
  16828. },
  16829. {
  16830. boxLabel: '隐藏保存布局',
  16831. bind: {
  16832. value: "{vjson.hideSaveGridUIConfig}"
  16833. }
  16834. },
  16835. {
  16836. boxLabel: '隐藏重置布局',
  16837. bind: {
  16838. value: "{vjson.hideClearGridUIConfig}"
  16839. }
  16840. },
  16841. ]
  16842. },
  16843. {
  16844. layout: 'hbox',
  16845. border: false,
  16846. defaults: {
  16847. xtype: 'checkbox',
  16848. margin: '0 15 0 0',
  16849. },
  16850. items: [
  16851. {
  16852. xtype: 'container',
  16853. margin: '3',
  16854. border: false,
  16855. width: 80
  16856. },
  16857. {
  16858. boxLabel: '单击编辑',
  16859. bind: {
  16860. value: "{vjson.cellediting_clicksToEdit}"
  16861. }
  16862. },
  16863. {
  16864. boxLabel: '列分隔线',
  16865. bind: {
  16866. value: "{vjson.columnLines}"
  16867. }
  16868. },
  16869. {
  16870. boxLabel: '行分隔线',
  16871. bind: {
  16872. value: "{vjson.rowLines}"
  16873. }
  16874. },
  16875. {
  16876. boxLabel: '边框',
  16877. bind: {
  16878. value: "{vjson.border}"
  16879. }
  16880. },
  16881. ]
  16882. },
  16883. {
  16884. layout: 'hbox',
  16885. border: false,
  16886. defaults: {
  16887. xtype: 'checkbox',
  16888. margin: '0 15 0 0',
  16889. },
  16890. items: [
  16891. {
  16892. xtype: 'container',
  16893. margin: '3',
  16894. border: false,
  16895. width: 80
  16896. },
  16897. {
  16898. boxLabel: '数据源自动加载',
  16899. bind: {
  16900. value: "{vjson.autoLoad}"
  16901. }
  16902. },
  16903. {
  16904. boxLabel: '后端排序',
  16905. bind: {
  16906. value: "{vjson.remoteSort}"
  16907. }
  16908. },
  16909. {
  16910. boxLabel: '后端过滤',
  16911. bind: {
  16912. value: "{vjson.remoteFilter}"
  16913. }
  16914. },
  16915. ]
  16916. },
  16917. {
  16918. layout: 'hbox',
  16919. border: false,
  16920. defaults: {
  16921. xtype: 'checkbox',
  16922. margin: '0 15 0 0',
  16923. },
  16924. items: [
  16925. {
  16926. xtype: 'container',
  16927. margin: '3',
  16928. border: false,
  16929. width: 80
  16930. },
  16931. {
  16932. boxLabel: '自定义锁定',
  16933. bind: {
  16934. value: "{vjson.enableLocking}"
  16935. }
  16936. },
  16937. {
  16938. boxLabel: '自定义隐藏',
  16939. bind: {
  16940. value: "{vjson.enableColumnHide}"
  16941. }
  16942. },
  16943. {
  16944. boxLabel: '用户拖拽字段',
  16945. bind: {
  16946. value: "{vjson.enableColumnMove}"
  16947. }
  16948. },
  16949. {
  16950. boxLabel: '自定义筛选',
  16951. bind: {
  16952. value: "{vjson.gridfilters}"
  16953. }
  16954. },
  16955. {
  16956. boxLabel: '用户拖拽字段宽度',
  16957. bind: {
  16958. value: "{vjson.enableColumnResize}"
  16959. }
  16960. },
  16961. {
  16962. boxLabel: '点击列头排序',
  16963. bind: {
  16964. value: "{vjson.sortOnClick}"
  16965. }
  16966. },
  16967. {
  16968. xtype: 'checkbox',
  16969. boxLabel: '隐藏',
  16970. bind: {
  16971. value: "{vjson.hidden}"
  16972. }
  16973. },
  16974. ]
  16975. },
  16976. {
  16977. xtype: 'cols',
  16978. items: [
  16979. {
  16980. xtype: 'textfield',
  16981. fieldLabel: '样式',
  16982. bind: '{vjson.cls}',
  16983. flex: 4
  16984. },
  16985. ]
  16986. },
  16987. ]
  16988. },
  16989. {
  16990. title: '字段',
  16991. xtype: 'yvgrid',
  16992. reference: 'grid1',
  16993. pagination: false,
  16994. hideFootbar: true,
  16995. plugins: {
  16996. clipboard: true,
  16997. selectionreplicator: true
  16998. },
  16999. selModel: {
  17000. type: 'spreadsheet',
  17001. columnSelect: true,
  17002. pruneRemoved: false,
  17003. extensible: 'y'
  17004. },
  17005. listeners: {
  17006. editfinish: 'scope.gridEditFinish',
  17007. },
  17008. tbar: {
  17009. xtype: 'toolbar',
  17010. items: [
  17011. {
  17012. xtype: 'button',
  17013. text: '添加',
  17014. iconCls: 'x-fa fa-plus-circle',
  17015. listeners: {
  17016. click: 'scope.addColumn'
  17017. }
  17018. },
  17019. {
  17020. xtype: 'button',
  17021. text: '删除',
  17022. iconCls: 'x-fa fa-minus-circle',
  17023. listeners: {
  17024. click: 'scope.removeColumn'
  17025. }
  17026. },
  17027. '-',
  17028. {
  17029. xtype: 'button',
  17030. text: '自动分析',
  17031. iconCls: 'x-fa fa-code-fork',
  17032. listeners: {
  17033. click: 'scope.calcColumn'
  17034. }
  17035. },
  17036. {
  17037. xtype: 'button',
  17038. text: '上移',
  17039. iconCls: 'x-fa fa-arrow-up',
  17040. listeners: {
  17041. click: 'scope.moveUp'
  17042. }
  17043. },
  17044. {
  17045. xtype: 'button',
  17046. text: '下移',
  17047. iconCls: 'x-fa fa-arrow-down',
  17048. listeners: {
  17049. click: 'scope.moveDown'
  17050. }
  17051. },
  17052. ]
  17053. },
  17054. columns: [
  17055. { xtype: 'rownumberer' },
  17056. {
  17057. text: '字段',
  17058. dataIndex: 'dataIndex',
  17059. width: 140,
  17060. sortable: false,
  17061. menuDisabled: true,
  17062. editor: {
  17063. selectOnFocus: true,
  17064. },
  17065. },
  17066. {
  17067. text: '标题',
  17068. dataIndex: 'header',
  17069. width: 120,
  17070. sortable: false,
  17071. menuDisabled: true,
  17072. editor: {
  17073. selectOnFocus: true,
  17074. },
  17075. },
  17076. {
  17077. text: '类型',
  17078. dataIndex: 'xtype',
  17079. width: 100,
  17080. sortable: false,
  17081. menuDisabled: true,
  17082. editor: {
  17083. xtype: 'combo',
  17084. typeAhead: true,
  17085. triggerAction: 'all',
  17086. selectOnFocus: false,
  17087. listConfig: {
  17088. minWidth: 200
  17089. },
  17090. store: [
  17091. ['', '默认'],
  17092. ['rownum', 'rownum'],
  17093. ['checkcolumn', 'checkcolumn'],
  17094. ]
  17095. },
  17096. },
  17097. {
  17098. text: '数据类型',
  17099. dataIndex: 'dataType',
  17100. width: 100,
  17101. sortable: false,
  17102. menuDisabled: true,
  17103. editor: {
  17104. xtype: 'combo',
  17105. selectOnFocus: true,
  17106. listConfig: {
  17107. minWidth: 200
  17108. },
  17109. store: [
  17110. ['', '默认'],
  17111. ['string', 'string'],
  17112. ['number', 'number'],
  17113. ['date', 'date'],
  17114. ]
  17115. },
  17116. },
  17117. {
  17118. text: '编辑模式',
  17119. dataIndex: 'editor',
  17120. width: 100,
  17121. sortable: false,
  17122. menuDisabled: true,
  17123. editor: {
  17124. xtype: 'combo',
  17125. selectOnFocus: true,
  17126. listConfig: {
  17127. minWidth: 200
  17128. },
  17129. store: [
  17130. ['', ''],
  17131. ['textfield', 'textfield'],
  17132. ['numberfield', 'numberfield'],
  17133. ['combo', 'combo'],
  17134. ['combogrid', 'combogrid'],
  17135. ['datefield', 'datefield'],
  17136. ]
  17137. },
  17138. },
  17139. {
  17140. text: '宽度',
  17141. dataIndex: 'width',
  17142. align: 'right',
  17143. width: 100,
  17144. sortable: false,
  17145. menuDisabled: true,
  17146. editor: {
  17147. xtype: 'numberfield',
  17148. selectOnFocus: true,
  17149. minValue: 0,
  17150. maxValue: 1000
  17151. },
  17152. },
  17153. {
  17154. text: '权重',
  17155. dataIndex: 'flex',
  17156. align: 'right',
  17157. width: 90,
  17158. sortable: false,
  17159. menuDisabled: true,
  17160. editor: {
  17161. xtype: 'numberfield',
  17162. selectOnFocus: true,
  17163. minValue: 0,
  17164. maxValue: 10
  17165. },
  17166. },
  17167. {
  17168. text: '字典',
  17169. dataIndex: 'dict',
  17170. sortable: false,
  17171. menuDisabled: true,
  17172. width: 210,
  17173. editor: {
  17174. selectOnFocus: true,
  17175. },
  17176. },
  17177. {
  17178. text: '对齐',
  17179. dataIndex: 'align',
  17180. width: 90,
  17181. sortable: false,
  17182. menuDisabled: true,
  17183. editor: {
  17184. xtype: 'combo',
  17185. selectOnFocus: true,
  17186. listConfig: {
  17187. minWidth: 120
  17188. },
  17189. store: [
  17190. ['start', 'start'],
  17191. ['center', 'center'],
  17192. ['end', 'end'],
  17193. ]
  17194. },
  17195. },
  17196. {
  17197. text: '必填',
  17198. dataIndex: 'notAllowBlank',
  17199. width: 50,
  17200. resizable: false,
  17201. sortable: false,
  17202. menuDisabled: true,
  17203. xtype: 'checkcolumn',
  17204. },
  17205. {
  17206. text: '禁用',
  17207. dataIndex: 'disabled',
  17208. width: 50,
  17209. resizable: false,
  17210. sortable: false,
  17211. menuDisabled: true,
  17212. xtype: 'checkcolumn',
  17213. },
  17214. {
  17215. text: '禁菜',
  17216. dataIndex: 'menuDisabled',
  17217. width: 50,
  17218. resizable: false,
  17219. sortable: false,
  17220. menuDisabled: true,
  17221. xtype: 'checkcolumn',
  17222. },
  17223. {
  17224. text: '过滤',
  17225. dataIndex: 'filterable',
  17226. xtype: 'checkcolumn',
  17227. width: 50,
  17228. resizable: false,
  17229. sortable: false,
  17230. menuDisabled: true,
  17231. },
  17232. {
  17233. text: '隐藏',
  17234. dataIndex: 'hidden',
  17235. xtype: 'checkcolumn',
  17236. width: 50,
  17237. resizable: false,
  17238. sortable: false,
  17239. menuDisabled: true,
  17240. },
  17241. {
  17242. text: '可隐',
  17243. dataIndex: 'hideable',
  17244. xtype: 'checkcolumn',
  17245. width: 50,
  17246. resizable: false,
  17247. sortable: false,
  17248. menuDisabled: true,
  17249. },
  17250. {
  17251. text: '调宽',
  17252. dataIndex: 'resizable',
  17253. xtype: 'checkcolumn',
  17254. width: 50,
  17255. resizable: false,
  17256. sortable: false,
  17257. menuDisabled: true,
  17258. },
  17259. {
  17260. text: '排序',
  17261. dataIndex: 'sortable',
  17262. xtype: 'checkcolumn',
  17263. width: 50,
  17264. resizable: false,
  17265. sortable: false,
  17266. menuDisabled: true,
  17267. },
  17268. {
  17269. text: '适宽',
  17270. dataIndex: 'autoSize',
  17271. xtype: 'checkcolumn',
  17272. width: 50,
  17273. resizable: false,
  17274. sortable: false,
  17275. menuDisabled: true,
  17276. },
  17277. ],
  17278. },
  17279. {
  17280. title: '数据源',
  17281. layout: 'border',
  17282. listeners: {
  17283. activate: 'scope.dataSourceActivate'
  17284. },
  17285. items: [
  17286. {
  17287. region: 'north',
  17288. xtype: 'toolbar',
  17289. border: false,
  17290. items: [
  17291. {
  17292. xtype: 'textfield',
  17293. fieldLabel: '数据源',
  17294. flex: 1,
  17295. bind: {
  17296. value: '{vjson.dataSource.url}'
  17297. }
  17298. },
  17299. {
  17300. xtype: 'button',
  17301. text: '保存',
  17302. iconCls: 'x-fa fa-save',
  17303. listeners: {
  17304. click: 'scope.dataSourceSave'
  17305. }
  17306. },
  17307. {
  17308. xtype: 'button',
  17309. text: '读取',
  17310. iconCls: 'x-fa fa-folder-open',
  17311. listeners: {
  17312. click: 'scope.reloadSqlContent'
  17313. }
  17314. },
  17315. ]
  17316. },
  17317. {
  17318. region: 'center',
  17319. xtype: 'sqleditor',
  17320. layout: 'fit',
  17321. reference: 'sqlEditor',
  17322. },
  17323. {
  17324. region: 'south',
  17325. xtype: 'jsoneditor',
  17326. height: 200,
  17327. split: true,
  17328. collapsible: true,
  17329. title: '参数',
  17330. reference: 'sqlParams',
  17331. }
  17332. ]
  17333. },
  17334. {
  17335. title: '事件',
  17336. xtype: 'form',
  17337. scrollable: true,
  17338. margin: '10',
  17339. defaults: {
  17340. width: '100%',
  17341. labelAlign: 'top',
  17342. },
  17343. items: [
  17344. {
  17345. xtype: 'textfield',
  17346. fieldLabel: '选中前触发 beforeSelect',
  17347. bind: {
  17348. value: '{vjson.listeners.beforeselect}'
  17349. },
  17350. },
  17351. {
  17352. xtype: 'textfield',
  17353. fieldLabel: '选择范围改变 selectionChange',
  17354. bind: {
  17355. value: '{vjson.listeners.selectionchange}'
  17356. },
  17357. },
  17358. {
  17359. xtype: 'textfield',
  17360. fieldLabel: '行点击 itemClick',
  17361. bind: {
  17362. value: '{vjson.listeners.itemclick}'
  17363. },
  17364. },
  17365. {
  17366. xtype: 'textfield',
  17367. fieldLabel: '行双击 itemDblClick',
  17368. bind: {
  17369. value: '{vjson.listeners.itemdblclick}'
  17370. },
  17371. },
  17372. {
  17373. xtype: 'textfield',
  17374. fieldLabel: '单元格点击 cellClick',
  17375. bind: {
  17376. value: '{vjson.listeners.cellClick}'
  17377. },
  17378. },
  17379. {
  17380. xtype: 'textfield',
  17381. fieldLabel: '单元格双击 cellDblClick',
  17382. bind: {
  17383. value: '{vjson.listeners.celldblclick}'
  17384. },
  17385. },
  17386. {
  17387. xtype: 'textfield',
  17388. fieldLabel: '渲染后触发 afterrender',
  17389. bind: {
  17390. value: '{vjson.listeners.afterrender}'
  17391. },
  17392. },
  17393. {
  17394. xtype: 'textfield',
  17395. fieldLabel: '销毁后触发 destory',
  17396. bind: {
  17397. value: '{vjson.listeners.destory}'
  17398. },
  17399. },
  17400. ]
  17401. },
  17402. ],
  17403. }
  17404. ],
  17405. fbar: [
  17406. {
  17407. text: '应用', iconCls: 'x-fa fa-save',
  17408. listeners: {
  17409. click: 'scope.save'
  17410. }
  17411. },
  17412. '-',
  17413. {
  17414. text: '确定', iconCls: 'x-fa fa-check-circle',
  17415. listeners: {
  17416. click: 'scope.saveClose'
  17417. }
  17418. },
  17419. {
  17420. text: '取消', iconCls: 'x-fa fa-times-circle',
  17421. listeners: {
  17422. click: 'system.closeMe()'
  17423. }
  17424. },
  17425. ]
  17426. };
  17427. //# sourceMappingURL=YvgridDesign.view.js.map
  17428. var VjsonExchange = /** @class */ (function () {
  17429. function VjsonExchange(vjson) {
  17430. this.pendingSet = true;
  17431. this.vjsonOrigin = _$2.cloneDeep(vjson);
  17432. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  17433. }
  17434. /**
  17435. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  17436. * @param propName
  17437. * @param value
  17438. */
  17439. VjsonExchange.prototype.setPropValue = function (propName, value) {
  17440. if (this.pendingSet) {
  17441. return;
  17442. }
  17443. // selectMode
  17444. // pageSizeOption
  17445. // cellediting_clicksToEdit
  17446. msg$1('' + propName + '=' + value);
  17447. _$2.set(this.vjson, propName, value);
  17448. };
  17449. /**
  17450. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  17451. */
  17452. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  17453. var _a, _b, _c;
  17454. if (this.pendingSet) {
  17455. return;
  17456. }
  17457. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  17458. // 如果不使用默认属性,就直接设定 undefined
  17459. var vs = {
  17460. dataIndex: undefined,
  17461. header: undefined,
  17462. xtype: '',
  17463. width: undefined,
  17464. flex: undefined,
  17465. align: 'start',
  17466. editor: undefined,
  17467. dataType: 'string',
  17468. dict: undefined,
  17469. disabled: false,
  17470. menuDisabled: false,
  17471. notAllowBlank: false,
  17472. filterable: true,
  17473. hidden: false,
  17474. hideable: true,
  17475. resizable: true,
  17476. sortable: true,
  17477. autoSize: true,
  17478. };
  17479. var raw = record.get('raw');
  17480. if (raw === undefined || raw == null) {
  17481. raw = {};
  17482. record.set('raw', raw);
  17483. }
  17484. var setRaw = function (propName, value) {
  17485. if (typeof value === 'undefined' || value == null) {
  17486. msg$1("delete columns[" + rowIdx + "]." + propName);
  17487. delete raw[propName];
  17488. return;
  17489. }
  17490. var defaultValue = vs[propName];
  17491. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  17492. // 要设的值,与默认值相同,就直接删除这个属性
  17493. msg$1("delete columns[" + rowIdx + "]." + propName);
  17494. delete raw[propName];
  17495. return;
  17496. }
  17497. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  17498. _$2.set(raw, propName, value);
  17499. };
  17500. if (!vs.hasOwnProperty(propName)) {
  17501. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  17502. return;
  17503. }
  17504. else if (propName === 'dict') {
  17505. if (value) {
  17506. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  17507. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  17508. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  17509. }
  17510. }
  17511. else {
  17512. setRaw('fix', undefined);
  17513. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  17514. msg$1("delete columns[" + rowIdx + "].editor.fix");
  17515. delete raw.editor.fix;
  17516. }
  17517. }
  17518. }
  17519. else if (propName === 'xtype') {
  17520. if (!value) {
  17521. setRaw('xtype', undefined);
  17522. }
  17523. else {
  17524. setRaw('xtype', value);
  17525. }
  17526. }
  17527. else if (propName === 'notAllowBlank') {
  17528. setRaw('editor.allowBlank', !value);
  17529. }
  17530. else if (propName === 'editor') {
  17531. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  17532. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  17533. value = undefined;
  17534. }
  17535. // editor.xtype
  17536. if (!value) {
  17537. // 不需要编辑器
  17538. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  17539. msg$1("delete columns[" + rowIdx + "].editor");
  17540. delete raw.editor;
  17541. record.set('notAllowBlank', false);
  17542. }
  17543. }
  17544. else {
  17545. setRaw('editor.xtype', value);
  17546. var dict = record.get('dict');
  17547. if (value === 'combo' && dict) {
  17548. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  17549. }
  17550. }
  17551. }
  17552. else if (propName === 'width') {
  17553. var width = value;
  17554. var flex = record.get('flex');
  17555. if (!width && !flex) {
  17556. setRaw('width', undefined);
  17557. setRaw('flex', undefined);
  17558. record.set('flex', undefined);
  17559. record.set('width', undefined);
  17560. return;
  17561. }
  17562. else if (!!width) {
  17563. setRaw('flex', undefined);
  17564. record.set('flex', undefined);
  17565. setRaw('width', width);
  17566. return;
  17567. }
  17568. }
  17569. else if (propName === 'flex') {
  17570. var width = record.get('width');
  17571. var flex = value;
  17572. if (!width && !flex) {
  17573. setRaw('width', undefined);
  17574. setRaw('flex', undefined);
  17575. record.set('flex', undefined);
  17576. record.set('width', undefined);
  17577. return;
  17578. }
  17579. else if (!!flex) {
  17580. setRaw('width', undefined);
  17581. record.set('width', undefined);
  17582. setRaw('flex', flex);
  17583. return;
  17584. }
  17585. }
  17586. else {
  17587. // 其他属性,作为同名属性,与 raw 同步
  17588. setRaw(propName, value);
  17589. }
  17590. };
  17591. /**
  17592. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  17593. */
  17594. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  17595. var _this = this;
  17596. var vs = [
  17597. 'reference', 'pagination', 'pageSize',
  17598. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  17599. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  17600. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  17601. 'listeners.beforeselect',
  17602. 'listeners.selectionchange',
  17603. 'listeners.itemclick',
  17604. 'listeners.itemdblclick',
  17605. 'listeners.cellClick',
  17606. 'listeners.celldblclick',
  17607. 'listeners.afterrender',
  17608. 'listeners.destory',
  17609. ];
  17610. _$2.forEach(vs, function (v) {
  17611. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  17612. });
  17613. };
  17614. VjsonExchange.prototype.bindChangeProp = function (propName) {
  17615. var me = this;
  17616. return function (value) {
  17617. me.setPropValue(propName, value);
  17618. };
  17619. };
  17620. VjsonExchange.prototype.parseModel = function () {
  17621. var _this = this;
  17622. 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;
  17623. //@ts-ignore
  17624. var df = YvanUI.Defaults.grid;
  17625. var vjson = _$2.assign({}, df, this.vjson);
  17626. var model = {
  17627. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  17628. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  17629. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  17630. pageSizeOption: '["20", "50", "100", "200", "300"]',
  17631. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  17632. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  17633. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  17634. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  17635. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  17636. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  17637. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  17638. selectMode: 'spreadsheet',
  17639. cellediting_clicksToEdit: true,
  17640. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  17641. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  17642. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  17643. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  17644. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  17645. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  17646. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  17647. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  17648. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  17649. gridfilters: true,
  17650. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  17651. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  17652. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  17653. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  17654. columns: [],
  17655. listeners: {
  17656. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  17657. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  17658. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  17659. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  17660. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  17661. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  17662. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  17663. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  17664. }
  17665. };
  17666. if (_$2.isArray(this.vjson.pageSizeOption)) {
  17667. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  17668. }
  17669. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  17670. if (_$2.get(vjson, 'disableSelection') == true) {
  17671. model.selectMode = 'disableSelection';
  17672. }
  17673. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  17674. model.selectMode = 'spreadsheet';
  17675. }
  17676. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  17677. model.selectMode = 'onlyCheckColumn';
  17678. }
  17679. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  17680. model.selectMode = 'checkColumn';
  17681. }
  17682. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  17683. model.selectMode = 'row_mulity';
  17684. }
  17685. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  17686. model.selectMode = 'row_single';
  17687. }
  17688. else {
  17689. model.selectMode = 'row_single';
  17690. }
  17691. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  17692. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  17693. model.dataSource = {
  17694. url: _$2.get(vjson, 'dataSource.url'),
  17695. //@ts-ignore
  17696. params: _$2.get(vjson, 'dataSource.params')
  17697. };
  17698. }
  17699. _$2.forEach(vjson.columns, function (column) {
  17700. model.columns.push(_this.parseColumn(column));
  17701. });
  17702. return model;
  17703. };
  17704. VjsonExchange.prototype.parseColumn = function (column) {
  17705. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  17706. var model = {
  17707. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  17708. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  17709. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  17710. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  17711. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  17712. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  17713. editor: '',
  17714. editParam: '',
  17715. dict: '',
  17716. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  17717. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  17718. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  17719. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  17720. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  17721. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  17722. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  17723. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  17724. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  17725. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  17726. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  17727. raw: _$2.cloneDeep(column),
  17728. };
  17729. // width / flex 只能留一个属性, 或者全不留
  17730. if (model.width <= 0 && model.flex <= 0) {
  17731. delete model.width;
  17732. delete model.flex;
  17733. }
  17734. else if (model.width > 0) {
  17735. delete model.flex;
  17736. }
  17737. else {
  17738. delete model.width;
  17739. }
  17740. // editor
  17741. if (_$2.isObject(_$2.get(column, 'editor'))) {
  17742. model.editor = _$2.get(column, 'editor.xtype');
  17743. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  17744. if (!model.editor) {
  17745. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  17746. model.editor = 'textfield';
  17747. }
  17748. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  17749. msg$1('不可识别的 editor.xtype=' + model.editor);
  17750. console.error('不可识别的 editor.xtype', column);
  17751. }
  17752. if (_$2.get(column, 'editor.allowBlank') === false) {
  17753. model.notAllowBlank = true;
  17754. }
  17755. }
  17756. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  17757. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  17758. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  17759. if (match && match[1]) {
  17760. model.dict = match[1];
  17761. }
  17762. }
  17763. return model;
  17764. };
  17765. return VjsonExchange;
  17766. }());
  17767. //
  17768. //# sourceMappingURL=YvgridExchange.js.map
  17769. var YvgridDesign = /** @class */ (function (_super) {
  17770. __extends(YvgridDesign, _super);
  17771. function YvgridDesign(moduleId) {
  17772. var _this = _super.call(this, { model: model$j, vjson: vjson$j }) || this;
  17773. _this.moduleId = '';
  17774. _this.name = 'YvgridDesign';
  17775. _this.dataSourceIsActived = false;
  17776. _this.setModuleId(moduleId);
  17777. return _this;
  17778. }
  17779. YvgridDesign.prototype.setModuleId = function (moduleId) {
  17780. var _this = this;
  17781. this.moduleId = moduleId;
  17782. if (this.componentSelectionChangeSubscribe) {
  17783. this.componentSelectionChangeSubscribe.cancel();
  17784. this.componentSelectionChangeSubscribe = null;
  17785. }
  17786. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  17787. var id = _a.id, from = _a.from;
  17788. _this.onComponentSelectionChange(id, from);
  17789. });
  17790. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  17791. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  17792. if (vj.xtype !== 'yvgrid') {
  17793. throw Error('非 yvgrid 组件');
  17794. }
  17795. this.vjsonExchange = new VjsonExchange(vj);
  17796. };
  17797. YvgridDesign.prototype.onLoad = function () {
  17798. var _this = this;
  17799. var model = this.vjsonExchange.parseModel();
  17800. this.vjsonExchange.pendingSet = true;
  17801. mergeViewModel(this.viewModel, "vjson", model, false);
  17802. this.refs.grid1.setData(model.columns);
  17803. this.vjsonExchange.attachViewModel(this.viewModel);
  17804. _$2.defer(function () {
  17805. _this.vjsonExchange.pendingSet = false;
  17806. });
  17807. };
  17808. YvgridDesign.prototype.moveUp = function (sender) {
  17809. var grid = sender.up('grid');
  17810. grid.rowMoveUp();
  17811. };
  17812. YvgridDesign.prototype.moveDown = function (sender) {
  17813. var grid = sender.up('grid');
  17814. grid.rowMoveDown();
  17815. };
  17816. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  17817. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  17818. };
  17819. YvgridDesign.prototype.reloadSqlContent = function () {
  17820. var _this = this;
  17821. var url = this.viewModel.get('vjson.dataSource.url');
  17822. if (url) {
  17823. loadSqlContentApi(url).then(function (res) {
  17824. _this.refs.sqlEditor.setCode('');
  17825. if (res.success) {
  17826. _this.refs.sqlEditor.setCode(res.data.content);
  17827. }
  17828. }).catch(function () {
  17829. _this.refs.sqlEditor.setCode('');
  17830. });
  17831. }
  17832. };
  17833. YvgridDesign.prototype.dataSourceSave = function () {
  17834. var url = this.viewModel.get('vjson.dataSource.url');
  17835. if (!url) {
  17836. msg$1('必须填写 groovy/SQL 模块路径');
  17837. return;
  17838. }
  17839. var content = this.refs.sqlEditor.getCode();
  17840. saveSqlContentApi(url, content).then(function (res) {
  17841. if (res.success) {
  17842. msg$1('保存成功');
  17843. }
  17844. else {
  17845. msg$1(res.msg);
  17846. }
  17847. });
  17848. };
  17849. YvgridDesign.prototype.dataSourceActivate = function () {
  17850. if (!this.dataSourceIsActived) {
  17851. // 激活
  17852. this.reloadSqlContent();
  17853. var params = this.viewModel.get('vjson.dataSource.params');
  17854. if (_$2.isObject(params)) {
  17855. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  17856. }
  17857. this.dataSourceIsActived = true;
  17858. }
  17859. };
  17860. // 外部控件选择发生改变
  17861. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  17862. if (!id || from === this.name) {
  17863. return;
  17864. }
  17865. this.setVjson(id);
  17866. };
  17867. YvgridDesign.prototype.setVjson = function (id) {
  17868. // 找到对应的组件 判断是不是表格
  17869. };
  17870. YvgridDesign.prototype.save = function () {
  17871. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  17872. if (this.dataSourceIsActived) {
  17873. var url = this.viewModel.get('vjson.dataSource.url');
  17874. // 解析 params
  17875. var paramsString = this.refs.sqlParams.getCode('');
  17876. var params = undefined;
  17877. if (paramsString) {
  17878. try {
  17879. params = window['YvanUI'].json5.parse(paramsString);
  17880. }
  17881. catch (e) {
  17882. msg$1('dataSource.params 格式非法,请检查');
  17883. return;
  17884. }
  17885. }
  17886. if (typeof params === 'undefined') {
  17887. params = this.viewModel.get('vjson.dataSource.params');
  17888. }
  17889. if (url) {
  17890. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  17891. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  17892. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  17893. }
  17894. else {
  17895. delete this.vjsonExchange.vjson['dataSource'];
  17896. }
  17897. }
  17898. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  17899. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  17900. from: this.name,
  17901. ignoreRenderUI: false
  17902. });
  17903. };
  17904. YvgridDesign.prototype.saveClose = function () {
  17905. this.save();
  17906. this.close();
  17907. };
  17908. YvgridDesign.prototype.addColumn = function () {
  17909. this.refs.grid1.appendEditRow({
  17910. dataIndex: '',
  17911. header: '',
  17912. xtype: '',
  17913. width: 80,
  17914. align: '',
  17915. editor: '',
  17916. editParam: '',
  17917. dict: '',
  17918. disabled: false,
  17919. notAllowBlank: false,
  17920. menuDisabled: false,
  17921. filterable: false,
  17922. hidden: false,
  17923. hideable: true,
  17924. resizable: true,
  17925. sortable: true,
  17926. locked: false,
  17927. lockable: false,
  17928. autoSize: true,
  17929. raw: undefined,
  17930. }, 'header');
  17931. };
  17932. YvgridDesign.prototype.removeColumn = function () {
  17933. var _this = this;
  17934. var rows = [];
  17935. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  17936. rows.push(r);
  17937. });
  17938. _$2.forEach(rows, function (r) {
  17939. _this.refs.grid1.getStore().remove(r);
  17940. });
  17941. };
  17942. YvgridDesign.prototype.calcColumn = function () {
  17943. msg$1('暂未实现');
  17944. };
  17945. YvgridDesign.prototype.onDestroy = function () {
  17946. if (this.componentSelectionChangeSubscribe) {
  17947. this.componentSelectionChangeSubscribe.cancel();
  17948. this.componentSelectionChangeSubscribe = null;
  17949. }
  17950. };
  17951. return YvgridDesign;
  17952. }(Scope));
  17953. //# sourceMappingURL=YvgridDesign.js.map
  17954. var YvanUI$1 = window['YvanUI'];
  17955. var _$1 = window["_"];
  17956. var Ext$1 = window['Ext'];
  17957. var $$1 = window["$"];
  17958. var historySize = 100;
  17959. var ViewDesign = /** @class */ (function () {
  17960. function ViewDesign(moduleId, reference) {
  17961. var _this = this;
  17962. this.name = "ViewDesign";
  17963. this.expandedVjsonObjArray = [];
  17964. // 编辑历史
  17965. this.undoVjsonList = [];
  17966. // 撤销历史
  17967. this.redoVjsonList = [];
  17968. // 订阅事件列表
  17969. this.subscribeList = [];
  17970. // private getOuterCopyValueTimer: any = null
  17971. /**
  17972. * 唯一编号
  17973. */
  17974. this.id = _$1.uniqueId("_dv");
  17975. this.moduleId = moduleId;
  17976. this.moduleObject = moduleStore.getModuleObject(moduleId);
  17977. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  17978. this.designReference = reference;
  17979. this.designElement = reference.ariaEl.dom;
  17980. this.$overlay.appendTo(this.designElement);
  17981. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  17982. // 添加到撤销
  17983. this.lastVjson = _$1.cloneDeep(this.vjson);
  17984. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  17985. event.stopPropagation();
  17986. event.preventDefault();
  17987. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  17988. });
  17989. this.$overlay.on('click', '.studio_mask', function (event) {
  17990. event.stopPropagation();
  17991. event.preventDefault();
  17992. _this.clearSelection();
  17993. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  17994. _$1.defer(function () {
  17995. _this.$overlay.focus();
  17996. });
  17997. });
  17998. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  17999. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  18000. this.$overlay.on('copy', this.onCopy.bind(this));
  18001. this.$overlay.on('paste', this.onPaste.bind(this));
  18002. this.$overlay.on('focus', this.onfocus.bind(this));
  18003. // this.$overlay.on('mouseenter', ()=>{
  18004. // clearTimeout(this.getOuterCopyValueTimer);
  18005. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  18006. // })
  18007. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  18008. _this.onMousemove(event);
  18009. }, 300, { maxWait: 500 }).bind(this));
  18010. window.addEventListener('message', this.onMessageEvent.bind(this));
  18011. this.subscribe();
  18012. setDesignInstance(this);
  18013. }
  18014. // todo ======== 方法 ==========
  18015. ViewDesign.prototype.subscribe = function () {
  18016. var _this = this;
  18017. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  18018. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  18019. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18020. _this.setVjson(vjson, from, ignoreRenderUI);
  18021. }));
  18022. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  18023. var id = _a.id, from = _a.from;
  18024. _this.onComponentSelectionChange(id, from);
  18025. }));
  18026. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  18027. var id = _a.id, from = _a.from;
  18028. _this.onComponentDelete(id, from);
  18029. }));
  18030. };
  18031. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  18032. if (vjson === void 0) { vjson = this.vjson; }
  18033. if (from === void 0) { from = this.name; }
  18034. this.vjson = vjson;
  18035. if (from !== "undo" && from !== "redo") {
  18036. if (this.undoVjsonList.length >= 100) {
  18037. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  18038. }
  18039. this.undoVjsonList.push(this.lastVjson);
  18040. }
  18041. this.lastVjson = _$1.cloneDeep(vjson);
  18042. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  18043. };
  18044. /**
  18045. * 覆盖层点击事件
  18046. */
  18047. ViewDesign.prototype.overlayClickFunction = function (event) {
  18048. if (!event.altKey && !event.shiftKey) {
  18049. var target = this.findElByXY(event.clientX, event.clientY);
  18050. if (target) {
  18051. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  18052. var extHandle = Ext$1.get(target).component;
  18053. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18054. rect.x = position.x;
  18055. rect.y = position.y;
  18056. this.clearSelection();
  18057. this.appendMaskbox(rect, extHandle.id);
  18058. }
  18059. }
  18060. };
  18061. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  18062. if (dragType === void 0) { dragType = ""; }
  18063. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  18064. var ele = document.elementsFromPoint(x, y);
  18065. if (ele.length <= 1) {
  18066. return;
  18067. }
  18068. var target = null;
  18069. for (var i = 0; i < ele.length; i++) {
  18070. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  18071. 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) {
  18072. switch (dragType) {
  18073. case "cols-container":
  18074. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  18075. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  18076. target = ele[i];
  18077. }
  18078. break;
  18079. case "col-item":
  18080. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  18081. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  18082. target = ele[i];
  18083. }
  18084. break;
  18085. case "rows-container":
  18086. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  18087. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  18088. target = ele[i];
  18089. }
  18090. break;
  18091. case "row-item":
  18092. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  18093. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  18094. target = ele[i];
  18095. }
  18096. break;
  18097. default:
  18098. target = ele[i];
  18099. break;
  18100. }
  18101. if (target) {
  18102. break;
  18103. }
  18104. }
  18105. }
  18106. return target;
  18107. };
  18108. /**
  18109. * 清空选择项
  18110. */
  18111. ViewDesign.prototype.clearSelection = function () {
  18112. // $(this.designElement).removeClass('selected');
  18113. // // $(this.designElement).find('.selected').removeClass('selected')
  18114. // $(this.designElement).find('.ds_mask')
  18115. // .not('.mask_not_hide')
  18116. // .remove();
  18117. $$1('.studio_mask').remove();
  18118. // $(this.designElement).find('.selected').each(function () {
  18119. // $(this).removeClass('selected');
  18120. // // const extHandle = Ext.get(this).component
  18121. // // if (extHandle) {
  18122. // // extHandle.removeCls('selected')
  18123. // // }
  18124. // })
  18125. };
  18126. /**
  18127. * 添加遮罩层
  18128. */
  18129. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  18130. var that = this;
  18131. if (vjsonId) {
  18132. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  18133. }
  18134. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  18135. // return item === cj.xtype
  18136. // }) >= 0
  18137. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18138. 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>");
  18139. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  18140. this.$mask.css({
  18141. position: 'absolute',
  18142. top: top, left: left, width: width, height: height,
  18143. border: '2px dashed #1890ff',
  18144. zIndex: 100,
  18145. });
  18146. this.$mask.appendTo(this.$overlay);
  18147. this.$mask.on("click", ".ds_del", function (e) {
  18148. e.stopPropagation();
  18149. e.preventDefault();
  18150. that.deleteComponent(vjsonId);
  18151. });
  18152. // 点击选中父级
  18153. this.$mask.on('click', '.ds_parent', function (e) {
  18154. e.stopPropagation();
  18155. e.preventDefault();
  18156. that.selectParent(vjsonId);
  18157. });
  18158. var sel = document.getElementById(vjsonId);
  18159. var sVjosn = findInCode(this.vjson, vjsonId);
  18160. // 限制可以拖动的组件
  18161. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  18162. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  18163. this.dragSource = new Ext$1.drag.Source({
  18164. element: this.$mask[0],
  18165. constrain: this.$overlay[0],
  18166. listeners: {
  18167. dragmove: this.dragmove.bind(that, this.vjson),
  18168. dragend: this.dragend.bind(that, this.vjson)
  18169. },
  18170. startRect: rect,
  18171. sourceVjson: findInCode(this.vjson, vjsonId),
  18172. sourceVjsonId: vjsonId,
  18173. dragType: dragType
  18174. });
  18175. }
  18176. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  18177. };
  18178. /**
  18179. * 选中某个选项
  18180. */
  18181. ViewDesign.prototype.setSelection = function (id) {
  18182. var _a, _b;
  18183. if (!this.designElement) {
  18184. return;
  18185. }
  18186. // 清空选中内容
  18187. this.clearSelection();
  18188. if (!id) {
  18189. return;
  18190. }
  18191. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  18192. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18193. rect.x = position.x;
  18194. rect.y = position.y;
  18195. this.appendMaskbox(rect, id);
  18196. };
  18197. /**
  18198. * 删除组件
  18199. * @param id
  18200. */
  18201. ViewDesign.prototype.deleteComponent = function (id) {
  18202. deletVjsonById(this.vjson, id);
  18203. this.moduleObject.modulePage.currentComponentSelectId = null;
  18204. this.setVjson();
  18205. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  18206. this.clearSelection();
  18207. };
  18208. ViewDesign.prototype.selectParent = function (id) {
  18209. var pid = getSuperVjsonId(this.vjson, id);
  18210. this.moduleObject.modulePage.currentComponentSelectId = pid;
  18211. this.setSelection(pid);
  18212. };
  18213. // todo ====== 拖拽事件 ======
  18214. ViewDesign.prototype.dragmove = function (node, source, info) {
  18215. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18216. if (!target) {
  18217. return;
  18218. }
  18219. var rect = target.getBoundingClientRect();
  18220. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18221. var extHandle = Ext$1.get(target).component;
  18222. if (!extHandle) {
  18223. return;
  18224. }
  18225. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18226. rect.x = position.x;
  18227. rect.y = position.y;
  18228. this.appendDirection(rect, extHandle.id, direction);
  18229. };
  18230. ViewDesign.prototype.dragend = function (node, source, info) {
  18231. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18232. if (!target) {
  18233. return;
  18234. }
  18235. var rect = target.getBoundingClientRect();
  18236. var extHandle = Ext$1.get(target).component;
  18237. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18238. if (!extHandle) {
  18239. return;
  18240. }
  18241. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  18242. this.removeDirection();
  18243. };
  18244. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  18245. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18246. var cv = findInCode(this.vjson, vjsonId);
  18247. if (this.$direction) {
  18248. $$1('#direction' + this.id).remove();
  18249. }
  18250. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  18251. //
  18252. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  18253. if (direction) {
  18254. if (direction === "top") {
  18255. // direction = 'center'
  18256. height = height / 4;
  18257. }
  18258. else if (direction === "bottom") {
  18259. // direction = 'center'
  18260. top = top + height / 4 * 3;
  18261. height = height / 4;
  18262. }
  18263. else if (direction === "left") {
  18264. width = width / 4;
  18265. }
  18266. else if (direction === "right") {
  18267. left = left + width / 4 * 3;
  18268. width = width / 4;
  18269. }
  18270. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18271. this.$direction.css({
  18272. position: 'absolute',
  18273. top: top, left: left, width: width, height: height,
  18274. // border: '2px dashed #1890ff',
  18275. background: 'rgba(40,224,218,0.75)',
  18276. zIndex: 100,
  18277. });
  18278. this.$direction.appendTo(this.$overlay);
  18279. // }
  18280. }
  18281. };
  18282. ViewDesign.prototype.removeDirection = function () {
  18283. if (this.$direction) {
  18284. this.$direction.remove();
  18285. this.$direction = null;
  18286. }
  18287. };
  18288. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  18289. var arrS;
  18290. if (sourceVjId) {
  18291. arrS = findArrayContainer(this.vjson, sourceVjId);
  18292. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  18293. var indexS = _$1.findIndex(arrS, function (v) {
  18294. return v.id === sourceVjId;
  18295. });
  18296. if (indexS < 0) {
  18297. return;
  18298. }
  18299. }
  18300. delete sourceVjson.id;
  18301. var vjsonT = findInCode(this.vjson, targetVjId);
  18302. var arrT = findArrayContainer(this.vjson, targetVjId);
  18303. var indexT = _$1.findIndex(arrT, function (v) {
  18304. return v.id === targetVjId;
  18305. });
  18306. if (indexT < 0) {
  18307. return;
  18308. }
  18309. switch (direction) {
  18310. case 'top':
  18311. case 'left':
  18312. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18313. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18314. vjsonT.items.splice(0, 0, sourceVjson);
  18315. }
  18316. else {
  18317. arrT.splice(indexT, 0, sourceVjson);
  18318. }
  18319. break;
  18320. case 'bottom':
  18321. case 'right':
  18322. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18323. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18324. vjsonT.items.push(sourceVjson);
  18325. }
  18326. else {
  18327. arrT.splice(indexT + 1, 0, sourceVjson);
  18328. }
  18329. break;
  18330. case 'center':
  18331. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18332. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18333. vjsonT.items.push(sourceVjson);
  18334. }
  18335. else {
  18336. arrT.splice(indexT, 1, sourceVjson);
  18337. }
  18338. break;
  18339. }
  18340. if (sourceVjId) {
  18341. deletVjsonById(this.vjson, sourceVjId);
  18342. sourceVjson.id = sourceVjId;
  18343. }
  18344. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  18345. };
  18346. // todo ======== 事件 ==========
  18347. // 接收 postMessage 事件分发
  18348. ViewDesign.prototype.onMessageEvent = function (event) {
  18349. var _a, _b;
  18350. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  18351. if (fucName && typeof this[fucName] === 'function') {
  18352. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  18353. }
  18354. };
  18355. // 接收外部选中组件事件
  18356. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  18357. if (from !== this.name) {
  18358. this.setSelection(id);
  18359. }
  18360. };
  18361. // 接收外部组件删除事件
  18362. ViewDesign.prototype.onComponentDelete = function (id, from) {
  18363. if (from !== this.name) {
  18364. this.deleteComponent(id);
  18365. }
  18366. };
  18367. // 组件被选中
  18368. ViewDesign.prototype.onComponentSelect = function (args) {
  18369. if (args[2] != this.moduleId) {
  18370. return;
  18371. }
  18372. if (args[0]) {
  18373. var rect = args[0];
  18374. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18375. rect.x = position.x;
  18376. rect.y = position.y;
  18377. this.clearSelection();
  18378. this.appendMaskbox(rect, args[1]);
  18379. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  18380. }
  18381. };
  18382. ViewDesign.prototype.onComponentInfo = function (_a) {
  18383. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  18384. if (moduleId != this.moduleId) {
  18385. return;
  18386. }
  18387. if (rect) {
  18388. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18389. rect.x = position.x;
  18390. rect.y = position.y;
  18391. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18392. var cv_1 = findInCode(this.vjson, vjsonId);
  18393. if (this.$direction) {
  18394. $$1('#direction' + this.id).remove();
  18395. }
  18396. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  18397. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  18398. if (direction) {
  18399. if (direction === "top") {
  18400. direction = 'center';
  18401. //height = height/3
  18402. }
  18403. else if (direction === "bottom") {
  18404. direction = 'center';
  18405. // top=top+height/3*2
  18406. // height = height/3
  18407. }
  18408. else if (direction === "left") {
  18409. width = width / 3;
  18410. }
  18411. else if (direction === "right") {
  18412. left = left + width / 3 * 2;
  18413. width = width / 3;
  18414. }
  18415. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18416. this.$direction.css({
  18417. position: 'absolute',
  18418. top: top, left: left, width: width, height: height,
  18419. // border: '2px dashed #1890ff',
  18420. background: 'rgba(74,106,201,0.42)',
  18421. zIndex: 100,
  18422. });
  18423. this.$direction.appendTo(this.$overlay);
  18424. }
  18425. }
  18426. console.log("direction", direction);
  18427. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  18428. // rect.x = position.x
  18429. // rect.y = position.y
  18430. // this.clearSelection()
  18431. // this.appendMaskbox(rect, args[1])
  18432. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  18433. }
  18434. };
  18435. ViewDesign.prototype.onUndo = function () {
  18436. if (this.undoVjsonList.length > 0) {
  18437. if (this.redoVjsonList.length >= 100) {
  18438. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  18439. }
  18440. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18441. this.vjson = this.undoVjsonList.pop();
  18442. // this.setVjson(this.vjson, "", false, "undo")
  18443. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  18444. }
  18445. };
  18446. ViewDesign.prototype.onRedo = function () {
  18447. if (this.redoVjsonList.length > 0) {
  18448. if (this.undoVjsonList.length >= 100) {
  18449. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  18450. }
  18451. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18452. this.vjson = this.redoVjsonList.pop();
  18453. // this.setVjson(this.vjson, "", false, "redo")
  18454. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  18455. }
  18456. };
  18457. ViewDesign.prototype.onKeyPress = function (event) {
  18458. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  18459. // if (this.backStep()) {
  18460. // event.stopPropagation()
  18461. // event.preventDefault()
  18462. // return
  18463. // }
  18464. // }
  18465. //
  18466. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  18467. // if (this.recoverStep()) {
  18468. // event.stopPropagation()
  18469. // event.preventDefault()
  18470. // return
  18471. // }
  18472. // }
  18473. // if (event.key === 'ArrowUp') {
  18474. // if (this.selectParent()) {
  18475. // event.stopPropagation()
  18476. // event.preventDefault()
  18477. // return;
  18478. // }
  18479. // }
  18480. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  18481. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  18482. event.stopPropagation();
  18483. event.preventDefault();
  18484. return;
  18485. }
  18486. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  18487. // if (this.copyView()) {
  18488. // event.stopPropagation()
  18489. // event.preventDefault()
  18490. // return;
  18491. // }
  18492. // }
  18493. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  18494. // if (this.copyView(true)) {
  18495. // event.stopPropagation()
  18496. // event.preventDefault()
  18497. // return;
  18498. // }
  18499. // }
  18500. //
  18501. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  18502. // if (this.selectRoot()) {
  18503. // event.stopPropagation()
  18504. // event.preventDefault()
  18505. // return;
  18506. // }
  18507. //
  18508. };
  18509. ViewDesign.prototype.onCopy = function (event) {
  18510. if (this.moduleObject.modulePage.currentComponentSelectId) {
  18511. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  18512. if (copyVjson) {
  18513. removeDesignProp(copyVjson);
  18514. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  18515. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  18516. }
  18517. }
  18518. };
  18519. ViewDesign.prototype.onPaste = function (event) {
  18520. debugger;
  18521. };
  18522. ViewDesign.prototype.onfocus = function () {
  18523. console.log("getCopy");
  18524. console.log("document.activeElement", document.activeElement.id);
  18525. // clearTimeout(this.getOuterCopyValueTimer);
  18526. // native.clipboardRead()
  18527. };
  18528. ViewDesign.prototype.onMousemove = function (event) {
  18529. var _a;
  18530. if (document.activeElement.id === this.$overlay[0].id) {
  18531. // console.log(event.clientX, event.clientY)
  18532. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  18533. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  18534. // this.iframeWindow.postMessage({
  18535. // method: 'overlayGetInfo',
  18536. // args: [position, this.moduleId]
  18537. // }, '*')
  18538. }
  18539. }
  18540. };
  18541. ViewDesign.prototype.onDestroy = function () {
  18542. window.removeEventListener('message', this.onMessageEvent.bind(this));
  18543. for (var i = 0; i < this.subscribeList.length; i++) {
  18544. this.subscribeList[i].cancel();
  18545. }
  18546. };
  18547. // todo ======== 工具方法 ==========
  18548. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  18549. if (relative === void 0) { relative = null; }
  18550. if (from === "main" && to === "overlay") {
  18551. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18552. var x = overlayRect.x;
  18553. var y = overlayRect.y;
  18554. if (relative) {
  18555. var relativeRect = relative.getBoundingClientRect();
  18556. console.log("main->", relativeRect.x, relativeRect.y);
  18557. x = x - relativeRect.x;
  18558. y = y - relativeRect.y;
  18559. }
  18560. pos.x = pos.x - x;
  18561. pos.y = pos.y - y;
  18562. }
  18563. else if (from === "overlay" && to === "main") {
  18564. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18565. var x = overlayRect.x;
  18566. var y = overlayRect.y;
  18567. if (relative) {
  18568. var relativeRect = relative.getBoundingClientRect();
  18569. console.log("iframe->", relativeRect.x, relativeRect.y);
  18570. x = x - relativeRect.x;
  18571. y = y - relativeRect.y;
  18572. }
  18573. pos.x = pos.x + x;
  18574. pos.y = pos.y + y;
  18575. }
  18576. return pos;
  18577. };
  18578. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  18579. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  18580. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  18581. return "center";
  18582. }
  18583. // col-item 只能放左右
  18584. if (dragType === "col-item" || dragType === "") {
  18585. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  18586. if (x > rect.x && x < rect.x + rect.width / 3) {
  18587. return "left";
  18588. }
  18589. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  18590. return "right";
  18591. }
  18592. }
  18593. }
  18594. // cols-container 只能放上下
  18595. if (dragType === "cols-container" || dragType === "") {
  18596. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  18597. if (y > rect.y && y < rect.y + rect.height / 3) {
  18598. return "top";
  18599. }
  18600. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  18601. return "bottom";
  18602. }
  18603. }
  18604. }
  18605. return "";
  18606. };
  18607. return ViewDesign;
  18608. }());
  18609. //
  18610. //# sourceMappingURL=ViewDesign.js.map
  18611. var model$k = {
  18612. data: {
  18613. iframeSrc: ''
  18614. }
  18615. };
  18616. //# sourceMappingURL=ModulePage.model.js.map
  18617. var vjson$k = {
  18618. layout: 'fit',
  18619. border: false,
  18620. iconCls: 'x-fa fa-newspaper-o',
  18621. referenceHolder: true,
  18622. items: [
  18623. {
  18624. layout: 'border',
  18625. border: false,
  18626. items: [
  18627. {
  18628. region: 'center',
  18629. xtype: 'tabpanel',
  18630. border: false,
  18631. tabPosition: 'bottom',
  18632. reference: 'tabPanel',
  18633. listeners: {
  18634. tabchange: 'scope.tabchange'
  18635. },
  18636. defaults: {
  18637. border: false,
  18638. },
  18639. items: [
  18640. {
  18641. title: 'controller.js',
  18642. xtype: 'jseditor',
  18643. reference: 'controllerEditor',
  18644. },
  18645. {
  18646. title: 'view.design',
  18647. xtype: 'designer',
  18648. reference: 'designer',
  18649. listeners: {
  18650. afterrender: 'scope.previewRender'
  18651. },
  18652. },
  18653. {
  18654. title: 'view.js',
  18655. xtype: 'jseditor',
  18656. reference: 'viewEditor',
  18657. },
  18658. {
  18659. title: 'model.js',
  18660. xtype: 'jseditor',
  18661. reference: 'modelEditor',
  18662. },
  18663. {
  18664. title: 'groovy',
  18665. xtype: 'groovyeditor',
  18666. reference: 'groovyEditor',
  18667. },
  18668. {
  18669. title: 'SQL',
  18670. xtype: 'sqleditor',
  18671. reference: 'sqlEditor',
  18672. }
  18673. ]
  18674. }
  18675. ]
  18676. }
  18677. ]
  18678. };
  18679. //# sourceMappingURL=ModulePage.view.js.map
  18680. var ModulePage = /** @class */ (function (_super) {
  18681. __extends(ModulePage, _super);
  18682. function ModulePage(moduleId, module) {
  18683. var _this = _super.call(this, { model: model$k, vjson: vjson$k }) || this;
  18684. _this.name = "ModulePage";
  18685. _this.viewDesign = null;
  18686. _this.maxViewId = 0;
  18687. _this.moduleEventBus = new EventBus();
  18688. _this.codeChange = _$2.debounce(function (code, from, e) {
  18689. try {
  18690. switch (from) {
  18691. case _this.refs.controllerEditor.name:
  18692. moduleStore.updateJsController(_this.moduleId, code, from);
  18693. break;
  18694. case _this.refs.viewEditor.name:
  18695. moduleStore.updateJsView(_this.moduleId, code, from);
  18696. break;
  18697. case _this.refs.modelEditor.name:
  18698. moduleStore.updateJsModel(_this.moduleId, code, from);
  18699. break;
  18700. case _this.refs.groovyEditor.name:
  18701. moduleStore.updateGroovy(_this.moduleId, code, from);
  18702. break;
  18703. case _this.refs.sqlEditor.name:
  18704. moduleStore.updateMybatis(_this.moduleId, code, from);
  18705. break;
  18706. }
  18707. }
  18708. catch (e) {
  18709. }
  18710. }, 500, { maxWait: 10000 });
  18711. _this.moduleId = moduleId;
  18712. _this.module = module;
  18713. _this.cancelSubscribe = [];
  18714. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  18715. _this.initEditor(moduleItem);
  18716. }));
  18717. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  18718. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18719. _this.previewReRender();
  18720. }));
  18721. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  18722. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18723. _this.updateVjson(vjson, from, ignoreRenderUI);
  18724. }));
  18725. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  18726. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18727. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  18728. }));
  18729. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  18730. var id = _a.id, from = _a.from;
  18731. _this.onComponentSelectionChange(id, from);
  18732. }));
  18733. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  18734. _this.onUndo();
  18735. }));
  18736. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  18737. _this.onRedo();
  18738. }));
  18739. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  18740. _this.currentCopyVjson = stringToJsonObj(value);
  18741. }));
  18742. return _this;
  18743. }
  18744. ModulePage.prototype.onLoad = function () {
  18745. var _this = this;
  18746. // this.refs.preview.src = href
  18747. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  18748. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  18749. _this.saveCall();
  18750. }));
  18751. this.activeEditor = this.refs.controllerEditor;
  18752. this.refs.controllerEditor.modulePage = this;
  18753. this.refs.viewEditor.modulePage = this;
  18754. this.refs.modelEditor.modulePage = this;
  18755. this.refs.groovyEditor.modulePage = this;
  18756. this.refs.sqlEditor.modulePage = this;
  18757. this.refs.controllerEditor.name = "controllerEditor";
  18758. this.refs.viewEditor.name = "viewEditor";
  18759. this.refs.modelEditor.name = "modelEditor";
  18760. this.refs.groovyEditor.name = "groovyEditor";
  18761. this.refs.sqlEditor.name = "sqlEditor";
  18762. this.refs.controllerEditor.codeChange = this.codeChange;
  18763. this.refs.viewEditor.codeChange = this.codeChange;
  18764. this.refs.modelEditor.codeChange = this.codeChange;
  18765. this.refs.groovyEditor.codeChange = this.codeChange;
  18766. this.refs.sqlEditor.codeChange = this.codeChange;
  18767. };
  18768. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  18769. if (!cmpVjson || from === this.name) {
  18770. return;
  18771. }
  18772. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18773. replaceVjsonById(vj, cmpVjson);
  18774. this.updateVjson(vj, from, ignoreRenderUI);
  18775. };
  18776. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  18777. var _this = this;
  18778. var _a, _b;
  18779. if (!vjson || from === this.name) {
  18780. return;
  18781. }
  18782. this.addViewId(vjson);
  18783. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  18784. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  18785. (_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);
  18786. this.previewReRender();
  18787. _$2.defer(function () {
  18788. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  18789. });
  18790. };
  18791. ModulePage.prototype.previewRender = function (sender) {
  18792. var _this = this;
  18793. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18794. if (!this.designScope) {
  18795. this.designScope = new Scope({
  18796. vjson: vjson,
  18797. model: {
  18798. data: {}
  18799. }
  18800. });
  18801. }
  18802. else {
  18803. this.designScope.vjson = vjson;
  18804. }
  18805. this.designScope.showDesigner(sender, {
  18806. moduleId: this.moduleId,
  18807. });
  18808. if (this.viewDesign) {
  18809. return;
  18810. }
  18811. _$2.defer(function () {
  18812. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  18813. handles$1.mainWindow.setLoading(false);
  18814. });
  18815. };
  18816. ModulePage.prototype.previewReRender = function () {
  18817. var designer = this.refs.designer;
  18818. this.previewRender(designer);
  18819. };
  18820. ModulePage.prototype.initEditor = function (moduleItem) {
  18821. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  18822. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  18823. return;
  18824. (_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);
  18825. (_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);
  18826. (_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);
  18827. (_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);
  18828. (_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);
  18829. };
  18830. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  18831. this.currentComponentSelectId = id;
  18832. };
  18833. ModulePage.prototype.onUndo = function () {
  18834. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18835. this.viewDesign.onUndo();
  18836. }
  18837. };
  18838. ModulePage.prototype.onRedo = function () {
  18839. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18840. this.viewDesign.onRedo();
  18841. }
  18842. };
  18843. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  18844. this.activeEditor = newCard;
  18845. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  18846. };
  18847. ModulePage.prototype.saveCall = function () {
  18848. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  18849. moduleStore.saveFile(this.moduleId, "jsView");
  18850. }
  18851. else if (this.activeEditor === this.refs.controllerEditor) {
  18852. moduleStore.saveFile(this.moduleId, "jsController");
  18853. }
  18854. else if (this.activeEditor === this.refs.modelEditor) {
  18855. moduleStore.saveFile(this.moduleId, "jsModel");
  18856. }
  18857. else if (this.activeEditor === this.refs.groovyEditor) {
  18858. moduleStore.saveFile(this.moduleId, "groovy");
  18859. }
  18860. else if (this.activeEditor === this.refs.sqlEditor) {
  18861. moduleStore.saveFile(this.moduleId, "mybatis");
  18862. }
  18863. };
  18864. ModulePage.prototype.check = function () {
  18865. moduleStore.check(this.moduleId);
  18866. };
  18867. /**
  18868. * 为vjson添加id
  18869. * @param vjson
  18870. * @param isAll
  18871. */
  18872. ModulePage.prototype.addViewId = function (vjson, isAll) {
  18873. var _this = this;
  18874. if (isAll === void 0) { isAll = false; }
  18875. var maxIdTag = 0;
  18876. // 先提取当前的最大id
  18877. deepTravVJson(vjson, function (obj) {
  18878. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18879. return;
  18880. }
  18881. if (obj.id && obj.id.indexOf(idPrefix)) {
  18882. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  18883. if (sutr.length > 0) {
  18884. var tid = sutr.replace(idPrefix, "");
  18885. var idNum = parseInt(tid);
  18886. if (idNum && maxIdTag < idNum) {
  18887. maxIdTag = idNum;
  18888. }
  18889. }
  18890. }
  18891. });
  18892. // 标记最大的id号,避免重复
  18893. this.maxViewId = maxIdTag;
  18894. deepTravVJson(vjson, function (obj) {
  18895. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18896. return;
  18897. }
  18898. if (!obj.hasOwnProperty('id')) {
  18899. obj.id = _this.createViewId();
  18900. }
  18901. if (!obj.hasOwnProperty('designMode')) {
  18902. obj.designMode = true;
  18903. }
  18904. // if (obj.xtype == "tabview" && obj.activeTab) {
  18905. // // 设置默认的选项
  18906. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  18907. // if (typeof obj.activeTab === 'number') {
  18908. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  18909. // } else if (typeof obj.activeTab === 'string') {
  18910. // this._tabViewSelect[obj.id] = obj.activeTab
  18911. // }
  18912. //
  18913. // }
  18914. // }
  18915. if (isAll && obj.hasOwnProperty("view")) ;
  18916. });
  18917. return vjson;
  18918. };
  18919. /**
  18920. * 为组件创建 ID
  18921. */
  18922. ModulePage.prototype.createViewId = function () {
  18923. this.maxViewId++;
  18924. return this.id + idPrefix + this.maxViewId;
  18925. };
  18926. ModulePage.prototype.onDestroy = function () {
  18927. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  18928. this.cancelSubscribe[i].cancel();
  18929. }
  18930. _super.prototype.onDestroy.call(this);
  18931. };
  18932. return ModulePage;
  18933. }(Scope));
  18934. //# sourceMappingURL=ModulePage.js.map
  18935. var camundaModdleDescriptor = {
  18936. "name": "Camunda",
  18937. "uri": "http://camunda.org/schema/1.0/bpmn",
  18938. "prefix": "camunda",
  18939. "xml": {
  18940. "tagAlias": "lowerCase"
  18941. },
  18942. "associations": [],
  18943. "types": [
  18944. {
  18945. "name": "Definitions",
  18946. "isAbstract": true,
  18947. "extends": [
  18948. "bpmn:Definitions"
  18949. ],
  18950. "properties": [
  18951. {
  18952. "name": "diagramRelationId",
  18953. "isAttr": true,
  18954. "type": "String"
  18955. }
  18956. ]
  18957. },
  18958. {
  18959. "name": "InOutBinding",
  18960. "superClass": [
  18961. "Element"
  18962. ],
  18963. "isAbstract": true,
  18964. "properties": [
  18965. {
  18966. "name": "source",
  18967. "isAttr": true,
  18968. "type": "String"
  18969. },
  18970. {
  18971. "name": "sourceExpression",
  18972. "isAttr": true,
  18973. "type": "String"
  18974. },
  18975. {
  18976. "name": "target",
  18977. "isAttr": true,
  18978. "type": "String"
  18979. },
  18980. {
  18981. "name": "businessKey",
  18982. "isAttr": true,
  18983. "type": "String"
  18984. },
  18985. {
  18986. "name": "local",
  18987. "isAttr": true,
  18988. "type": "Boolean",
  18989. "default": false
  18990. },
  18991. {
  18992. "name": "variables",
  18993. "isAttr": true,
  18994. "type": "String"
  18995. }
  18996. ]
  18997. },
  18998. {
  18999. "name": "In",
  19000. "superClass": [
  19001. "InOutBinding"
  19002. ],
  19003. "meta": {
  19004. "allowedIn": [
  19005. "bpmn:CallActivity",
  19006. "bpmn:SignalEventDefinition"
  19007. ]
  19008. }
  19009. },
  19010. {
  19011. "name": "Out",
  19012. "superClass": [
  19013. "InOutBinding"
  19014. ],
  19015. "meta": {
  19016. "allowedIn": [
  19017. "bpmn:CallActivity"
  19018. ]
  19019. }
  19020. },
  19021. {
  19022. "name": "AsyncCapable",
  19023. "isAbstract": true,
  19024. "extends": [
  19025. "bpmn:Activity",
  19026. "bpmn:Gateway",
  19027. "bpmn:Event"
  19028. ],
  19029. "properties": [
  19030. {
  19031. "name": "async",
  19032. "isAttr": true,
  19033. "type": "Boolean",
  19034. "default": false
  19035. },
  19036. {
  19037. "name": "asyncBefore",
  19038. "isAttr": true,
  19039. "type": "Boolean",
  19040. "default": false
  19041. },
  19042. {
  19043. "name": "asyncAfter",
  19044. "isAttr": true,
  19045. "type": "Boolean",
  19046. "default": false
  19047. },
  19048. {
  19049. "name": "exclusive",
  19050. "isAttr": true,
  19051. "type": "Boolean",
  19052. "default": true
  19053. }
  19054. ]
  19055. },
  19056. {
  19057. "name": "JobPriorized",
  19058. "isAbstract": true,
  19059. "extends": [
  19060. "bpmn:Process",
  19061. "camunda:AsyncCapable"
  19062. ],
  19063. "properties": [
  19064. {
  19065. "name": "jobPriority",
  19066. "isAttr": true,
  19067. "type": "String"
  19068. }
  19069. ]
  19070. },
  19071. {
  19072. "name": "SignalEventDefinitionExtension",
  19073. "isAbstract": true,
  19074. "extends": [
  19075. "bpmn:SignalEventDefinition"
  19076. ],
  19077. "properties": [
  19078. {
  19079. "name": "async",
  19080. "isAttr": true,
  19081. "type": "Boolean",
  19082. "default": false
  19083. }
  19084. ]
  19085. },
  19086. {
  19087. "name": "ErrorEventDefinitionExtension",
  19088. "isAbstract": true,
  19089. "extends": [
  19090. "bpmn:ErrorEventDefinition"
  19091. ],
  19092. "properties": [
  19093. {
  19094. "name": "errorCodeVariable",
  19095. "isAttr": true,
  19096. "type": "String"
  19097. },
  19098. {
  19099. "name": "errorMessageVariable",
  19100. "isAttr": true,
  19101. "type": "String"
  19102. }
  19103. ]
  19104. },
  19105. {
  19106. "name": "ErrorEventDefinition",
  19107. "superClass": [
  19108. "bpmn:ErrorEventDefinition",
  19109. "Element"
  19110. ],
  19111. "properties": [
  19112. {
  19113. "name": "expression",
  19114. "isAttr": true,
  19115. "type": "String"
  19116. }
  19117. ],
  19118. "meta": {
  19119. "allowedIn": ["bpmn:ServiceTask"]
  19120. }
  19121. },
  19122. {
  19123. "name": "Error",
  19124. "isAbstract": true,
  19125. "extends": [
  19126. "bpmn:Error"
  19127. ],
  19128. "properties": [
  19129. {
  19130. "name": "camunda:errorMessage",
  19131. "isAttr": true,
  19132. "type": "String"
  19133. }
  19134. ]
  19135. },
  19136. {
  19137. "name": "PotentialStarter",
  19138. "superClass": [
  19139. "Element"
  19140. ],
  19141. "properties": [
  19142. {
  19143. "name": "resourceAssignmentExpression",
  19144. "type": "bpmn:ResourceAssignmentExpression"
  19145. }
  19146. ]
  19147. },
  19148. {
  19149. "name": "FormSupported",
  19150. "isAbstract": true,
  19151. "extends": [
  19152. "bpmn:StartEvent",
  19153. "bpmn:UserTask"
  19154. ],
  19155. "properties": [
  19156. {
  19157. "name": "formHandlerClass",
  19158. "isAttr": true,
  19159. "type": "String"
  19160. },
  19161. {
  19162. "name": "formKey",
  19163. "isAttr": true,
  19164. "type": "String"
  19165. },
  19166. {
  19167. "name": "formRef",
  19168. "isAttr": true,
  19169. "type": "String"
  19170. },
  19171. {
  19172. "name": "formRefBinding",
  19173. "isAttr": true,
  19174. "type": "String"
  19175. },
  19176. {
  19177. "name": "formRefVersion",
  19178. "isAttr": true,
  19179. "type": "String"
  19180. }
  19181. ]
  19182. },
  19183. {
  19184. "name": "TemplateSupported",
  19185. "isAbstract": true,
  19186. "extends": [
  19187. "bpmn:Collaboration",
  19188. "bpmn:Process",
  19189. "bpmn:FlowElement"
  19190. ],
  19191. "properties": [
  19192. {
  19193. "name": "modelerTemplate",
  19194. "isAttr": true,
  19195. "type": "String"
  19196. },
  19197. {
  19198. "name": "modelerTemplateVersion",
  19199. "isAttr": true,
  19200. "type": "Integer"
  19201. }
  19202. ]
  19203. },
  19204. {
  19205. "name": "Initiator",
  19206. "isAbstract": true,
  19207. "extends": ["bpmn:StartEvent"],
  19208. "properties": [
  19209. {
  19210. "name": "initiator",
  19211. "isAttr": true,
  19212. "type": "String"
  19213. }
  19214. ]
  19215. },
  19216. {
  19217. "name": "ScriptTask",
  19218. "isAbstract": true,
  19219. "extends": [
  19220. "bpmn:ScriptTask"
  19221. ],
  19222. "properties": [
  19223. {
  19224. "name": "resultVariable",
  19225. "isAttr": true,
  19226. "type": "String"
  19227. },
  19228. {
  19229. "name": "resource",
  19230. "isAttr": true,
  19231. "type": "String"
  19232. }
  19233. ]
  19234. },
  19235. {
  19236. "name": "Process",
  19237. "isAbstract": true,
  19238. "extends": [
  19239. "bpmn:Process"
  19240. ],
  19241. "properties": [
  19242. {
  19243. "name": "candidateStarterGroups",
  19244. "isAttr": true,
  19245. "type": "String"
  19246. },
  19247. {
  19248. "name": "candidateStarterUsers",
  19249. "isAttr": true,
  19250. "type": "String"
  19251. },
  19252. {
  19253. "name": "versionTag",
  19254. "isAttr": true,
  19255. "type": "String"
  19256. },
  19257. {
  19258. "name": "historyTimeToLive",
  19259. "isAttr": true,
  19260. "type": "String"
  19261. },
  19262. {
  19263. "name": "isStartableInTasklist",
  19264. "isAttr": true,
  19265. "type": "Boolean",
  19266. "default": true
  19267. }
  19268. ]
  19269. },
  19270. {
  19271. "name": "EscalationEventDefinitionExtension",
  19272. "isAbstract": true,
  19273. "extends": [
  19274. "bpmn:EscalationEventDefinition"
  19275. ],
  19276. "properties": [
  19277. {
  19278. "name": "escalationCodeVariable",
  19279. "isAttr": true,
  19280. "type": "String"
  19281. }
  19282. ]
  19283. },
  19284. {
  19285. "name": "FormalExpression",
  19286. "isAbstract": true,
  19287. "extends": [
  19288. "bpmn:FormalExpression"
  19289. ],
  19290. "properties": [
  19291. {
  19292. "name": "resource",
  19293. "isAttr": true,
  19294. "type": "String"
  19295. }
  19296. ]
  19297. },
  19298. {
  19299. "name": "Assignable",
  19300. "extends": ["bpmn:UserTask"],
  19301. "properties": [
  19302. {
  19303. "name": "assignee",
  19304. "isAttr": true,
  19305. "type": "String"
  19306. },
  19307. {
  19308. "name": "candidateUsers",
  19309. "isAttr": true,
  19310. "type": "String"
  19311. },
  19312. {
  19313. "name": "candidateGroups",
  19314. "isAttr": true,
  19315. "type": "String"
  19316. },
  19317. {
  19318. "name": "dueDate",
  19319. "isAttr": true,
  19320. "type": "String"
  19321. },
  19322. {
  19323. "name": "followUpDate",
  19324. "isAttr": true,
  19325. "type": "String"
  19326. },
  19327. {
  19328. "name": "priority",
  19329. "isAttr": true,
  19330. "type": "String"
  19331. }
  19332. ]
  19333. },
  19334. {
  19335. "name": "CallActivity",
  19336. "extends": ["bpmn:CallActivity"],
  19337. "properties": [
  19338. {
  19339. "name": "calledElementBinding",
  19340. "isAttr": true,
  19341. "type": "String",
  19342. "default": "latest"
  19343. },
  19344. {
  19345. "name": "calledElementVersion",
  19346. "isAttr": true,
  19347. "type": "String"
  19348. },
  19349. {
  19350. "name": "calledElementVersionTag",
  19351. "isAttr": true,
  19352. "type": "String"
  19353. },
  19354. {
  19355. "name": "calledElementTenantId",
  19356. "isAttr": true,
  19357. "type": "String"
  19358. },
  19359. {
  19360. "name": "caseRef",
  19361. "isAttr": true,
  19362. "type": "String"
  19363. },
  19364. {
  19365. "name": "caseBinding",
  19366. "isAttr": true,
  19367. "type": "String",
  19368. "default": "latest"
  19369. },
  19370. {
  19371. "name": "caseVersion",
  19372. "isAttr": true,
  19373. "type": "String"
  19374. },
  19375. {
  19376. "name": "caseTenantId",
  19377. "isAttr": true,
  19378. "type": "String"
  19379. },
  19380. {
  19381. "name": "variableMappingClass",
  19382. "isAttr": true,
  19383. "type": "String"
  19384. },
  19385. {
  19386. "name": "variableMappingDelegateExpression",
  19387. "isAttr": true,
  19388. "type": "String"
  19389. }
  19390. ]
  19391. },
  19392. {
  19393. "name": "ServiceTaskLike",
  19394. "extends": [
  19395. "bpmn:ServiceTask",
  19396. "bpmn:BusinessRuleTask",
  19397. "bpmn:SendTask",
  19398. "bpmn:MessageEventDefinition"
  19399. ],
  19400. "properties": [
  19401. {
  19402. "name": "expression",
  19403. "isAttr": true,
  19404. "type": "String"
  19405. },
  19406. {
  19407. "name": "class",
  19408. "isAttr": true,
  19409. "type": "String"
  19410. },
  19411. {
  19412. "name": "delegateExpression",
  19413. "isAttr": true,
  19414. "type": "String"
  19415. },
  19416. {
  19417. "name": "resultVariable",
  19418. "isAttr": true,
  19419. "type": "String"
  19420. }
  19421. ]
  19422. },
  19423. {
  19424. "name": "DmnCapable",
  19425. "extends": [
  19426. "bpmn:BusinessRuleTask"
  19427. ],
  19428. "properties": [
  19429. {
  19430. "name": "decisionRef",
  19431. "isAttr": true,
  19432. "type": "String"
  19433. },
  19434. {
  19435. "name": "decisionRefBinding",
  19436. "isAttr": true,
  19437. "type": "String",
  19438. "default": "latest"
  19439. },
  19440. {
  19441. "name": "decisionRefVersion",
  19442. "isAttr": true,
  19443. "type": "String"
  19444. },
  19445. {
  19446. "name": "mapDecisionResult",
  19447. "isAttr": true,
  19448. "type": "String",
  19449. "default": "resultList"
  19450. },
  19451. {
  19452. "name": "decisionRefTenantId",
  19453. "isAttr": true,
  19454. "type": "String"
  19455. }
  19456. ]
  19457. },
  19458. {
  19459. "name": "ExternalCapable",
  19460. "extends": [
  19461. "camunda:ServiceTaskLike"
  19462. ],
  19463. "properties": [
  19464. {
  19465. "name": "type",
  19466. "isAttr": true,
  19467. "type": "String"
  19468. },
  19469. {
  19470. "name": "topic",
  19471. "isAttr": true,
  19472. "type": "String"
  19473. }
  19474. ]
  19475. },
  19476. {
  19477. "name": "TaskPriorized",
  19478. "extends": [
  19479. "bpmn:Process",
  19480. "camunda:ExternalCapable"
  19481. ],
  19482. "properties": [
  19483. {
  19484. "name": "taskPriority",
  19485. "isAttr": true,
  19486. "type": "String"
  19487. }
  19488. ]
  19489. },
  19490. {
  19491. "name": "Properties",
  19492. "superClass": [
  19493. "Element"
  19494. ],
  19495. "meta": {
  19496. "allowedIn": ["*"]
  19497. },
  19498. "properties": [
  19499. {
  19500. "name": "values",
  19501. "type": "Property",
  19502. "isMany": true
  19503. }
  19504. ]
  19505. },
  19506. {
  19507. "name": "Property",
  19508. "superClass": [
  19509. "Element"
  19510. ],
  19511. "properties": [
  19512. {
  19513. "name": "id",
  19514. "type": "String",
  19515. "isAttr": true
  19516. },
  19517. {
  19518. "name": "name",
  19519. "type": "String",
  19520. "isAttr": true
  19521. },
  19522. {
  19523. "name": "value",
  19524. "type": "String",
  19525. "isAttr": true
  19526. }
  19527. ]
  19528. },
  19529. {
  19530. "name": "Connector",
  19531. "superClass": [
  19532. "Element"
  19533. ],
  19534. "meta": {
  19535. "allowedIn": [
  19536. "camunda:ServiceTaskLike"
  19537. ]
  19538. },
  19539. "properties": [
  19540. {
  19541. "name": "inputOutput",
  19542. "type": "InputOutput"
  19543. },
  19544. {
  19545. "name": "connectorId",
  19546. "type": "String"
  19547. }
  19548. ]
  19549. },
  19550. {
  19551. "name": "InputOutput",
  19552. "superClass": [
  19553. "Element"
  19554. ],
  19555. "meta": {
  19556. "allowedIn": [
  19557. "bpmn:FlowNode",
  19558. "camunda:Connector"
  19559. ]
  19560. },
  19561. "properties": [
  19562. {
  19563. "name": "inputOutput",
  19564. "type": "InputOutput"
  19565. },
  19566. {
  19567. "name": "connectorId",
  19568. "type": "String"
  19569. },
  19570. {
  19571. "name": "inputParameters",
  19572. "isMany": true,
  19573. "type": "InputParameter"
  19574. },
  19575. {
  19576. "name": "outputParameters",
  19577. "isMany": true,
  19578. "type": "OutputParameter"
  19579. }
  19580. ]
  19581. },
  19582. {
  19583. "name": "InputOutputParameter",
  19584. "properties": [
  19585. {
  19586. "name": "name",
  19587. "isAttr": true,
  19588. "type": "String"
  19589. },
  19590. {
  19591. "name": "value",
  19592. "isBody": true,
  19593. "type": "String"
  19594. },
  19595. {
  19596. "name": "definition",
  19597. "type": "InputOutputParameterDefinition"
  19598. }
  19599. ]
  19600. },
  19601. {
  19602. "name": "InputOutputParameterDefinition",
  19603. "isAbstract": true
  19604. },
  19605. {
  19606. "name": "List",
  19607. "superClass": ["InputOutputParameterDefinition"],
  19608. "properties": [
  19609. {
  19610. "name": "items",
  19611. "isMany": true,
  19612. "type": "InputOutputParameterDefinition"
  19613. }
  19614. ]
  19615. },
  19616. {
  19617. "name": "Map",
  19618. "superClass": ["InputOutputParameterDefinition"],
  19619. "properties": [
  19620. {
  19621. "name": "entries",
  19622. "isMany": true,
  19623. "type": "Entry"
  19624. }
  19625. ]
  19626. },
  19627. {
  19628. "name": "Entry",
  19629. "properties": [
  19630. {
  19631. "name": "key",
  19632. "isAttr": true,
  19633. "type": "String"
  19634. },
  19635. {
  19636. "name": "value",
  19637. "isBody": true,
  19638. "type": "String"
  19639. },
  19640. {
  19641. "name": "definition",
  19642. "type": "InputOutputParameterDefinition"
  19643. }
  19644. ]
  19645. },
  19646. {
  19647. "name": "Value",
  19648. "superClass": [
  19649. "InputOutputParameterDefinition"
  19650. ],
  19651. "properties": [
  19652. {
  19653. "name": "id",
  19654. "isAttr": true,
  19655. "type": "String"
  19656. },
  19657. {
  19658. "name": "name",
  19659. "isAttr": true,
  19660. "type": "String"
  19661. },
  19662. {
  19663. "name": "value",
  19664. "isBody": true,
  19665. "type": "String"
  19666. }
  19667. ]
  19668. },
  19669. {
  19670. "name": "Script",
  19671. "superClass": ["InputOutputParameterDefinition"],
  19672. "properties": [
  19673. {
  19674. "name": "scriptFormat",
  19675. "isAttr": true,
  19676. "type": "String"
  19677. },
  19678. {
  19679. "name": "resource",
  19680. "isAttr": true,
  19681. "type": "String"
  19682. },
  19683. {
  19684. "name": "value",
  19685. "isBody": true,
  19686. "type": "String"
  19687. }
  19688. ]
  19689. },
  19690. {
  19691. "name": "Field",
  19692. "superClass": ["Element"],
  19693. "meta": {
  19694. "allowedIn": [
  19695. "camunda:ServiceTaskLike",
  19696. "camunda:ExecutionListener",
  19697. "camunda:TaskListener"
  19698. ]
  19699. },
  19700. "properties": [
  19701. {
  19702. "name": "name",
  19703. "isAttr": true,
  19704. "type": "String"
  19705. },
  19706. {
  19707. "name": "expression",
  19708. "type": "String"
  19709. },
  19710. {
  19711. "name": "stringValue",
  19712. "isAttr": true,
  19713. "type": "String"
  19714. },
  19715. {
  19716. "name": "string",
  19717. "type": "String"
  19718. }
  19719. ]
  19720. },
  19721. {
  19722. "name": "InputParameter",
  19723. "superClass": ["InputOutputParameter"]
  19724. },
  19725. {
  19726. "name": "OutputParameter",
  19727. "superClass": ["InputOutputParameter"]
  19728. },
  19729. {
  19730. "name": "Collectable",
  19731. "isAbstract": true,
  19732. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  19733. "superClass": ["camunda:AsyncCapable"],
  19734. "properties": [
  19735. {
  19736. "name": "collection",
  19737. "isAttr": true,
  19738. "type": "String"
  19739. },
  19740. {
  19741. "name": "elementVariable",
  19742. "isAttr": true,
  19743. "type": "String"
  19744. }
  19745. ]
  19746. },
  19747. {
  19748. "name": "FailedJobRetryTimeCycle",
  19749. "superClass": ["Element"],
  19750. "meta": {
  19751. "allowedIn": [
  19752. "camunda:AsyncCapable",
  19753. "bpmn:MultiInstanceLoopCharacteristics"
  19754. ]
  19755. },
  19756. "properties": [
  19757. {
  19758. "name": "body",
  19759. "isBody": true,
  19760. "type": "String"
  19761. }
  19762. ]
  19763. },
  19764. {
  19765. "name": "ExecutionListener",
  19766. "superClass": ["Element"],
  19767. "meta": {
  19768. "allowedIn": [
  19769. "bpmn:Task",
  19770. "bpmn:ServiceTask",
  19771. "bpmn:UserTask",
  19772. "bpmn:BusinessRuleTask",
  19773. "bpmn:ScriptTask",
  19774. "bpmn:ReceiveTask",
  19775. "bpmn:ManualTask",
  19776. "bpmn:ExclusiveGateway",
  19777. "bpmn:SequenceFlow",
  19778. "bpmn:ParallelGateway",
  19779. "bpmn:InclusiveGateway",
  19780. "bpmn:EventBasedGateway",
  19781. "bpmn:StartEvent",
  19782. "bpmn:IntermediateCatchEvent",
  19783. "bpmn:IntermediateThrowEvent",
  19784. "bpmn:EndEvent",
  19785. "bpmn:BoundaryEvent",
  19786. "bpmn:CallActivity",
  19787. "bpmn:SubProcess",
  19788. "bpmn:Process"
  19789. ]
  19790. },
  19791. "properties": [
  19792. {
  19793. "name": "expression",
  19794. "isAttr": true,
  19795. "type": "String"
  19796. },
  19797. {
  19798. "name": "class",
  19799. "isAttr": true,
  19800. "type": "String"
  19801. },
  19802. {
  19803. "name": "delegateExpression",
  19804. "isAttr": true,
  19805. "type": "String"
  19806. },
  19807. {
  19808. "name": "event",
  19809. "isAttr": true,
  19810. "type": "String"
  19811. },
  19812. {
  19813. "name": "script",
  19814. "type": "Script"
  19815. },
  19816. {
  19817. "name": "fields",
  19818. "type": "Field",
  19819. "isMany": true
  19820. }
  19821. ]
  19822. },
  19823. {
  19824. "name": "TaskListener",
  19825. "superClass": ["Element"],
  19826. "meta": {
  19827. "allowedIn": [
  19828. "bpmn:UserTask"
  19829. ]
  19830. },
  19831. "properties": [
  19832. {
  19833. "name": "expression",
  19834. "isAttr": true,
  19835. "type": "String"
  19836. },
  19837. {
  19838. "name": "class",
  19839. "isAttr": true,
  19840. "type": "String"
  19841. },
  19842. {
  19843. "name": "delegateExpression",
  19844. "isAttr": true,
  19845. "type": "String"
  19846. },
  19847. {
  19848. "name": "event",
  19849. "isAttr": true,
  19850. "type": "String"
  19851. },
  19852. {
  19853. "name": "script",
  19854. "type": "Script"
  19855. },
  19856. {
  19857. "name": "fields",
  19858. "type": "Field",
  19859. "isMany": true
  19860. },
  19861. {
  19862. "name": "id",
  19863. "type": "String",
  19864. "isAttr": true
  19865. },
  19866. {
  19867. "name": "eventDefinitions",
  19868. "type": "bpmn:TimerEventDefinition",
  19869. "isMany": true
  19870. }
  19871. ]
  19872. },
  19873. {
  19874. "name": "FormProperty",
  19875. "superClass": ["Element"],
  19876. "meta": {
  19877. "allowedIn": [
  19878. "bpmn:StartEvent",
  19879. "bpmn:UserTask"
  19880. ]
  19881. },
  19882. "properties": [
  19883. {
  19884. "name": "id",
  19885. "type": "String",
  19886. "isAttr": true
  19887. },
  19888. {
  19889. "name": "name",
  19890. "type": "String",
  19891. "isAttr": true
  19892. },
  19893. {
  19894. "name": "type",
  19895. "type": "String",
  19896. "isAttr": true
  19897. },
  19898. {
  19899. "name": "required",
  19900. "type": "String",
  19901. "isAttr": true
  19902. },
  19903. {
  19904. "name": "readable",
  19905. "type": "String",
  19906. "isAttr": true
  19907. },
  19908. {
  19909. "name": "writable",
  19910. "type": "String",
  19911. "isAttr": true
  19912. },
  19913. {
  19914. "name": "variable",
  19915. "type": "String",
  19916. "isAttr": true
  19917. },
  19918. {
  19919. "name": "expression",
  19920. "type": "String",
  19921. "isAttr": true
  19922. },
  19923. {
  19924. "name": "datePattern",
  19925. "type": "String",
  19926. "isAttr": true
  19927. },
  19928. {
  19929. "name": "default",
  19930. "type": "String",
  19931. "isAttr": true
  19932. },
  19933. {
  19934. "name": "values",
  19935. "type": "Value",
  19936. "isMany": true
  19937. }
  19938. ]
  19939. },
  19940. {
  19941. "name": "FormData",
  19942. "superClass": ["Element"],
  19943. "meta": {
  19944. "allowedIn": [
  19945. "bpmn:StartEvent",
  19946. "bpmn:UserTask"
  19947. ]
  19948. },
  19949. "properties": [
  19950. {
  19951. "name": "fields",
  19952. "type": "FormField",
  19953. "isMany": true
  19954. },
  19955. {
  19956. "name": "businessKey",
  19957. "type": "String",
  19958. "isAttr": true
  19959. }
  19960. ]
  19961. },
  19962. {
  19963. "name": "FormField",
  19964. "superClass": ["Element"],
  19965. "properties": [
  19966. {
  19967. "name": "id",
  19968. "type": "String",
  19969. "isAttr": true
  19970. },
  19971. {
  19972. "name": "label",
  19973. "type": "String",
  19974. "isAttr": true
  19975. },
  19976. {
  19977. "name": "type",
  19978. "type": "String",
  19979. "isAttr": true
  19980. },
  19981. {
  19982. "name": "datePattern",
  19983. "type": "String",
  19984. "isAttr": true
  19985. },
  19986. {
  19987. "name": "defaultValue",
  19988. "type": "String",
  19989. "isAttr": true
  19990. },
  19991. {
  19992. "name": "properties",
  19993. "type": "Properties"
  19994. },
  19995. {
  19996. "name": "validation",
  19997. "type": "Validation"
  19998. },
  19999. {
  20000. "name": "values",
  20001. "type": "Value",
  20002. "isMany": true
  20003. }
  20004. ]
  20005. },
  20006. {
  20007. "name": "Validation",
  20008. "superClass": ["Element"],
  20009. "properties": [
  20010. {
  20011. "name": "constraints",
  20012. "type": "Constraint",
  20013. "isMany": true
  20014. }
  20015. ]
  20016. },
  20017. {
  20018. "name": "Constraint",
  20019. "superClass": ["Element"],
  20020. "properties": [
  20021. {
  20022. "name": "name",
  20023. "type": "String",
  20024. "isAttr": true
  20025. },
  20026. {
  20027. "name": "config",
  20028. "type": "String",
  20029. "isAttr": true
  20030. }
  20031. ]
  20032. },
  20033. {
  20034. "name": "ConditionalEventDefinitionExtension",
  20035. "isAbstract": true,
  20036. "extends": [
  20037. "bpmn:ConditionalEventDefinition"
  20038. ],
  20039. "properties": [
  20040. {
  20041. "name": "variableName",
  20042. "isAttr": true,
  20043. "type": "String"
  20044. },
  20045. {
  20046. "name": "variableEvents",
  20047. "isAttr": true,
  20048. "type": "String"
  20049. }
  20050. ]
  20051. }
  20052. ],
  20053. "emumerations": []
  20054. };
  20055. //# sourceMappingURL=camundaModdleDescriptor.js.map
  20056. /**
  20057. * This is a sample file that should be replaced with the actual translation.
  20058. *
  20059. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  20060. * translations and labels to translate.
  20061. */
  20062. var translations = {
  20063. // Labels
  20064. 'Activate the global connect tool': '激活全局连接工具',
  20065. 'Append {type}': '追加 {type}',
  20066. 'Append EndEvent': '追加 结束事件 ',
  20067. 'Append Task': '追加 任务',
  20068. 'Append Gateway': '追加 网关',
  20069. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  20070. 'Add Lane above': '在上面添加道',
  20071. 'Divide into two Lanes': '分割成两个道',
  20072. 'Divide into three Lanes': '分割成三个道',
  20073. 'Add Lane below': '在下面添加道',
  20074. 'Append compensation activity': '追加补偿活动',
  20075. 'Change type': '修改类型',
  20076. 'Connect using Association': '使用关联连接',
  20077. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  20078. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  20079. 'Remove': '移除',
  20080. 'Activate the hand tool': '激活抓手工具',
  20081. 'Activate the lasso tool': '激活套索工具',
  20082. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  20083. 'Create expanded SubProcess': '创建扩展子过程',
  20084. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  20085. 'Create Pool/Participant': '创建池/参与者',
  20086. 'Parallel Multi Instance': '并行多重事件',
  20087. 'Sequential Multi Instance': '时序多重事件',
  20088. 'DataObjectReference': '数据对象参考',
  20089. 'DataStoreReference': '数据存储参考',
  20090. 'Loop': '循环',
  20091. 'Ad-hoc': '即席',
  20092. 'Create {type}': '创建 {type}',
  20093. 'Create Task': '创建任务',
  20094. 'Create StartEvent': '创建开始事件',
  20095. 'Create EndEvent': '创建结束事件',
  20096. 'Create Group': '创建组',
  20097. 'Task': '任务',
  20098. 'Send Task': '发送任务',
  20099. 'Receive Task': '接收任务',
  20100. 'User Task': '用户任务',
  20101. 'Manual Task': '手工任务',
  20102. 'Business Rule Task': '业务规则任务',
  20103. 'Service Task': '服务任务',
  20104. 'Script Task': '脚本任务',
  20105. 'Call Activity': '调用活动',
  20106. 'Sub Process (collapsed)': '子流程(折叠的)',
  20107. 'Sub Process (expanded)': '子流程(展开的)',
  20108. 'Start Event': '开始事件',
  20109. 'StartEvent': '开始事件',
  20110. 'Intermediate Throw Event': '中间事件',
  20111. 'End Event': '结束事件',
  20112. 'EndEvent': '结束事件',
  20113. 'Create Gateway': '创建网关',
  20114. 'GateWay': '网关',
  20115. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  20116. 'Message Start Event': '消息开始事件',
  20117. 'Timer Start Event': '定时开始事件',
  20118. 'Conditional Start Event': '条件开始事件',
  20119. 'Signal Start Event': '信号开始事件',
  20120. 'Error Start Event': '错误开始事件',
  20121. 'Escalation Start Event': '升级开始事件',
  20122. 'Compensation Start Event': '补偿开始事件',
  20123. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  20124. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  20125. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  20126. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  20127. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  20128. 'Message Intermediate Catch Event': '消息中间捕获事件',
  20129. 'Message Intermediate Throw Event': '消息中间抛出事件',
  20130. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  20131. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  20132. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  20133. 'Link Intermediate Catch Event': '链接中间捕获事件',
  20134. 'Link Intermediate Throw Event': '链接中间抛出事件',
  20135. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  20136. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  20137. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  20138. 'Message End Event': '消息结束事件',
  20139. 'Escalation End Event': '定时结束事件',
  20140. 'Error End Event': '错误结束事件',
  20141. 'Cancel End Event': '取消结束事件',
  20142. 'Compensation End Event': '补偿结束事件',
  20143. 'Signal End Event': '信号结束事件',
  20144. 'Terminate End Event': '终止结束事件',
  20145. 'Message Boundary Event': '消息边界事件',
  20146. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  20147. 'Timer Boundary Event': '定时边界事件',
  20148. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  20149. 'Escalation Boundary Event': '升级边界事件',
  20150. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  20151. 'Conditional Boundary Event': '条件边界事件',
  20152. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  20153. 'Error Boundary Event': '错误边界事件',
  20154. 'Cancel Boundary Event': '取消边界事件',
  20155. 'Signal Boundary Event': '信号边界事件',
  20156. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  20157. 'Compensation Boundary Event': '补偿边界事件',
  20158. 'Exclusive Gateway': '互斥网关',
  20159. 'Parallel Gateway': '并行网关',
  20160. 'Inclusive Gateway': '相容网关',
  20161. 'Complex Gateway': '复杂网关',
  20162. 'Event based Gateway': '事件网关',
  20163. 'Transaction': '转运',
  20164. 'Sub Process': '子流程',
  20165. 'Event Sub Process': '事件子流程',
  20166. 'Collapsed Pool': '折叠池',
  20167. 'Expanded Pool': '展开池',
  20168. // Errors
  20169. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  20170. 'no shape type specified': '没有指定的形状类型',
  20171. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  20172. 'out of bounds release': 'out of bounds release',
  20173. 'more than {count} child lanes': '子道大于{count} ',
  20174. 'element required': '元素不能为空',
  20175. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  20176. 'no diagram to display': '没有可展示的流程图',
  20177. 'no process or collaboration to display': '没有可展示的流程/协作',
  20178. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  20179. 'already rendered {element}': '{element} 已被渲染',
  20180. 'failed to import {element}': '导入{element}失败',
  20181. // 属性面板的参数
  20182. 'Id': '编号',
  20183. 'Name': '名称',
  20184. 'General': '常规',
  20185. 'Details': '详情',
  20186. 'Message Name': '消息名称',
  20187. 'Message': '消息',
  20188. 'Initiator': '创建者',
  20189. 'Asynchronous Continuations': '持续异步',
  20190. 'Asynchronous Before': '异步前',
  20191. 'Asynchronous After': '异步后',
  20192. 'Job Configuration': '工作配置',
  20193. 'Exclusive': '排除',
  20194. 'Job Priority': '工作优先级',
  20195. 'Retry Time Cycle': '重试时间周期',
  20196. 'Documentation': '文档',
  20197. 'Element Documentation': '元素文档',
  20198. 'History Configuration': '历史配置',
  20199. 'History Time To Live': '历史的生存时间',
  20200. 'Forms': '表单',
  20201. 'Form Key': '表单key',
  20202. 'Form Fields': '表单字段',
  20203. 'Business Key': '业务key',
  20204. 'Form Field': '表单字段',
  20205. 'ID': '编号',
  20206. 'Type': '类型',
  20207. 'Label': '名称',
  20208. 'Default Value': '默认值',
  20209. 'Validation': '校验',
  20210. 'Add Constraint': '添加约束',
  20211. 'Config': '配置',
  20212. 'Properties': '属性',
  20213. 'Add Property': '添加属性',
  20214. 'Value': '值',
  20215. 'Add': '添加',
  20216. 'Values': '值',
  20217. 'Add Value': '添加值',
  20218. 'Listeners': '监听器',
  20219. 'Execution Listener': '执行监听',
  20220. 'Event Type': '事件类型',
  20221. 'Listener Type': '监听器类型',
  20222. 'Java Class': 'Java类',
  20223. 'Expression': '表达式',
  20224. 'Must provide a value': '必须提供一个值',
  20225. 'Delegate Expression': '代理表达式',
  20226. 'Script': '脚本',
  20227. 'Script Format': '脚本格式',
  20228. 'Script Type': '脚本类型',
  20229. 'Inline Script': '内联脚本',
  20230. 'External Script': '外部脚本',
  20231. 'Resource': '资源',
  20232. 'Field Injection': '字段注入',
  20233. 'Extensions': '扩展',
  20234. 'Input/Output': '输入/输出',
  20235. 'Input Parameters': '输入参数',
  20236. 'Output Parameters': '输出参数',
  20237. 'Parameters': '参数',
  20238. 'Output Parameter': '输出参数',
  20239. 'Timer Definition Type': '定时器定义类型',
  20240. 'Timer Definition': '定时器定义',
  20241. 'Date': '日期',
  20242. 'Duration': '持续',
  20243. 'Cycle': '循环',
  20244. 'Signal': '信号',
  20245. 'Signal Name': '信号名称',
  20246. 'Escalation': '升级',
  20247. 'Error': '错误',
  20248. 'Link Name': '链接名称',
  20249. 'Condition': '条件名称',
  20250. 'Variable Name': '变量名称',
  20251. 'Variable Event': '变量事件',
  20252. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  20253. 'Wait for Completion': '等待完成',
  20254. 'Activity Ref': '活动参考',
  20255. 'Version Tag': '版本标签',
  20256. 'Executable': '可执行文件',
  20257. 'External Task Configuration': '扩展任务配置',
  20258. 'Task Priority': '任务优先级',
  20259. 'External': '外部',
  20260. 'Connector': '连接器',
  20261. 'Must configure Connector': '必须配置连接器',
  20262. 'Connector Id': '连接器编号',
  20263. 'Implementation': '实现方式',
  20264. 'Field Injections': '字段注入',
  20265. 'Fields': '字段',
  20266. 'Result Variable': '结果变量',
  20267. 'Topic': '主题',
  20268. 'Configure Connector': '配置连接器',
  20269. 'Input Parameter': '输入参数',
  20270. 'Assignee': '代理人',
  20271. 'Candidate Users': '候选用户',
  20272. 'Candidate Groups': '候选组',
  20273. 'Due Date': '到期时间',
  20274. 'Follow Up Date': '跟踪日期',
  20275. 'Priority': '优先级',
  20276. // eslint-disable-next-line no-template-curly-in-string
  20277. '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',
  20278. // eslint-disable-next-line no-template-curly-in-string
  20279. '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',
  20280. 'Variables': '变量',
  20281. 'Candidate Starter Configuration': '候选开始配置',
  20282. 'Task Listener': '任务监听器',
  20283. 'Candidate Starter Groups': '候选开始组',
  20284. 'Candidate Starter Users': '候选开始用户',
  20285. 'Tasklist Configuration': '任务列表配置',
  20286. 'Startable': '启动',
  20287. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  20288. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  20289. 'This maps to the process definition key.': '这会映射为流程定义的键',
  20290. 'CallActivity Type': '调用活动类型',
  20291. 'Condition Type': '条件类型',
  20292. 'Create UserTask': '创建用户任务',
  20293. 'Create CallActivity': '创建调用活动',
  20294. 'Called Element': '调用元素',
  20295. 'Create DataObjectReference': '创建数据对象引用',
  20296. 'Create DataStoreReference': '创建数据存储引用',
  20297. 'Multi Instance': '多实例',
  20298. 'Loop Cardinality': '实例数量',
  20299. Collection: '任务参与人列表',
  20300. 'Element Variable': '元素变量',
  20301. 'Completion Condition': '完成条件'
  20302. };
  20303. //# sourceMappingURL=translations.js.map
  20304. function customTranslate(template, replacements) {
  20305. replacements = replacements || {};
  20306. // Translate
  20307. template = translations[template] || template;
  20308. // Replace
  20309. return template.replace(/{([^}]+)}/g, function (_, key) {
  20310. return replacements[key] || '{' + key + '}';
  20311. });
  20312. }
  20313. //# sourceMappingURL=customTranslate.js.map
  20314. var vjson$l = {
  20315. title: '导入流程',
  20316. layout: 'fit',
  20317. width: 400,
  20318. height: 400,
  20319. items: [
  20320. {
  20321. layout: 'border',
  20322. items: [
  20323. {
  20324. xtype: 'form',
  20325. items: [
  20326. // {
  20327. // xtype: 'cols',
  20328. // items: [
  20329. // {
  20330. // xtype: 'textfield',
  20331. // allowBlank: false,
  20332. // fieldLabel: '流程名称',
  20333. // bind: '{name}'
  20334. // },
  20335. // ],
  20336. // },
  20337. {
  20338. xtype: 'cols',
  20339. items: [
  20340. {
  20341. xtype: 'filefield',
  20342. name: 'deployFile',
  20343. fieldLabel: '文件名称',
  20344. // labelWidth: '100%',
  20345. msgTarget: 'side',
  20346. reference: 'MOBANB_FILE',
  20347. fileUpload: true,
  20348. allowBlank: false,
  20349. // flex: 1,
  20350. // width: '100%',
  20351. buttonText: '请选择文件位置',
  20352. listeners: {
  20353. change: 'scope.fileChange'
  20354. }
  20355. // bind: '{FILE}'
  20356. },
  20357. ]
  20358. }
  20359. ],
  20360. region: 'center',
  20361. split: true,
  20362. },
  20363. ],
  20364. },
  20365. ],
  20366. fbar: {
  20367. xtype: 'toolbar',
  20368. items: [
  20369. {
  20370. xtype: 'button',
  20371. text: '保存',
  20372. iconCls: 'x-fa fa-save',
  20373. listeners: {
  20374. click: 'scope.save',
  20375. },
  20376. }
  20377. ],
  20378. },
  20379. };
  20380. //# sourceMappingURL=ImportBpmn.view.js.map
  20381. var model$l = {
  20382. data: {
  20383. name: '',
  20384. file_content: ''
  20385. }
  20386. };
  20387. //# sourceMappingURL=ImportBpmn.model.js.map
  20388. var ImportBpmn = /** @class */ (function (_super) {
  20389. __extends(ImportBpmn, _super);
  20390. function ImportBpmn() {
  20391. return _super.call(this, { model: model$l, vjson: vjson$l }) || this;
  20392. }
  20393. ImportBpmn.prototype.onLoad = function () {
  20394. };
  20395. ImportBpmn.prototype.save = function (sender) {
  20396. if (this.data.file_content) {
  20397. this.dialogSuccess(this.data);
  20398. }
  20399. else {
  20400. Ext.Msg.alert('提示', "请先上传文件");
  20401. }
  20402. };
  20403. ImportBpmn.prototype.fileChange = function (e) {
  20404. var _this = this;
  20405. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  20406. var file = e.fileInputEl.dom.files[0]; //获取文件
  20407. var reader = new FileReader();
  20408. reader.readAsText(file, "UTF-8");
  20409. reader.onload = function () {
  20410. _this.data.file_content = reader.result;
  20411. };
  20412. };
  20413. return ImportBpmn;
  20414. }(Scope));
  20415. //# sourceMappingURL=ImportBpmn.js.map
  20416. var model$m = {
  20417. data: {
  20418. form_id: '',
  20419. form_name: '',
  20420. save_dir_path: '',
  20421. absolute_path: '',
  20422. form: {
  20423. id: '',
  20424. code: '',
  20425. name: '',
  20426. table: '',
  20427. controller: '',
  20428. groovy: '',
  20429. fields: [],
  20430. buttons: [],
  20431. },
  20432. }
  20433. };
  20434. //# sourceMappingURL=ConfigStrategy.model.js.map
  20435. var vjson$m = {
  20436. title: '配置适配策略',
  20437. layout: 'fit',
  20438. items: [
  20439. {
  20440. layout: 'border',
  20441. items: [
  20442. {
  20443. region: 'center',
  20444. xtype: 'yvgrid',
  20445. pagination: false,
  20446. hideFootbar: true,
  20447. plugins: {
  20448. clipboard: true,
  20449. selectionreplicator: true
  20450. },
  20451. tbar: {
  20452. xtype: 'toolbar',
  20453. items: [
  20454. {
  20455. xtype: 'button',
  20456. text: '添加策略',
  20457. iconCls: 'x-fa fa-plus-circle',
  20458. listeners: {
  20459. click: 'scope.addStrategy'
  20460. }
  20461. },
  20462. {
  20463. xtype: 'button',
  20464. text: '删除',
  20465. iconCls: 'x-fa fa-minus-circle',
  20466. listeners: {}
  20467. },
  20468. '-',
  20469. {
  20470. xtype: 'button',
  20471. text: '上移',
  20472. iconCls: 'x-fa fa-arrow-up',
  20473. listeners: {}
  20474. },
  20475. {
  20476. xtype: 'button',
  20477. text: '下移',
  20478. iconCls: 'x-fa fa-arrow-down',
  20479. listeners: {}
  20480. },
  20481. ]
  20482. },
  20483. columns: [
  20484. { xtype: 'rownumberer' },
  20485. {
  20486. header: '优先级',
  20487. dataIndex: 'priority',
  20488. width: 140,
  20489. sortable: false,
  20490. menuDisabled: true,
  20491. editor: {
  20492. selectOnFocus: true
  20493. },
  20494. },
  20495. {
  20496. header: '策略编号',
  20497. dataIndex: 'strategy_code',
  20498. width: 140,
  20499. sortable: false,
  20500. menuDisabled: true,
  20501. editor: {
  20502. selectOnFocus: true
  20503. },
  20504. },
  20505. {
  20506. header: '策略名称',
  20507. dataIndex: 'strategy_name',
  20508. width: 140,
  20509. sortable: false,
  20510. menuDisabled: true,
  20511. editor: {
  20512. selectOnFocus: true
  20513. },
  20514. },
  20515. {
  20516. header: "条件表达式",
  20517. dataIndex: "strategy_exp",
  20518. },
  20519. ],
  20520. },
  20521. {
  20522. title: '适配条件',
  20523. region: 'south',
  20524. height: '50%',
  20525. xtype: 'form',
  20526. items: [
  20527. {
  20528. xtype: 'cols',
  20529. items: [
  20530. {
  20531. xtype: 'rows',
  20532. items: [
  20533. {
  20534. xtype: 'textfield',
  20535. fieldLabel: "仓库",
  20536. },
  20537. {
  20538. xtype: 'textfield',
  20539. fieldLabel: "货主",
  20540. },
  20541. {
  20542. xtype: 'textfield',
  20543. fieldLabel: "项目",
  20544. },
  20545. {
  20546. xtype: 'textfield',
  20547. fieldLabel: "行政区划",
  20548. },
  20549. {
  20550. xtype: 'textfield',
  20551. fieldLabel: "客户",
  20552. },
  20553. {
  20554. xtype: 'textfield',
  20555. fieldLabel: "商品",
  20556. }
  20557. ]
  20558. },
  20559. {
  20560. xtype: 'rows',
  20561. margin: '8 0 0 10',
  20562. items: [
  20563. {
  20564. xtype: 'label',
  20565. html: '自定义表达式',
  20566. },
  20567. {
  20568. xtype: 'textarea',
  20569. }
  20570. ]
  20571. }
  20572. ]
  20573. }
  20574. ]
  20575. }
  20576. ]
  20577. }
  20578. ]
  20579. };
  20580. //
  20581. //# sourceMappingURL=ConfigStrategy.view.js.map
  20582. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  20583. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  20584. // import ReportRunner from "./ReportRunner";
  20585. var ConfigStrategy = /** @class */ (function (_super) {
  20586. __extends(ConfigStrategy, _super);
  20587. function ConfigStrategy() {
  20588. return _super.call(this, { model: model$m, vjson: vjson$m }) || this;
  20589. }
  20590. ConfigStrategy.prototype.onLoad = function () {
  20591. this.load();
  20592. };
  20593. ConfigStrategy.prototype.load = function () {
  20594. var _this = this;
  20595. var form_id = this.viewModel.get("form_id");
  20596. var absolute_path = this.viewModel.get("absolute_path");
  20597. var save_dir_path = this.viewModel.get("save_dir_path");
  20598. if (absolute_path && form_id) {
  20599. this.setLoading(true);
  20600. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  20601. if (res.success) {
  20602. // 基础属性
  20603. _this.viewModel.set('form', res.data.form);
  20604. // 字段定义
  20605. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  20606. // 按钮
  20607. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  20608. }
  20609. }).finally(function () {
  20610. _this.setLoading(false);
  20611. });
  20612. }
  20613. };
  20614. ConfigStrategy.prototype.saveAll = function () {
  20615. var _this = this;
  20616. var save_dir_path = this.viewModel.get("save_dir_path");
  20617. if (!save_dir_path) {
  20618. msg("save_dir_path error");
  20619. return;
  20620. }
  20621. var form_id = this.viewModel.get("form_id");
  20622. var absolute_path = this.viewModel.get("absolute_path");
  20623. // 表格校验
  20624. if (!this.refs.form1.isValid()) {
  20625. msg("请检查表单必填项!");
  20626. return;
  20627. }
  20628. // 字段数据
  20629. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  20630. delete item.id;
  20631. if (item.hide) {
  20632. delete item.hide_text;
  20633. }
  20634. else {
  20635. item.hide = item.hide_text;
  20636. delete item.hide_text;
  20637. }
  20638. if (item.readonly) {
  20639. delete item.readonly_text;
  20640. }
  20641. else {
  20642. item.readonly = item.readonly_text;
  20643. delete item.readonly_text;
  20644. }
  20645. if (item.disabled) {
  20646. delete item.disabled_text;
  20647. }
  20648. else {
  20649. item.disabled = item.disabled_text;
  20650. delete item.disabled_text;
  20651. }
  20652. if (item.required) {
  20653. delete item.required_text;
  20654. }
  20655. else {
  20656. item.required = item.required_text;
  20657. delete item.required_text;
  20658. }
  20659. return item;
  20660. });
  20661. this.viewModel.set("form.fields", gridColumnRows);
  20662. // 按钮数据
  20663. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  20664. delete item.id;
  20665. return item;
  20666. });
  20667. this.viewModel.set("form.buttons", gridBtnRows);
  20668. // 查询条件
  20669. // 策略
  20670. var form = this.viewModel.get("form");
  20671. this.setLoading(true);
  20672. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  20673. if (res.success) {
  20674. msg('保存成功');
  20675. handles$1.mainWindow.refs['exporerTree'].reload();
  20676. }
  20677. }).finally(function () {
  20678. _this.setLoading(false);
  20679. });
  20680. };
  20681. ConfigStrategy.prototype.addColumn = function () {
  20682. this.refs.gridColumn.getStore().add({});
  20683. };
  20684. ConfigStrategy.prototype.removeColumn = function () {
  20685. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  20686. };
  20687. ConfigStrategy.prototype.calcColumn = function (sender) {
  20688. var _this = this;
  20689. var table = this.viewModel.get("form.table");
  20690. if (!table) {
  20691. msg("表名不存在!");
  20692. return;
  20693. }
  20694. this.setLoading(true);
  20695. calcColumnForm({ table: table }).then(function (res) {
  20696. if (res.success) {
  20697. msg(res.msg);
  20698. if (res.data.columns.length > 0) {
  20699. _$2.forEach(res.data.columns, function (it) {
  20700. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  20701. });
  20702. }
  20703. }
  20704. }).finally(function () {
  20705. _this.setLoading(false);
  20706. });
  20707. };
  20708. ConfigStrategy.prototype.addButton = function () {
  20709. this.refs.gridButton.getStore().add({});
  20710. };
  20711. ConfigStrategy.prototype.moveUp = function (sender) {
  20712. var grid = sender.up('grid');
  20713. grid.rowMoveUp();
  20714. };
  20715. ConfigStrategy.prototype.moveDown = function (sender) {
  20716. var grid = sender.up('grid');
  20717. grid.rowMoveDown();
  20718. };
  20719. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  20720. var win = new Ext.Window({
  20721. autoDestroy: true,
  20722. title: "添加(编辑)策略",
  20723. width: 400,
  20724. height: 300,
  20725. resizable: true,
  20726. closable: true,
  20727. maximizable: true,
  20728. minimizable: true,
  20729. plain: true,
  20730. // constrainHeader: true,
  20731. constrain: true,
  20732. layout: 'fit',
  20733. animateTarget: sender,
  20734. buttonAlign: 'center',
  20735. items: [
  20736. {
  20737. xtype: "form",
  20738. layout: "hbox",
  20739. margin: '10px 20px',
  20740. border: 0,
  20741. items: [
  20742. {
  20743. flex: 1,
  20744. layout: 'vbox',
  20745. items: [
  20746. {
  20747. xtype: "numberfield",
  20748. fieldLabel: "优先级",
  20749. flex: 1,
  20750. allowBlank: false,
  20751. labelWidth: 50,
  20752. width: "100%",
  20753. },
  20754. {
  20755. xtype: "textfield",
  20756. fieldLabel: "策略名称",
  20757. flex: 1,
  20758. allowBlank: false,
  20759. labelWidth: 50,
  20760. width: "100%",
  20761. },
  20762. {
  20763. xtype: "textfield",
  20764. fieldLabel: "策略编号",
  20765. flex: 1,
  20766. allowBlank: false,
  20767. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20768. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20769. labelWidth: 50,
  20770. width: "100%",
  20771. },
  20772. {
  20773. xtype: "textfield",
  20774. fieldLabel: "仓库ID",
  20775. flex: 1,
  20776. allowBlank: false,
  20777. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20778. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20779. labelWidth: 50,
  20780. width: "100%",
  20781. },
  20782. ]
  20783. },
  20784. ]
  20785. }
  20786. ],
  20787. //窗口按钮
  20788. buttons: [
  20789. {
  20790. xtype: 'button', text: '保存', handler: function (btn) {
  20791. //窗口获取表单
  20792. var form = win.down('form');
  20793. var vaildSuccess = form.isValid();
  20794. if (!vaildSuccess) {
  20795. return;
  20796. }
  20797. var filename = form.down('textfield[name="filename"]').getValue();
  20798. }
  20799. },
  20800. {
  20801. xtype: 'button', text: '取消', handler: function (btn) {
  20802. //窗口关闭
  20803. win.close();
  20804. }
  20805. }
  20806. ]
  20807. });
  20808. win.show();
  20809. };
  20810. return ConfigStrategy;
  20811. }(Scope));
  20812. //# sourceMappingURL=ConfigStrategy.js.map
  20813. var buildVjson = function () {
  20814. return {
  20815. bind: {
  20816. title: '流程编辑-{text}',
  20817. },
  20818. layout: 'fit',
  20819. items: [{
  20820. layout: 'border',
  20821. tbar: {
  20822. xtype: 'toolbar',
  20823. items: [
  20824. {
  20825. xtype: 'button',
  20826. text: '撤销',
  20827. listeners: {
  20828. click: "scope.undo"
  20829. }
  20830. },
  20831. {
  20832. xtype: 'button',
  20833. text: '还原',
  20834. listeners: {
  20835. click: "scope.redo"
  20836. }
  20837. },
  20838. {
  20839. xtype: 'button',
  20840. text: '保存',
  20841. listeners: {
  20842. click: "scope.save"
  20843. }
  20844. },
  20845. {
  20846. xtype: 'button',
  20847. text: '导入BPM',
  20848. listeners: {
  20849. click: "scope.importBpm"
  20850. }
  20851. },
  20852. {
  20853. xtype: 'button',
  20854. text: '配置适配策略',
  20855. listeners: {
  20856. click: "scope.configStrategy"
  20857. }
  20858. },
  20859. {
  20860. fieldLabel: '选择配置分支',
  20861. xtype: 'combogrid',
  20862. },
  20863. ]
  20864. },
  20865. items: [
  20866. {
  20867. xtype: "panel",
  20868. region: 'center',
  20869. reference: "bpmn_view",
  20870. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  20871. },
  20872. {
  20873. split: true,
  20874. xtype: "panel",
  20875. region: 'east',
  20876. width: '30%',
  20877. reference: "bpmn_properties",
  20878. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  20879. }
  20880. ],
  20881. }],
  20882. listeners: {
  20883. afterrender: 'scope.onViewRender'
  20884. }
  20885. };
  20886. };
  20887. var BpmnDesign = /** @class */ (function (_super) {
  20888. __extends(BpmnDesign, _super);
  20889. function BpmnDesign() {
  20890. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  20891. _this.bpmnModeler = null;
  20892. _this.bpmnModelerName = "";
  20893. return _this;
  20894. }
  20895. BpmnDesign.prototype.onLoad = function () {
  20896. var _this = this;
  20897. _super.prototype.onLoad.call(this);
  20898. this.setLoading(true);
  20899. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  20900. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  20901. if (res && res.success && res.data && res.data.bpmn) {
  20902. var diagramXML = res.data.bpmn;
  20903. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  20904. var elements = _this.bpmnModeler._definitions.rootElements;
  20905. if (Array.isArray(elements) && elements.length > 0) {
  20906. elements[0].name = _this.bpmnModelerName;
  20907. }
  20908. }).catch(function (err) {
  20909. msgError(err);
  20910. });
  20911. }
  20912. else {
  20913. msgError(res.msg);
  20914. }
  20915. }).finally(function () {
  20916. _this.setLoading(false);
  20917. });
  20918. };
  20919. BpmnDesign.prototype.onViewRender = function (sender) {
  20920. var customTranslateModule = {
  20921. translate: ['value', customTranslate]
  20922. };
  20923. this.bpmnModeler = new BpmnModeler({
  20924. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  20925. propertiesPanel: {
  20926. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  20927. },
  20928. additionalModules: [
  20929. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  20930. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  20931. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  20932. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  20933. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  20934. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  20935. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  20936. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  20937. customTranslateModule,
  20938. ],
  20939. moddleExtensions: {
  20940. camunda: camundaModdleDescriptor
  20941. },
  20942. keyboard: { bindTo: document } // 使用键盘快捷键
  20943. });
  20944. };
  20945. //开启快捷键
  20946. //modeler.get('keyboard').bind(document);
  20947. //关闭快捷键
  20948. //modeler.get('keyboard').unbind();
  20949. BpmnDesign.prototype.undo = function (sender) {
  20950. this.bpmnModeler.get('commandStack').undo();
  20951. };
  20952. BpmnDesign.prototype.redo = function (sender) {
  20953. this.bpmnModeler.get('commandStack').redo();
  20954. };
  20955. BpmnDesign.prototype.save = function (sender) {
  20956. var _this = this;
  20957. this.setLoading(true);
  20958. this.bpmnModeler.saveXML().then(function (resBpm) {
  20959. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  20960. if (res.success) {
  20961. msg$1("保存成功");
  20962. }
  20963. else {
  20964. msgError(res.msg);
  20965. }
  20966. }).catch(function (e) {
  20967. var _a, _b;
  20968. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  20969. msgError(msg);
  20970. }).finally(function () {
  20971. _this.setLoading(false);
  20972. });
  20973. }).catch(function (e) {
  20974. msgError(e);
  20975. _this.setLoading(false);
  20976. });
  20977. };
  20978. BpmnDesign.prototype.importBpm = function (sender) {
  20979. var _this = this;
  20980. var dlg = new ImportBpmn();
  20981. //@ts-ignore
  20982. dlg.success = function (sen, data) {
  20983. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  20984. var elements = _this.bpmnModeler._definitions.rootElements;
  20985. if (Array.isArray(elements) && elements.length > 0) {
  20986. elements[0].name = _this.bpmnModelerName;
  20987. }
  20988. }).catch(function (err) {
  20989. msgError(err);
  20990. });
  20991. };
  20992. dlg.showDialog(sender, {}, {});
  20993. // this.bpmnModeler.importXML()
  20994. };
  20995. BpmnDesign.prototype.configStrategy = function (sender) {
  20996. var configStrategy = new ConfigStrategy();
  20997. configStrategy.showDialog(sender, {}, {});
  20998. };
  20999. return BpmnDesign;
  21000. }(Scope));
  21001. //# sourceMappingURL=BpmnDesign.js.map
  21002. var model$n = {
  21003. data: {
  21004. id: '',
  21005. path: '',
  21006. form: {
  21007. title: '',
  21008. sqlId: '',
  21009. }
  21010. }
  21011. };
  21012. //# sourceMappingURL=WhLayoutDesign.model.js.map
  21013. var vjson$n = {
  21014. bind: {
  21015. title: '{title}',
  21016. },
  21017. layout: 'fit',
  21018. items: [
  21019. {
  21020. layout: 'border',
  21021. items: [
  21022. {
  21023. region: 'center',
  21024. reference: 'editor',
  21025. border: true,
  21026. // html: '<div class="geEditor"></div>',
  21027. // listeners: {
  21028. // afterrender: 'scope.editorInit'
  21029. // }
  21030. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  21031. listeners: {
  21032. afterrender: 'scope.iframeRender'
  21033. }
  21034. },
  21035. ]
  21036. }
  21037. ]
  21038. }; //
  21039. //
  21040. //# sourceMappingURL=WhLayoutDesign.view.js.map
  21041. var WidgetDesign$1 = /** @class */ (function (_super) {
  21042. __extends(WidgetDesign, _super);
  21043. function WidgetDesign(layoutCode, layoutName) {
  21044. var _this = _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  21045. _this.layoutCode = layoutCode;
  21046. _this.layoutName = layoutName;
  21047. return _this;
  21048. }
  21049. WidgetDesign.prototype.onLoad = function () {
  21050. this.viewModel.set('layoutCode', this.layoutCode);
  21051. this.viewModel.set('layoutName', this.layoutName);
  21052. if (this.layoutCode) {
  21053. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  21054. }
  21055. else {
  21056. this.viewModel.set('title', '新建图纸');
  21057. }
  21058. };
  21059. WidgetDesign.prototype.reload = function () {
  21060. var _this = this;
  21061. this.setLoading(true);
  21062. loadWhLayout({
  21063. layoutCode: this.layoutCode,
  21064. layoutName: this.layoutName,
  21065. }).then(function (res) {
  21066. if (res.success) {
  21067. var xml = res.data.layoutContent;
  21068. var doc = _this.mxUtils.parseXml(xml);
  21069. var graph = _this.editorUi.editor.graph;
  21070. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  21071. }
  21072. }).finally(function () {
  21073. _this.setLoading(false);
  21074. });
  21075. };
  21076. WidgetDesign.prototype.editorInit = function (sender) {
  21077. var that = this;
  21078. var dom = $(sender.el.dom).find('.geEditor')[0];
  21079. //@ts-ignore
  21080. require(['mxgraph'], function () {
  21081. var editorUiInit = EditorUi.prototype.init;
  21082. EditorUi.prototype.init = function () {
  21083. editorUiInit.apply(this, arguments);
  21084. this.actions.get('save').funct = that.onFileSave.bind(that);
  21085. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21086. this.actions.get('open').visible = false;
  21087. this.actions.get('new').visible = false;
  21088. this.actions.get('preview').visible = false;
  21089. this.actions.get('print').visible = false;
  21090. this.actions.get('pageSetup').visible = false;
  21091. this.actions.get('help').visible = false;
  21092. this.actions.get('export').visible = false;
  21093. this.actions.get('about').visible = false;
  21094. this.menus.menus.help.setEnabled(false);
  21095. that.editorUi = this;
  21096. if (that.layoutCode) {
  21097. that.reload();
  21098. }
  21099. };
  21100. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  21101. var mxLanguage = 'zh';
  21102. mxResources.loadDefaultBundle = false;
  21103. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  21104. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  21105. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  21106. // Fixes possible asynchronous requests
  21107. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  21108. // Adds bundle text to resources
  21109. mxResources.parse(xhr[0].getText());
  21110. // Configures the default graph theme
  21111. var themes = new Object();
  21112. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  21113. // Main
  21114. new EditorUi(new Editor(false, themes), dom);
  21115. }, function () {
  21116. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  21117. });
  21118. });
  21119. };
  21120. WidgetDesign.prototype.iframeRender = function (sender) {
  21121. var that = this;
  21122. var iframe = $(sender.el.dom).find('iframe')[0];
  21123. iframe.contentWindow['designer'] = that;
  21124. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  21125. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  21126. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21127. editorUi.actions.get('open').visible = false;
  21128. editorUi.actions.get('new').visible = false;
  21129. editorUi.actions.get('preview').visible = false;
  21130. editorUi.actions.get('print').visible = false;
  21131. editorUi.actions.get('pageSetup').visible = false;
  21132. editorUi.actions.get('help').visible = false;
  21133. editorUi.actions.get('export').visible = false;
  21134. editorUi.actions.get('about').visible = false;
  21135. editorUi.menus.menus.help.setEnabled(false);
  21136. that.editorUi = editorUi;
  21137. that.mxUtils = iframe.contentWindow['mxUtils'];
  21138. if (that.layoutCode) {
  21139. that.reload();
  21140. }
  21141. };
  21142. };
  21143. WidgetDesign.prototype.onDestroy = function () {
  21144. var _a;
  21145. try {
  21146. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  21147. }
  21148. catch (e) {
  21149. }
  21150. };
  21151. WidgetDesign.prototype.onFileSaveAs = function () {
  21152. var _this = this;
  21153. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  21154. .then(function (_a) {
  21155. var code = _a.code, name = _a.name;
  21156. _this.layoutCode = code;
  21157. _this.layoutName = name;
  21158. _this.onSave();
  21159. });
  21160. };
  21161. WidgetDesign.prototype.onSave = function () {
  21162. var _this = this;
  21163. var layoutContent = this.editorUi.getEditBlankXml();
  21164. var layoutCode = this.layoutCode;
  21165. var layoutName = this.layoutName;
  21166. if (!layoutCode || !layoutName) {
  21167. msg$1('图形编号和图形名称必填');
  21168. return;
  21169. }
  21170. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  21171. this.setLoading(true);
  21172. saveWhLayout({
  21173. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  21174. }).then(function (res) {
  21175. msg$1(res.msg);
  21176. handles$1.whLayout.reload();
  21177. }).finally(function () {
  21178. _this.setLoading(false);
  21179. });
  21180. };
  21181. WidgetDesign.prototype.onFileSave = function () {
  21182. if (!this.layoutCode || !this.layoutName) {
  21183. this.onFileSaveAs();
  21184. }
  21185. else {
  21186. this.onSave();
  21187. }
  21188. };
  21189. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  21190. var code = _a.code, name = _a.name;
  21191. return new Promise(function (resolve, reject) {
  21192. var viewModel = new Ext.app.ViewModel({
  21193. data: {
  21194. code: code !== null && code !== void 0 ? code : '',
  21195. name: name !== null && name !== void 0 ? name : '',
  21196. }
  21197. });
  21198. var dlg = Ext.create('Ext.window.Window', {
  21199. title: '保存',
  21200. viewModel: viewModel,
  21201. layout: {
  21202. type: "vbox",
  21203. pack: "start",
  21204. align: "stretch"
  21205. },
  21206. items: [
  21207. {
  21208. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  21209. bind: '{code}'
  21210. },
  21211. {
  21212. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  21213. bind: '{name}'
  21214. }
  21215. ],
  21216. fbar: [
  21217. {
  21218. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  21219. click: function () {
  21220. var code = viewModel.get('code');
  21221. var name = viewModel.get('name');
  21222. resolve({ code: code, name: name });
  21223. dlg.close();
  21224. }
  21225. }
  21226. },
  21227. {
  21228. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  21229. click: function () {
  21230. dlg.close();
  21231. }
  21232. }
  21233. },
  21234. ]
  21235. });
  21236. dlg.show();
  21237. });
  21238. };
  21239. return WidgetDesign;
  21240. }(Scope));
  21241. //# sourceMappingURL=WhLayoutDesign.js.map
  21242. // init()
  21243. var Workbench = /** @class */ (function (_super) {
  21244. __extends(Workbench, _super);
  21245. // activeModulePage: ModulePage = null
  21246. function Workbench() {
  21247. var _this = _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  21248. _this.name = "MainWindow";
  21249. _this.modules = [];
  21250. _this.yvgridDesign = null;
  21251. return _this;
  21252. }
  21253. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  21254. if (newCard) {
  21255. this.viewModel.set('leftTabTitle', newCard.tooltip);
  21256. }
  21257. else {
  21258. this.viewModel.set('leftTabTitle', '未选中');
  21259. }
  21260. };
  21261. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  21262. get: function () {
  21263. var _a;
  21264. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  21265. },
  21266. enumerable: true,
  21267. configurable: true
  21268. });
  21269. Workbench.prototype.documentKeydown = function (event) {
  21270. if (event.ctrlKey || event.metaKey) {
  21271. if (event.key.toLowerCase() === 's') {
  21272. eventBus.publish(EventType.SaveCall, {});
  21273. event.stopPropagation();
  21274. event.preventDefault();
  21275. }
  21276. else if (event.key.toLowerCase() === 'z') {
  21277. if (event.shiftKey) {
  21278. eventBus.publish(EventType.Redo, {});
  21279. event.stopPropagation();
  21280. event.preventDefault();
  21281. }
  21282. else {
  21283. eventBus.publish(EventType.Undo, {});
  21284. event.stopPropagation();
  21285. event.preventDefault();
  21286. }
  21287. }
  21288. }
  21289. };
  21290. Workbench.prototype.onLoad = function () {
  21291. var _this = this;
  21292. window["tt"] = this.refs['tt'];
  21293. window["vm"] = this.viewModel;
  21294. $('#loading').remove();
  21295. setMainWindow(this);
  21296. setStatusbar(this.down('statusbar'));
  21297. document.addEventListener('keydown', this.documentKeydown.bind(this));
  21298. var currentProject = getCurrentProject();
  21299. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  21300. // handles.fileTree.reload()
  21301. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  21302. _this.showModule(rawData);
  21303. });
  21304. eventBus.subscribe(EventType.Undo, function () {
  21305. _this.onUndo();
  21306. });
  21307. eventBus.subscribe(EventType.Redo, function () {
  21308. _this.onRedo();
  21309. });
  21310. eventBus.subscribe(EventType.Cut, function (_a) {
  21311. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21312. _this.onCut(a, b, c, d);
  21313. });
  21314. eventBus.subscribe(EventType.Copy, function (_a) {
  21315. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21316. _this.onCopy(a, b, c, d);
  21317. });
  21318. eventBus.subscribe(EventType.Paste, function (_a) {
  21319. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21320. _this.onPaste(a, b, c, d);
  21321. });
  21322. eventBus.subscribe(EventType.SelectAll, function () {
  21323. _this.onSelectAll();
  21324. });
  21325. eventBus.subscribe(EventType.SelectAll, function () {
  21326. _this.onSelectAll();
  21327. });
  21328. eventBus.subscribe(EventType.RunCheckModule, function () {
  21329. _this.runCheckModule();
  21330. });
  21331. eventBus.subscribe(EventType.StopCheckModule, function () {
  21332. _this.stopCheckModule();
  21333. });
  21334. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  21335. _this.onCompoentContextMenu(args);
  21336. });
  21337. this.runCheckModule();
  21338. };
  21339. Workbench.prototype.onCompoentContextMenu = function (args) {
  21340. var _this = this;
  21341. if (!this.yvgridDesign) {
  21342. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  21343. this.yvgridDesign.showDialog(null, {}, {});
  21344. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  21345. this.yvgridDesign.onDestroy = function () {
  21346. fn_1();
  21347. _this.yvgridDesign = null;
  21348. };
  21349. }
  21350. };
  21351. Workbench.prototype.runCheckModule = function () {
  21352. var _this = this;
  21353. if (this.checkTimer) {
  21354. return;
  21355. }
  21356. this.checkTimer = setInterval(function () {
  21357. var _a;
  21358. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  21359. _this.activeModulePage.check();
  21360. }
  21361. }, 5000);
  21362. };
  21363. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  21364. var dlg = new WidgetDesign(widgetPath, widgetName);
  21365. dlg.showPage({
  21366. id: 'widget_' + widgetPath,
  21367. path: 'widget_' + widgetPath,
  21368. }, {
  21369. data: {
  21370. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  21371. }
  21372. });
  21373. dlg.dialogSuccess = successCallback;
  21374. };
  21375. Workbench.prototype.stopCheckModule = function () {
  21376. clearInterval(this.checkTimer);
  21377. this.checkTimer = null;
  21378. };
  21379. Workbench.prototype.showDataSync = function () {
  21380. var ins = new DbSync();
  21381. ins.showPage({
  21382. id: 'db_sync__',
  21383. path: 'db_sync__',
  21384. }, {
  21385. data: {}
  21386. });
  21387. };
  21388. /**
  21389. * 打开一个项目
  21390. */
  21391. Workbench.prototype.openProject = function (project) {
  21392. setCurrentProject(project);
  21393. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  21394. handles$1.fileTree.reload();
  21395. };
  21396. /**
  21397. * 打开模板开发面板
  21398. */
  21399. Workbench.prototype.showTemplateDev = function () {
  21400. var ins = new TemplateDev();
  21401. ins.showPage({
  21402. id: 'template_dev__',
  21403. path: 'template_dev__',
  21404. }, {
  21405. data: {}
  21406. });
  21407. };
  21408. Workbench.prototype.openScope = function () {
  21409. };
  21410. /**
  21411. * 显示字段域管理器
  21412. */
  21413. Workbench.prototype.showColumnDomain = function () {
  21414. var instance = new DbDomain();
  21415. instance.showPage({
  21416. id: 'domain__',
  21417. path: 'domain__',
  21418. }, {
  21419. data: {}
  21420. });
  21421. };
  21422. /**
  21423. * 显示性能统计
  21424. */
  21425. Workbench.prototype.showPerform = function () {
  21426. // const instance = new PerformStats()
  21427. // instance.showPage({
  21428. // id: 'perform__',
  21429. // path: 'perform__',
  21430. //
  21431. // }, {
  21432. // data: {}
  21433. // })
  21434. };
  21435. /**
  21436. * 显示数据库代码模板库
  21437. */
  21438. Workbench.prototype.showDbCodeTemplate = function () {
  21439. // const instance = new DbCodeTemplate()
  21440. // instance.showPage({
  21441. // id: 'dbcode__',
  21442. // path: 'dbcode__',
  21443. //
  21444. // }, {
  21445. // data: {}
  21446. // })
  21447. };
  21448. /**
  21449. * 显示数据库代码模板库
  21450. */
  21451. Workbench.prototype.showReport = function (report_id, report_name, success) {
  21452. var instance = new ReportDesign();
  21453. instance.showPage({
  21454. id: 'report_' + report_id,
  21455. path: 'report_' + report_id,
  21456. }, {
  21457. data: {
  21458. report_id: report_id,
  21459. report_name: report_name,
  21460. }
  21461. });
  21462. instance.dialogSuccess = success;
  21463. };
  21464. /**
  21465. * 显示报表
  21466. */
  21467. Workbench.prototype.showReportPreview = function (report_id, instance) {
  21468. instance.showPage({
  21469. id: 'REPORT__' + report_id,
  21470. path: 'REPORT__' + report_id,
  21471. }, {
  21472. data: {
  21473. report_id: report_id,
  21474. }
  21475. });
  21476. var reportName = instance.viewModel.get('report_name');
  21477. instance.viewModel.set('report_name', '[预览]-' + reportName);
  21478. };
  21479. /**
  21480. * 显示运维页面
  21481. */
  21482. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  21483. // const instance = new DevOpsTerminal()
  21484. // instance.showPage({
  21485. // id: 'ops_' + opsId,
  21486. // path: 'ops_' + opsId,
  21487. //
  21488. // }, {
  21489. // data: {
  21490. // opsId: opsId,
  21491. // name: name,
  21492. // }
  21493. // })
  21494. // instance.dialogSuccess = success
  21495. };
  21496. /**
  21497. * 显示表结构
  21498. * tableName 为空的情况就是新建表,否则就是要编辑的表
  21499. * columnName 可以为空
  21500. */
  21501. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  21502. var id = 'tableColumn_' + tableName;
  21503. var isCreateTable = false;
  21504. // /ROOT/schema$public/schema$public$bas_location_group_rel
  21505. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  21506. if (!tableName) {
  21507. id = _$2.uniqueId('new_table');
  21508. tableName = id;
  21509. isCreateTable = true;
  21510. }
  21511. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  21512. instance.showPage({
  21513. id: id,
  21514. path: id,
  21515. locatPath: locatPath
  21516. }, {
  21517. data: {
  21518. tableName: tableName,
  21519. columnName: columnName
  21520. }
  21521. });
  21522. };
  21523. /**
  21524. * 打开某个模块
  21525. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  21526. */
  21527. Workbench.prototype.showModule = function (rawData) {
  21528. var id = rawData.id, path = rawData.path;
  21529. var separator = '/';
  21530. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  21531. var module = this.modules[idx];
  21532. var pageId = path.replaceAll('/', '_');
  21533. console.log('open module', module);
  21534. var instance = new ModulePage(id, module);
  21535. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  21536. instance.showPage({
  21537. id: 'module_' + pageId,
  21538. path: path,
  21539. title: module.name
  21540. }, {
  21541. data: {}
  21542. });
  21543. };
  21544. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  21545. var bpmnDesign = new BpmnDesign();
  21546. bpmnDesign.showPage({}, {
  21547. data: {
  21548. absolutePath: absolutePath,
  21549. id: id,
  21550. text: text
  21551. }
  21552. });
  21553. };
  21554. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  21555. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  21556. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  21557. layoutDesign.showPage({
  21558. id: id,
  21559. path: id,
  21560. }, {
  21561. data: {}
  21562. });
  21563. };
  21564. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  21565. var _a;
  21566. // this.activeModulePage = newCard.yvanScope
  21567. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  21568. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  21569. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  21570. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  21571. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  21572. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  21573. eventBus.publish(EventType.MainTabChange, {
  21574. moduleId: newCard.yvanScope.moduleId,
  21575. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  21576. from: this.name
  21577. });
  21578. };
  21579. Workbench.prototype.onUndo = function () {
  21580. var _a;
  21581. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  21582. };
  21583. Workbench.prototype.onRedo = function () {
  21584. var _a;
  21585. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  21586. };
  21587. Workbench.prototype.onCut = function (a, b, c, d) {
  21588. var _a;
  21589. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  21590. };
  21591. Workbench.prototype.onCopy = function (a, b, c, d) {
  21592. var _a;
  21593. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  21594. };
  21595. Workbench.prototype.onPaste = function (a, b, c, d) {
  21596. var _a;
  21597. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  21598. };
  21599. Workbench.prototype.onSelectAll = function () {
  21600. var _a;
  21601. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  21602. };
  21603. return Workbench;
  21604. }(Scope));
  21605. //# sourceMappingURL=Workbench.js.map
  21606. (function (FuncDomain) {
  21607. FuncDomain["SCOPE"] = "scope";
  21608. FuncDomain["SYSTEM"] = "system";
  21609. })(exports.FuncDomain || (exports.FuncDomain = {}));
  21610. (function (BizMode) {
  21611. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  21612. BizMode[BizMode["query"] = 1] = "query";
  21613. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  21614. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  21615. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  21616. })(exports.BizMode || (exports.BizMode = {}));
  21617. (function (BizFormat) {
  21618. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  21619. BizFormat[BizFormat["button"] = 1] = "button";
  21620. BizFormat[BizFormat["progress"] = 2] = "progress";
  21621. BizFormat[BizFormat["date"] = 3] = "date";
  21622. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  21623. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  21624. })(exports.BizFormat || (exports.BizFormat = {}));
  21625. (function (BizUnique) {
  21626. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  21627. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  21628. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  21629. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  21630. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  21631. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  21632. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  21633. })(exports.BizUnique || (exports.BizUnique = {}));
  21634. var ScopeEngine = /** @class */ (function () {
  21635. function ScopeEngine() {
  21636. }
  21637. ScopeEngine.getBizFile = function (director) {
  21638. return new Promise(function (resolve, reject) {
  21639. debugger;
  21640. });
  21641. };
  21642. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  21643. return new Promise(function (resolve, reject) {
  21644. var requireArr = [];
  21645. var requireKeyArr = [];
  21646. _$2.forOwn(billFile.domains, function (v, k) {
  21647. requireArr.push(v.domain);
  21648. requireKeyArr.push(k);
  21649. if (v.layout) {
  21650. requireArr.push(v.layout);
  21651. requireKeyArr.push(k + "_layout");
  21652. }
  21653. });
  21654. requireArr.push(billFile.layout);
  21655. requireKeyArr.push("layout");
  21656. requireArr.push(billFile.converter);
  21657. requireKeyArr.push("converter");
  21658. // @ts-ignore
  21659. require(requireArr, function () {
  21660. var requireReArr = [];
  21661. for (var _i = 0; _i < arguments.length; _i++) {
  21662. requireReArr[_i] = arguments[_i];
  21663. }
  21664. if (requireReArr.length <= 0) {
  21665. reject(new Error("没有加载到相关的文件!"));
  21666. }
  21667. var domains = {};
  21668. for (var i = 0; i < requireReArr.length - 2; i++) {
  21669. if (requireKeyArr[i].endsWith("_layout")) {
  21670. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  21671. domains[key_d].layout = requireReArr[i].default;
  21672. }
  21673. else {
  21674. domains[requireKeyArr[i]] = requireReArr[i].default;
  21675. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  21676. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  21677. }
  21678. }
  21679. var bizFile = {
  21680. bill: billFile,
  21681. domains: domains,
  21682. layout: requireReArr[requireReArr.length - 2].default,
  21683. converter: requireReArr[requireReArr.length - 1].default,
  21684. };
  21685. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  21686. scope.billSetting = bizFile;
  21687. resolve(scope);
  21688. });
  21689. });
  21690. };
  21691. ScopeEngine.buildScopeFromPath = function (path) {
  21692. return new Promise(function (resolve, reject) {
  21693. // @ts-ignore
  21694. require([path], function (bill) {
  21695. bill = bill.default;
  21696. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  21697. resolve(scope);
  21698. }).catch(function (e) {
  21699. reject(e);
  21700. });
  21701. });
  21702. });
  21703. };
  21704. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  21705. var controller = {};
  21706. var vjson = {
  21707. layout: 'fit',
  21708. title: bizFile.bill.name,
  21709. items: []
  21710. };
  21711. var model = {};
  21712. if (bizFile.layout.layout === "fit") {
  21713. vjson.items = bizFile.layout.items;
  21714. }
  21715. else if (bizFile.layout.layout === "border") {
  21716. vjson.items = [bizFile.layout];
  21717. }
  21718. var domainsVjson = {};
  21719. _$2.forOwn(bizFile.domains, function (v, k) {
  21720. var domainVjson = null;
  21721. var buttons = bizFile.domains[k].buttons;
  21722. if (bizFile.bill.domains[k].mode === "form") {
  21723. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  21724. if (Array.isArray(buttons) && buttons.length > 0) {
  21725. if (bizFile.bill.domains[k].type === "header") {
  21726. vjson.tbar = {
  21727. xtype: 'toolbar',
  21728. items: ScopeEngine.buildButton(controller, buttons)
  21729. };
  21730. }
  21731. else {
  21732. domainVjson.items.push({
  21733. xtype: "cols",
  21734. items: ScopeEngine.buildButton(controller, buttons)
  21735. });
  21736. }
  21737. }
  21738. }
  21739. else if (bizFile.bill.domains[k].mode === "table") {
  21740. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  21741. if (Array.isArray(buttons) && buttons.length > 0) {
  21742. if (bizFile.bill.domains[k].type === "header") {
  21743. vjson.tbar = {
  21744. xtype: 'toolbar',
  21745. items: ScopeEngine.buildButton(controller, buttons)
  21746. };
  21747. }
  21748. else {
  21749. domainVjson.tbar = {
  21750. xtype: 'toolbar',
  21751. items: ScopeEngine.buildButton(controller, buttons)
  21752. };
  21753. }
  21754. }
  21755. }
  21756. if (domainVjson) {
  21757. domainsVjson[k] = domainVjson;
  21758. }
  21759. });
  21760. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  21761. var scope = new Scope({ model: model, vjson: vjson });
  21762. scope['bill_define'] = bizFile;
  21763. _$2.merge(scope, controller);
  21764. console.log('bill_define', vjson, scope, scope['bill_define']);
  21765. return scope;
  21766. };
  21767. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  21768. var fieldGroups = {};
  21769. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21770. var field = bizFile.domains[domainKey].fields[i];
  21771. var item = { sort: field.form_sort };
  21772. item.xtype = field.xtype;
  21773. item.fieldLabel = field.column_desc;
  21774. item.bind = {
  21775. value: "{" + domainKey + "." + field.column_name + "}",
  21776. };
  21777. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  21778. // if (field.disabled !== "true" && field.disabled !== "false") {
  21779. // item.bind.disabled = eval(field.disabled)
  21780. // } else {
  21781. // item.disabled = (field.disabled === "true")
  21782. // }
  21783. // if (field.readonly !== "true" && field.readonly !== "false") {
  21784. // item.bind.disabled = eval(field.readonly)
  21785. // } else {
  21786. // item.readonly = (field.readonly === "true")
  21787. // }
  21788. // if (field.required !== "true" && field.required !== "false") {
  21789. // item.bind.required = eval(field.required)
  21790. // } else {
  21791. // item.required = (field.required === "true")
  21792. // }
  21793. // if (field.hide !== "true" && field.hide !== "false") {
  21794. // item.bind.hidden = eval(field.hide)
  21795. // } else {
  21796. // item.hidden = (field.hide === "true")
  21797. // }
  21798. // item.flex = field.
  21799. if (field.dict) {
  21800. item.fix = eval(field.dict);
  21801. }
  21802. // _.set(formModel, "", "")
  21803. item.field = field;
  21804. if (field.form_group) {
  21805. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  21806. fieldGroups[field.form_group] = [item];
  21807. }
  21808. else {
  21809. fieldGroups[field.form_group].push(item);
  21810. }
  21811. }
  21812. }
  21813. var formVjson = {
  21814. xtype: "form",
  21815. title: bizFile.domains[domainKey].name,
  21816. items: []
  21817. };
  21818. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  21819. var items = ScopeEngine.buildFieldSet(fieldGroup);
  21820. if (items) {
  21821. var fieldsetVjson = {
  21822. xtype: "fieldset",
  21823. title: k,
  21824. items: items
  21825. };
  21826. formVjson.items.push(fieldsetVjson);
  21827. }
  21828. });
  21829. return formVjson;
  21830. };
  21831. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  21832. // const vjson = { xtype: "grid", items: []}
  21833. var gridVjson = {
  21834. xtype: "yvgrid",
  21835. columns: [],
  21836. split: true,
  21837. reference: domainKey,
  21838. listeners: {
  21839. itemdblclick: function () {
  21840. },
  21841. },
  21842. };
  21843. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21844. var field = bizFile.domains[domainKey].fields[i];
  21845. gridVjson.columns.push({
  21846. dataIndex: field.column_name,
  21847. header: field.column_desc,
  21848. });
  21849. }
  21850. return gridVjson;
  21851. };
  21852. ScopeEngine.buildFieldSet = function (fieldGroup) {
  21853. var colGroups = [{
  21854. xtype: "cols",
  21855. items: []
  21856. }];
  21857. var colGroup = colGroups[0];
  21858. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  21859. for (var i = 0; i < fieldGroup.length; i++) {
  21860. var field = fieldGroup[i];
  21861. if (field.field.form_newline === "true") {
  21862. if (colGroup.items.length > 0) {
  21863. colGroup = {
  21864. xtype: "cols",
  21865. items: [field]
  21866. };
  21867. colGroups.push(colGroup);
  21868. }
  21869. }
  21870. else {
  21871. colGroup.items.push(field);
  21872. }
  21873. delete field.field;
  21874. }
  21875. return colGroups;
  21876. };
  21877. ScopeEngine.buildButton = function (controller, buttons) {
  21878. var buttonsVjson = [];
  21879. var _loop_1 = function (i) {
  21880. var item = buttons[i];
  21881. var button = {
  21882. xtype: "button",
  21883. text: item.btn_name,
  21884. iconCls: item.icon
  21885. };
  21886. if (item.hidden === "true" || item.hidden === "false") {
  21887. button.hidden = (item.hidden === "true");
  21888. }
  21889. if (item.listeners) {
  21890. var listeners_1 = {};
  21891. _$2.forOwn(item.listeners, function (v, k) {
  21892. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  21893. listeners_1[k] = v;
  21894. }
  21895. else {
  21896. try {
  21897. listeners_1[k] = eval(v);
  21898. }
  21899. catch (e) {
  21900. throw e;
  21901. }
  21902. }
  21903. });
  21904. button.listeners = listeners_1;
  21905. }
  21906. buttonsVjson.push(button);
  21907. };
  21908. for (var i = 0; i < buttons.length; i++) {
  21909. _loop_1(i);
  21910. }
  21911. return buttonsVjson;
  21912. };
  21913. ScopeEngine.buildListeners = function (controller, item) {
  21914. if (!item.hasOwnProperty("listeners")) {
  21915. return;
  21916. }
  21917. _$2.forOwn(item.listeners, function (v, k) {
  21918. if (v && typeof v === "string") {
  21919. if (v.indexOf(".") > -1) {
  21920. var strArr = v.split(".");
  21921. if (strArr.length != 2) {
  21922. console.error(item.listeners, "语法解析错误,请检查!");
  21923. }
  21924. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  21925. switch (funcDomain) {
  21926. case exports.FuncDomain.SCOPE:
  21927. controller[k] = findCustFunc(item, k);
  21928. break;
  21929. case exports.FuncDomain.SYSTEM:
  21930. break;
  21931. default:
  21932. throw new Error("错误的函数域定义");
  21933. }
  21934. }
  21935. else {
  21936. var func = eval(v);
  21937. if (typeof func === 'function') {
  21938. controller[k] = func;
  21939. }
  21940. throw new Error("解析自定义函数出错");
  21941. }
  21942. }
  21943. });
  21944. var findCustFunc = function (item, funcName) {
  21945. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  21946. throw new Error("没有找到相关的函数定义");
  21947. }
  21948. var func = eval(item[funcName]);
  21949. if (typeof func === 'function') {
  21950. return func;
  21951. }
  21952. throw new Error("解析自定义函数出错");
  21953. };
  21954. };
  21955. /**
  21956. * 只检索 items 的模式,深度遍历 vjson
  21957. */
  21958. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  21959. if (Array.isArray(vjson)) {
  21960. for (var i = 0; i < vjson.length; i++) {
  21961. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  21962. }
  21963. }
  21964. else {
  21965. _$2.forOwn(vjson, function (v, k) {
  21966. if (k !== "domain") {
  21967. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  21968. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  21969. }
  21970. }
  21971. else {
  21972. delete vjson.domain;
  21973. _$2.merge(vjson, domainsVjson[v]);
  21974. }
  21975. });
  21976. }
  21977. };
  21978. return ScopeEngine;
  21979. }());
  21980. //# sourceMappingURL=ScopeEngine.js.map
  21981. function initComponent () {
  21982. var ct = Ext.Component.prototype.constructor;
  21983. Ext.Component.override({
  21984. constructor: function (config) {
  21985. var _a;
  21986. if (!isDesignMode(this, config)) {
  21987. var me_1 = this;
  21988. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  21989. _$2.each(baseConfigProcessList, function (process) {
  21990. process.call(me_1, me_1, config);
  21991. });
  21992. }
  21993. if (config) {
  21994. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  21995. config.i18nPath = config.$initParent.i18nPath;
  21996. }
  21997. var WMSTranslate = window["WMSTranslate"];
  21998. if (WMSTranslate) {
  21999. if (typeof window['viewTranslate'] === 'function') {
  22000. window['viewTranslate'](config, config.text, "text");
  22001. window['viewTranslate'](config, config.title, "title");
  22002. window['viewTranslate'](config, config.header, "header");
  22003. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  22004. }
  22005. }
  22006. }
  22007. ct.call(this, config);
  22008. }
  22009. });
  22010. var _initComponent = Ext.picker.Date.prototype.initComponent;
  22011. Ext.picker.Date.override({
  22012. initComponent: function () {
  22013. var me = this;
  22014. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  22015. _initComponent.call(me);
  22016. },
  22017. selectToday: function () {
  22018. var me = this, btn = me.todayBtn, handler = me.handler;
  22019. if (btn && !btn.disabled) {
  22020. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  22021. me.fireEvent('select', me, me.value);
  22022. if (handler) {
  22023. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  22024. }
  22025. me.onSelect();
  22026. }
  22027. return me;
  22028. },
  22029. });
  22030. }
  22031. //# sourceMappingURL=component.js.map
  22032. function initMainTab () {
  22033. Ext.define('Yvan.MainTab', {
  22034. extend: 'Ext.tab.Panel',
  22035. xtype: 'maintab',
  22036. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  22037. closeTabText: '关闭',
  22038. closeOthersTabsText: '关闭其他',
  22039. closeAllTabsText: '关闭所有'
  22040. }),
  22041. constructor: function (config) {
  22042. var me = this;
  22043. var newConfig = _$2.defaultsDeep({
  22044. // 强制属性
  22045. }, config);
  22046. this.superclass.constructor.call(me, newConfig);
  22047. },
  22048. initComponent: function () {
  22049. var me = this;
  22050. this.on({
  22051. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  22052. _$2.defer(function () {
  22053. me.changeHash(newCard.id);
  22054. window['cp'] = newCard.yvanScope;
  22055. });
  22056. $$2(window).trigger('tabChange', {
  22057. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  22058. });
  22059. },
  22060. afterrender: function () {
  22061. _$2.defer(function () {
  22062. me.tryRestoryPage();
  22063. });
  22064. }
  22065. });
  22066. this.superclass.initComponent.call(me);
  22067. },
  22068. tryRestoryPage: function () {
  22069. var me = this;
  22070. var hash = '' + window.location.hash;
  22071. if (hash && hash.indexOf('page=') > 0) {
  22072. if (hash.startsWith('#')) {
  22073. hash = hash.substr(1);
  22074. }
  22075. if (hash) {
  22076. var page = Qs.parse(hash).page;
  22077. if (page) {
  22078. // this.openScope(page)
  22079. me.fireEvent('restorypage', page);
  22080. }
  22081. }
  22082. }
  22083. },
  22084. changeHash: function (id) {
  22085. window.location.hash = Qs.stringify({ page: id });
  22086. },
  22087. /**
  22088. * 添加一个业务模块实例到选项卡
  22089. * @param scopeInstance 业务对象实例
  22090. * @param config ExtJS配置对象
  22091. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  22092. */
  22093. addScope: function (scopeInstance, config, panelInitCallback) {
  22094. scopeInstance.topScope = scopeInstance;
  22095. var me = this;
  22096. if (config.path) {
  22097. for (var i = 0; i < this.items.items.length; i++) {
  22098. // 找到当前 tabs 里有没有已经打开过
  22099. var tab = this.items.items[i];
  22100. if (_$2.isEqual(tab.path, config.path)) {
  22101. // 激活
  22102. this.setActiveTab(tab);
  22103. return tab;
  22104. }
  22105. }
  22106. }
  22107. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  22108. if (typeof panelInitCallback === 'function') {
  22109. panelInitCallback(newPanel);
  22110. }
  22111. // 添加业务模块
  22112. var newTab = this.add(newPanel);
  22113. this.setActiveTab(newTab);
  22114. newTab.on({
  22115. destroy: function (sender) {
  22116. me.changeHash('');
  22117. delete window['cp'];
  22118. }
  22119. });
  22120. return newTab;
  22121. }
  22122. });
  22123. }
  22124. //# sourceMappingURL=MainTab.js.map
  22125. /**
  22126. * 构建所有组件的公共属性
  22127. * @param config 原始config
  22128. * @param dragType 组件模式
  22129. * 不填,代表不能在设计时被拖拽
  22130. * row-container 是一个rows容器
  22131. * col-container 是一个cols容器
  22132. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  22133. * row-item rows中的一行,比如 tree / grid / panel 等等
  22134. */
  22135. function baseConfig(config, dragType) {
  22136. // if (isDesignMode(config, undefined) && dragType) {
  22137. if (typeof config === 'object') {
  22138. var cc = '';
  22139. switch (dragType) {
  22140. case "cols-container":
  22141. cc = 'design_cols_container';
  22142. break;
  22143. case "col-item":
  22144. cc = 'design_col_item';
  22145. break;
  22146. case "rows-container":
  22147. cc = 'design_rows_container';
  22148. break;
  22149. case "row-item":
  22150. cc = 'design_row_item';
  22151. break;
  22152. }
  22153. if (typeof config.cls === 'string') {
  22154. _$2.extend(config, {
  22155. cls: [config.cls, 'yvan_design', cc]
  22156. });
  22157. }
  22158. else if (_$2.isArray(config.cls)) {
  22159. _$2.extend(config, {
  22160. cls: __spread(config.cls, ['yvan_design', cc])
  22161. });
  22162. }
  22163. else {
  22164. _$2.extend(config, {
  22165. cls: ['yvan_design', cc]
  22166. });
  22167. }
  22168. }
  22169. return config;
  22170. }
  22171. //# sourceMappingURL=base.js.map
  22172. function initPanel () {
  22173. /**
  22174. *
  22175. */
  22176. var ct = Ext.panel.Panel.prototype.constructor;
  22177. Ext.panel.Panel.override({
  22178. constructor: function (config) {
  22179. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  22180. ct.call(this, newConfig);
  22181. }
  22182. });
  22183. var ss = Ext.form.FieldContainer.prototype;
  22184. Ext.form.FieldContainer.override({
  22185. config: __assign({}, fieldContainer)
  22186. });
  22187. }
  22188. //# sourceMappingURL=panel.js.map
  22189. function initGridColumn () {
  22190. var ct = Ext.grid.column.Column.prototype.constructor;
  22191. Ext.grid.column.Column.override({
  22192. constructor: function (config) {
  22193. var scope = lookupScope(config.$initParent.$initParent);
  22194. var newConfig = _$2.defaults({}, config, column);
  22195. if (typeof newConfig.summaryRenderer === 'string') {
  22196. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  22197. if (typeof newConfig.summaryRenderer === 'function') {
  22198. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  22199. }
  22200. }
  22201. if (config.formatter === 'datetime') {
  22202. newConfig.fix = ['system.formatDate()'];
  22203. delete newConfig.formatter;
  22204. }
  22205. // 在 grid.constructor 已经转换过了
  22206. // if (typeof newConfig.renderer === 'string') {
  22207. // newConfig.renderer = lookupFn(scope, config.renderer)
  22208. // if (typeof newConfig.renderer === 'function') {
  22209. // newConfig.renderer = newConfig.renderer.bind(scope)
  22210. // }
  22211. // }
  22212. ct.call(this, newConfig);
  22213. }
  22214. });
  22215. var ctAction = Ext.grid.column.Action.prototype.constructor;
  22216. Ext.grid.column.Action.override({
  22217. constructor: function (config) {
  22218. var scope = lookupScope(config.$initParent.$initParent);
  22219. _$2.forEach(config.items, function (item) {
  22220. if (typeof item.handler === 'string') {
  22221. item.handler = lookupFn(scope, item.handler);
  22222. if (typeof item.handler === 'function') {
  22223. item.handler = item.handler.bind(scope);
  22224. }
  22225. }
  22226. });
  22227. ctAction.call(this, config);
  22228. }
  22229. });
  22230. var ck = Ext.grid.column.Check.prototype.constructor;
  22231. Ext.grid.column.Check.override({
  22232. constructor: function (config) {
  22233. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  22234. var grid = sender.view.grid.ownerGrid;
  22235. var column = grid.getColumns()[sender.fullColumnIndex];
  22236. var context = {
  22237. event: e,
  22238. column: column,
  22239. field: sender.dataIndex,
  22240. value: checked,
  22241. record: record,
  22242. rowIdx: rowIndex
  22243. };
  22244. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  22245. });
  22246. ck.call(this, config);
  22247. }
  22248. });
  22249. // 227573
  22250. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  22251. // Ext.define('Yvan.ColumnOverride', {
  22252. // override: 'Ext.grid.column.Column',
  22253. //
  22254. // config: {
  22255. // enableSortOnClick: false,
  22256. // },
  22257. //
  22258. // // /**@Overrides*/
  22259. // onTitleElClick: function (e, t, sortOnClick) {
  22260. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  22261. // if (!$(e.target).is('.x-column-header-trigger')) {
  22262. // // 不是点击菜单的情况下,让列自适应宽度
  22263. // this.autoSize()
  22264. // }
  22265. // return onTitleElClick.call(this, e, t, false)
  22266. // }
  22267. // });
  22268. }
  22269. //# sourceMappingURL=gridcolumn.js.map
  22270. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  22271. /**
  22272. * 判断目标字符串与关键字是否重叠
  22273. * @param target 目标字符串
  22274. * @param keyword 搜索关键字
  22275. */
  22276. function pinyinMatch(target, keyword) {
  22277. if (typeof target != 'string' || typeof keyword != 'string') {
  22278. return false;
  22279. }
  22280. if (!keyword || !target) {
  22281. return false;
  22282. }
  22283. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  22284. keyword = _$2.toLower(keyword);
  22285. var pos1 = _$2.toLower(target).indexOf(keyword);
  22286. if (pos1 >= 0) {
  22287. return true;
  22288. }
  22289. var len = _$2.intersection(keyword.split('')).length;
  22290. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  22291. return true;
  22292. }
  22293. return false;
  22294. }
  22295. /**
  22296. * 对某个表达式进行求值
  22297. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  22298. *
  22299. * @example
  22300. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  22301. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  22302. *
  22303. * @param data 数据环境对象
  22304. * @param express 表达式对象
  22305. */
  22306. function calcExpress(data, express) {
  22307. var result = express;
  22308. if (SIMPLE_RE.test(express)) {
  22309. // '{foo}' 简单表达式
  22310. var path = express.substring(1, express.length - 1);
  22311. var ret = _$2.get(data, path);
  22312. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  22313. }
  22314. while (true) {
  22315. var mlist = result.match(/{(.*?)}/);
  22316. if (!mlist) {
  22317. break;
  22318. }
  22319. var pathC = mlist[0]; // {query.a}
  22320. var path = mlist[1]; // query.a
  22321. var value = _$2.get(data, path);
  22322. result = result.replaceAll(pathC, value || '');
  22323. }
  22324. return result;
  22325. }
  22326. /**
  22327. * 对个对象进行表达式求值,不用回调
  22328. * @example
  22329. * 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}'] })
  22330. *
  22331. * {
  22332. * a: '{query.a}',
  22333. * b: {
  22334. * b1: '{query.b1}',
  22335. * b2: '{query.b2}',
  22336. * },
  22337. * c: 'aa',
  22338. * d: [
  22339. * '{query.d1}',
  22340. * '{query.d2}'
  22341. * ]
  22342. * }
  22343. *
  22344. * 计算结果为
  22345. * {
  22346. * a: 'aValue',
  22347. * b: {
  22348. * b1: 'b1Value',
  22349. * b2: 'b2Value'
  22350. * },
  22351. * c: 'aa'
  22352. * d: [
  22353. * '1',
  22354. * '2'
  22355. * ]
  22356. * }
  22357. *
  22358. * @param data
  22359. * @param paramObject
  22360. */
  22361. function calcObjectFlat(data, paramObject) {
  22362. var result = _$2.cloneDeep(paramObject);
  22363. if (typeof paramObject === 'string') {
  22364. return calcExpress(data, paramObject);
  22365. }
  22366. var trav = function (param) {
  22367. _$2.forOwn(param, function (value, key) {
  22368. if (_$2.isPlainObject(value)) {
  22369. // 深度递归,对子对象进行求解
  22370. trav(value);
  22371. }
  22372. else if (_$2.isString(value)) {
  22373. // 字符串直接用 calcExpress 表达式求解
  22374. param[key] = calcExpress(data, param[key]);
  22375. }
  22376. else if (_$2.isArray(value)) {
  22377. // 数组求解
  22378. _$2.each(value, function (v, idx) {
  22379. value[idx] = calcExpress(data, v);
  22380. });
  22381. }
  22382. });
  22383. };
  22384. trav(result);
  22385. return result;
  22386. }
  22387. /**
  22388. * 合併 data 到當前的 ViewModel 對象
  22389. */
  22390. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  22391. var newRow = {};
  22392. if (isFlat == false) {
  22393. newRow = data;
  22394. }
  22395. else {
  22396. flatObject(newRow, '', data);
  22397. }
  22398. if (!propertyName) {
  22399. _$2.forOwn(newRow, function (value, key) {
  22400. viewModel.set(key, value);
  22401. });
  22402. }
  22403. else {
  22404. _$2.forOwn(newRow, function (value, key) {
  22405. viewModel.set(propertyName + "." + key, value);
  22406. });
  22407. }
  22408. }
  22409. /**
  22410. * 转换内联结构的行,到平面结构
  22411. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  22412. *
  22413. * @param array
  22414. * @param flatOption
  22415. * @return {[]}
  22416. */
  22417. function flatRow(array) {
  22418. var ret = [];
  22419. _$2.forEach(array, function (row) {
  22420. var newRow = {};
  22421. flatObject(newRow, '', row);
  22422. ret.push(newRow);
  22423. });
  22424. return ret;
  22425. }
  22426. function flatObject(parentObj, parentProp, obj) {
  22427. _$2.forOwn(obj, function (value, key) {
  22428. var fullKey = parentProp ? parentProp + '_' + key : key;
  22429. if (_$2.isArray(value)) {
  22430. parentObj[fullKey] = _$2.map(value, function (row) {
  22431. var newRow = {};
  22432. flatObject(newRow, '', row);
  22433. return newRow;
  22434. });
  22435. }
  22436. else {
  22437. if (typeof value === 'object') {
  22438. flatObject(parentObj, fullKey, value);
  22439. }
  22440. else {
  22441. parentObj[fullKey] = value;
  22442. }
  22443. }
  22444. });
  22445. }
  22446. /**
  22447. * 替换内部结构中,所有 N/A
  22448. */
  22449. function replaceNA(obj) {
  22450. if (obj === 'N/A') {
  22451. return '';
  22452. }
  22453. if (_$2.isArray(obj)) {
  22454. _$2.forEach(obj, function (value, idx) {
  22455. if (value === 'N/A') {
  22456. obj[idx] = '';
  22457. }
  22458. else {
  22459. replaceNA(value);
  22460. }
  22461. });
  22462. }
  22463. else if (_$2.isPlainObject(obj)) {
  22464. _$2.forOwn(obj, function (value, key) {
  22465. if (value === 'N/A') {
  22466. obj[key] = '';
  22467. }
  22468. else {
  22469. replaceNA(value);
  22470. }
  22471. });
  22472. }
  22473. }
  22474. function deepTravJson(obj, resolver) {
  22475. if (_$2.isArray(obj)) {
  22476. _$2.forEach(obj, function (value, idx) {
  22477. if (typeof value === 'string') {
  22478. resolver(obj, value, idx);
  22479. }
  22480. else {
  22481. deepTravJson(value, resolver);
  22482. }
  22483. });
  22484. }
  22485. else if (_$2.isPlainObject(obj)) {
  22486. _$2.forOwn(obj, function (value, key) {
  22487. if (typeof value === 'string') {
  22488. resolver(obj, value, key);
  22489. }
  22490. else {
  22491. deepTravJson(value, resolver);
  22492. }
  22493. });
  22494. }
  22495. }
  22496. /**
  22497. * 根据表达式进入写值
  22498. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  22499. * express="test-{query.a}" 写值就会失败
  22500. *
  22501. * @example
  22502. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  22503. * 写值成功
  22504. *
  22505. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  22506. * 写值失败
  22507. *
  22508. * @param viewModel VM对象
  22509. * @param express 表达式对象
  22510. * @param value 目标值
  22511. */
  22512. function tryWriteByExpress(viewModel, express, value) {
  22513. if (SIMPLE_RE.test(express)) {
  22514. // '{foo}' 简单表达式
  22515. express = express.substring(1, express.length - 1);
  22516. viewModel.set(express, value);
  22517. }
  22518. }
  22519. /**
  22520. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  22521. * @example
  22522. * 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]})
  22523. *
  22524. * expressObject:
  22525. * {
  22526. * a: '{query.a}',
  22527. * b: {
  22528. * b1: '{query.b1}',
  22529. * b2: '{query.b2}',
  22530. * },
  22531. * c: 'aa',
  22532. * d: [
  22533. * '{query.a}',
  22534. * '{query.b2}'
  22535. * ]
  22536. * }
  22537. *
  22538. * valueObject:
  22539. * {
  22540. * a: 'aValue',
  22541. * b: {
  22542. * b1: 'b1Value',
  22543. * b2: 'b2Value'
  22544. * },
  22545. * c: 'aa'
  22546. * c: [
  22547. * 'aValue',
  22548. * 'b2Value'
  22549. * ]
  22550. * }
  22551. *
  22552. * 系统会尝试回写
  22553. * viewModel.set('query.a', 'aValue')
  22554. * viewModel.set('query.b1', 'b1Value')
  22555. * viewModel.set('query.b2', 'b2Value')
  22556. *
  22557. * @param expressObject 含表达式的对象
  22558. * @param valueObject 表达式计算完成之后的结果对象
  22559. * @param writeFn 写入的方法 (path, value)=>void
  22560. */
  22561. function tryWriteObject(expressObject, valueObject, writeFn) {
  22562. var trav = function (pathPrefix) {
  22563. var parent = expressObject;
  22564. if (_$2.size(pathPrefix) > 1) {
  22565. parent = _$2.get(parent, pathPrefix.substring(1));
  22566. }
  22567. _$2.forOwn(parent, function (value, key) {
  22568. if (_$2.isPlainObject(value)) {
  22569. // 深度递归,对子对象进行求解
  22570. trav(pathPrefix + "." + key);
  22571. }
  22572. else if (_$2.isString(value)) {
  22573. // 字符串直接用 calcExpress 表达式求解
  22574. if (SIMPLE_RE.test(value)) {
  22575. // If we have '{foo}' alone it is a literal 简单表达式
  22576. var targetPath = value.substring(1, value.length - 1);
  22577. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  22578. if (!writeFn) {
  22579. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22580. }
  22581. else {
  22582. writeFn(targetPath, targetValue);
  22583. }
  22584. }
  22585. }
  22586. else if (_$2.isArray(value)) {
  22587. _$2.each(value, function (v, idx) {
  22588. if (SIMPLE_RE.test(v)) {
  22589. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  22590. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  22591. if (!writeFn) {
  22592. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22593. }
  22594. else {
  22595. writeFn(targetPath, targetValue);
  22596. }
  22597. }
  22598. });
  22599. }
  22600. });
  22601. };
  22602. trav("");
  22603. }
  22604. /**
  22605. * 尝试去掉变量两边括号
  22606. * {a} => a
  22607. * a => a
  22608. */
  22609. function tryVarSimple(value) {
  22610. if (SIMPLE_RE.test(value)) {
  22611. // If we have '{foo}' alone it is a literal 简单表达式
  22612. return value.substring(1, value.length - 1);
  22613. }
  22614. return value;
  22615. }
  22616. /**
  22617. * 对多个表达式进行求值. 异步回调的方式返回
  22618. * {
  22619. * a: 1,
  22620. * b: '{someBind}',
  22621. * c: ['a', 'b', 'c'],
  22622. * d: ['a', 'b', '{someBind}'],
  22623. * e: {
  22624. * y: 1,
  22625. * z: 2
  22626. * },
  22627. * f: {
  22628. * y: 1,
  22629. * z: '{someBind}'
  22630. * }
  22631. * }
  22632. *
  22633. * // Will produce
  22634. * {
  22635. * b: value,
  22636. * d: ['a', 'b', value],
  22637. * f: {
  22638. * y: 1,
  22639. * z: value
  22640. * }
  22641. * }
  22642. * @param viewModel scope.viewModel对象
  22643. * @param paramObject 求值对象
  22644. */
  22645. function calcObject(viewModel, paramObject) {
  22646. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  22647. return new Promise(function (resolve) {
  22648. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  22649. schedule.destroy();
  22650. // 从 Ext.data.Model 对象转换为 js-object 对象
  22651. ret = toPlainObject(ret);
  22652. resolve(ret);
  22653. }, viewModel, { single: true });
  22654. });
  22655. }
  22656. /**
  22657. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  22658. * @param config 组件构造函数传入的 config 配置文件
  22659. */
  22660. function getParentGrid(config) {
  22661. var _a;
  22662. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  22663. }
  22664. /**
  22665. * 解析
  22666. * {
  22667. * condition: "{skuId}",
  22668. * errorMsg: "无法编辑",
  22669. * notice: 'msg'
  22670. * }
  22671. */
  22672. function tryEnable(data, enableSetting) {
  22673. if (!enableSetting) {
  22674. // 没有这一段配置,可以编辑
  22675. return true;
  22676. }
  22677. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  22678. if (!evalFunction(data, condition)) {
  22679. // 没有达成 condition 条件
  22680. // 计算 msg 消息内容
  22681. var msgContent = calcExpress(data, errorMsg);
  22682. if (msgContent) {
  22683. if (!notice || notice === 'msg') {
  22684. // 进行提示
  22685. msg$1(msgContent);
  22686. }
  22687. }
  22688. return false;
  22689. }
  22690. return true;
  22691. }
  22692. /**
  22693. * 动态的为 combo 或 columns.combo 设置下拉框的值
  22694. * @param sender 目标对象
  22695. * @param config 目标对象的配置(在构造函数之前也可以)
  22696. * @param getDictFn 获取字典的方法
  22697. * @param bizKey 传入字典的参数
  22698. * @param multiValueSeparator 多个字典值的分割符号
  22699. */
  22700. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  22701. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  22702. // sender 和 config为空的时候获取值、
  22703. if (_$2.isArray(getDictFn)) {
  22704. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  22705. var realArray_1 = getDictFn;
  22706. getDictFn = function () {
  22707. return realArray_1;
  22708. };
  22709. }
  22710. if (!sender) {
  22711. return new Promise(function (resolve, reject) {
  22712. getDictFn(bizKey, function (r) {
  22713. resolve({ config: config, r: r });
  22714. });
  22715. });
  22716. }
  22717. if (sender.xtype === 'combotree') {
  22718. getDictFn(bizKey, function (r) {
  22719. if (sender.store) {
  22720. // 异步回传
  22721. sender.setStore(new Ext.data.TreeStore({ root: r }));
  22722. }
  22723. else {
  22724. // 同步回传
  22725. config.store = new Ext.data.TreeStore({ root: r });
  22726. }
  22727. });
  22728. return;
  22729. }
  22730. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  22731. getDictFn(bizKey, function (r) {
  22732. var _a, _b;
  22733. if (sender.store) {
  22734. // 异步回传
  22735. sender.setStore(new Ext.data.Store(r));
  22736. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  22737. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  22738. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  22739. if (typeof realValue !== 'undefined') {
  22740. sender.setValue(realValue);
  22741. }
  22742. }
  22743. else {
  22744. // 同步回传
  22745. config.store = new Ext.data.Store(r);
  22746. }
  22747. });
  22748. return;
  22749. }
  22750. else if (sender.xtype === 'gridcolumn') {
  22751. var grid = getParentGrid(config);
  22752. var editor_1 = config.editor, renderer = config.renderer;
  22753. getDictFn(bizKey, function (r) {
  22754. if (sender.store) {
  22755. // 已经渲染出来了, 用方法进行修改
  22756. var editor_2 = sender.getEditor();
  22757. if (editor_2 && editor_2.xtype === 'combo') {
  22758. var valueField_1 = r.field[0];
  22759. var displayField_1 = r.field[1];
  22760. editor_2.valueField = valueField_1;
  22761. editor_2.setDisplayField(displayField_1);
  22762. editor_2.setStore(new Ext.data.Store(r));
  22763. }
  22764. sender.setFilter({
  22765. type: 'list',
  22766. options: _$2.map(r.data, function (r) { return ({
  22767. id: '' + r.id,
  22768. text: r.text,
  22769. }); })
  22770. });
  22771. }
  22772. else {
  22773. // 没有渲染之前,修改 config 即可
  22774. if (editor_1 && editor_1.xtype === 'combo') {
  22775. // 带编辑模式
  22776. editor_1.store = new Ext.data.Store(r);
  22777. }
  22778. config.filter = {
  22779. type: 'list',
  22780. options: _$2.map(r.data, function (r) { return ({
  22781. id: '' + r.id,
  22782. text: r.text,
  22783. }); })
  22784. };
  22785. }
  22786. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  22787. var renderer = function (value, metaData) {
  22788. if (metaData === void 0) { metaData = false; }
  22789. if (!value && value != 0) {
  22790. return '';
  22791. }
  22792. var valueField = r.field[metaData === true ? 1 : 0];
  22793. var displayField = r.field[metaData === true ? 0 : 1];
  22794. var separator = multiValueSeparator;
  22795. if (separator) {
  22796. var arr = value.split(separator);
  22797. var displayValue_1 = "";
  22798. var _loop_1 = function (i) {
  22799. var itv = arr[i];
  22800. if (i > 0) {
  22801. displayValue_1 += separator;
  22802. }
  22803. _$2.each(r.data, function (row) {
  22804. // 从 valueField 找到要显示的 displayField
  22805. if (row[valueField] == itv) {
  22806. displayValue_1 += row[displayField];
  22807. return false;
  22808. }
  22809. else {
  22810. if (i >= r.data.length - 1) {
  22811. displayValue_1 += itv;
  22812. }
  22813. }
  22814. });
  22815. };
  22816. for (var i = 0; i < arr.length; i++) {
  22817. _loop_1(i);
  22818. }
  22819. return displayValue_1;
  22820. }
  22821. _$2.each(r.data, function (row) {
  22822. // 从 valueField 找到要显示的 displayField
  22823. if (row[valueField] == value) {
  22824. value = row[displayField];
  22825. return false;
  22826. }
  22827. });
  22828. return value;
  22829. };
  22830. var dictForExcel = {};
  22831. var valueField = r.field[0];
  22832. var displayField = r.field[1];
  22833. _$2.each(r.data, function (row) {
  22834. // 从 valueField 找到要显示的 displayField
  22835. var key = row[valueField];
  22836. if (key != '' && typeof key != "undefined" && key != null) {
  22837. dictForExcel[key] = row[displayField];
  22838. }
  22839. });
  22840. if (sender.rendered) {
  22841. // 已经渲染出来了, 对列进行渲染
  22842. sender.renderer = renderer;
  22843. sender.dictForExcel = dictForExcel;
  22844. sender.getView().refresh();
  22845. }
  22846. else {
  22847. sender.renderer = renderer;
  22848. sender.dictForExcel = dictForExcel;
  22849. config.renderer = renderer;
  22850. config.dictForExcel = dictForExcel;
  22851. }
  22852. });
  22853. return;
  22854. }
  22855. throw new TypeError("无法识别的组件类型");
  22856. }
  22857. /**
  22858. * 调用服务器 Ajax
  22859. */
  22860. function invokeServer$1(url) {
  22861. var args = [];
  22862. for (var _i = 1; _i < arguments.length; _i++) {
  22863. args[_i - 1] = arguments[_i];
  22864. }
  22865. // @ts-ignore
  22866. return ajax.func({
  22867. url: url,
  22868. method: 'invoke',
  22869. args: args
  22870. });
  22871. }
  22872. function clearViewModelValues(viewModel, propertyName) {
  22873. if (!propertyName) {
  22874. var dd_1 = viewModel.getData();
  22875. _$2.forOwn(dd_1, function (value, key) {
  22876. viewModel.set(key, '');
  22877. });
  22878. return;
  22879. }
  22880. var dd = _$2.get(viewModel.getData(), propertyName);
  22881. _$2.forOwn(dd, function (value, key) {
  22882. viewModel.set(propertyName + '.' + key, '');
  22883. });
  22884. }
  22885. function reloadGrid(scope, gridRefName) {
  22886. var _a;
  22887. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  22888. }
  22889. /**
  22890. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  22891. */
  22892. function toPlainObject(obj) {
  22893. if (obj.isModel) {
  22894. obj = obj.data;
  22895. }
  22896. _$2.forOwn(obj, function (v, k) {
  22897. // Ext.data.Model.constructor
  22898. if (!v) {
  22899. return;
  22900. }
  22901. if (v.isModel) {
  22902. v = v.data;
  22903. }
  22904. if (typeof v === 'object') {
  22905. obj[k] = toPlainObject(v);
  22906. }
  22907. else {
  22908. obj[k] = v;
  22909. }
  22910. });
  22911. return obj;
  22912. }
  22913. function confirm(msg, sender) {
  22914. return new Promise(function (resolve) {
  22915. var _a, _b;
  22916. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  22917. var config = {
  22918. title: '请确认',
  22919. modal: true,
  22920. animateTarget: sender,
  22921. // resizable: false,
  22922. // constrainHeader: true,
  22923. // constrain: true,
  22924. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  22925. layout: {
  22926. type: 'hbox',
  22927. pack: 'start',
  22928. align: 'stretch'
  22929. },
  22930. items: [
  22931. {
  22932. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  22933. border: false,
  22934. },
  22935. {
  22936. flex: 1,
  22937. border: false,
  22938. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(msg) + "</div>"
  22939. }
  22940. ],
  22941. buttons: [
  22942. {
  22943. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  22944. handler: function () {
  22945. resolve();
  22946. win.close();
  22947. }
  22948. },
  22949. {
  22950. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  22951. handler: function () {
  22952. win.close();
  22953. }
  22954. }
  22955. ],
  22956. keyMapEnabled: true,
  22957. keyMap: {
  22958. ENTER: function () {
  22959. resolve();
  22960. win.close();
  22961. }
  22962. }
  22963. };
  22964. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22965. config.constrain = true;
  22966. }
  22967. var win = new Ext.Window(config);
  22968. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22969. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  22970. }
  22971. win.show();
  22972. });
  22973. }
  22974. /**
  22975. * 任何符号字符串都替换成下换线
  22976. */
  22977. function normId(value) {
  22978. return _$2.replace(value, /[^\w]/g, '_');
  22979. }
  22980. /**
  22981. *
  22982. * @param sender
  22983. * @param propertyName
  22984. * @param gridRefName
  22985. */
  22986. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  22987. var _a, _b;
  22988. var scope = lookupScope(sender);
  22989. clearViewModelValues(scope.viewModel, propertyName);
  22990. if (!gridRefName) {
  22991. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  22992. }
  22993. else {
  22994. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  22995. }
  22996. }
  22997. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  22998. if ([10, 13, 20, 40].includes(event.keyCode)) {
  22999. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  23000. var value = _$2.trim(sender.rawValue);
  23001. raiseClick(eOpts.handle);
  23002. }
  23003. }, 150);
  23004. function saveGridRow(grid1) {
  23005. var _a;
  23006. var config = grid1.config;
  23007. var scope = lookupScope(grid1);
  23008. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  23009. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  23010. // "表格保存"的相关配置
  23011. var dbSaveConfig = {
  23012. columns: [],
  23013. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  23014. saveRowValues: saveRowValues,
  23015. path: scope.originalVjson.__custom_path,
  23016. };
  23017. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  23018. if (err) {
  23019. // 如果有异常就不保存
  23020. return;
  23021. }
  23022. // 构建"表格保存"的相关配置
  23023. for (var i = 0; i < config.columns.length; i++) {
  23024. var c = config.columns[i];
  23025. var v = {
  23026. dataIndex: c.dataIndex,
  23027. header: c.header,
  23028. dbColumn: c.dbColumn,
  23029. serverCreateValue: c.serverCreateValue,
  23030. dbIsDeleteKey: c.dbIsDeleteKey,
  23031. dbIsUpdateKey: c.dbIsUpdateKey,
  23032. dbUpdateEnable: c.dbUpdateEnable,
  23033. serverValueConvert: c.dbUpdateEnable,
  23034. };
  23035. if (c.editor) {
  23036. v.editor = {
  23037. xtype: c.editor.xtype,
  23038. required: c.editor.required,
  23039. };
  23040. }
  23041. dbSaveConfig.columns.push(v);
  23042. }
  23043. // 进行业务上的逻辑校验
  23044. var hasError = false;
  23045. _$2.forEach(rows, function (row, i) {
  23046. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  23047. var c = config.columns[i_1];
  23048. var value = row[c.dataIndex];
  23049. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  23050. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  23051. hasError = true;
  23052. return false;
  23053. }
  23054. if (c.xtype === 'checkcolumn') {
  23055. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  23056. row[c.dataIndex] = c.uncheckedValue;
  23057. }
  23058. if (value === true && typeof c.checkedValue !== 'undefined') {
  23059. row[c.dataIndex] = c.checkedValue;
  23060. }
  23061. }
  23062. }
  23063. });
  23064. if (hasError) {
  23065. return;
  23066. }
  23067. // 设置当前界面为 "保存中..." 状态
  23068. grid1.setLoading(true);
  23069. invokeServer$1('/Dev@batchSave', {
  23070. newRows: newRows,
  23071. modifyRows: modifyRows,
  23072. removeRecords: removeRecords,
  23073. config: dbSaveConfig,
  23074. }).then(function (res) {
  23075. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  23076. msg$1(res.msg);
  23077. grid1.reload();
  23078. }).catch(function (e) {
  23079. console.error(e);
  23080. showErrorDialog$1(_$2.toString(e));
  23081. }).finally(function () {
  23082. // 无论正常异常,关闭 "保存中..." 状态
  23083. grid1.setLoading(false);
  23084. });
  23085. }
  23086. function insertGridRow(grid1) {
  23087. var config = grid1.config;
  23088. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  23089. var insertRow = {};
  23090. _$2.forEach(config.columns, function (c) {
  23091. var fn = c.createValue;
  23092. if (_$2.startsWith(fn, 'scope.') ||
  23093. _$2.startsWith(fn, 'system.')) {
  23094. var scope = lookupScope(grid1);
  23095. var fn2 = lookupFn(scope, fn, c);
  23096. if (_$2.isFunction(fn2)) {
  23097. var newValue = fn2();
  23098. if (!_$2.isUndefined(newValue)) {
  23099. insertRow[c.dataIndex] = newValue;
  23100. }
  23101. }
  23102. }
  23103. else if (_$2.isString(fn) && fn) {
  23104. insertRow[c.dataIndex] = fn;
  23105. }
  23106. });
  23107. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  23108. }
  23109. function commitMe(sender) {
  23110. var window = sender.up('window');
  23111. var scope = lookupScope(sender);
  23112. if (typeof scope['commit'] === 'function') {
  23113. scope['commit']().then(function (res) {
  23114. window.close();
  23115. });
  23116. }
  23117. }
  23118. function removeGridRow(grid1) {
  23119. var _a;
  23120. var config = grid1.config;
  23121. var rows = [];
  23122. if (grid1.selModel.selType === "rowmodel") {
  23123. rows.push(grid1.selection);
  23124. }
  23125. else {
  23126. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  23127. rows.push(r);
  23128. });
  23129. }
  23130. if (rows.length > 1) {
  23131. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  23132. if (_$2.isUndefined(batchRemoveConfirm)) {
  23133. //不需要提示
  23134. _$2.forEach(rows, function (r) {
  23135. grid1.getStore().remove(r);
  23136. });
  23137. }
  23138. else {
  23139. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  23140. confirm(tip).then(function () {
  23141. _$2.forEach(rows, function (r) {
  23142. grid1.getStore().remove(r);
  23143. });
  23144. });
  23145. }
  23146. }
  23147. else if (rows.length === 1) {
  23148. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  23149. if (_$2.isUndefined(singleRemoveConfirm)) {
  23150. //不需要提示
  23151. grid1.getStore().remove(rows[0]);
  23152. }
  23153. else {
  23154. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  23155. _$2.forEach(config.columns, function (c) {
  23156. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  23157. });
  23158. confirm(tip_1).then(function () {
  23159. grid1.getStore().remove(rows[0]);
  23160. });
  23161. }
  23162. }
  23163. else {
  23164. msg$1('请选择要删除的数据!');
  23165. }
  23166. }
  23167. function moveUpGridRow(grid) {
  23168. grid.rowMoveUp();
  23169. }
  23170. function moveDownGridRow(grid) {
  23171. grid.rowMoveDown();
  23172. }
  23173. var SystemEventFu = /** @class */ (function () {
  23174. function SystemEventFu() {
  23175. }
  23176. SystemEventFu.prototype.moveUpGridRow = function () {
  23177. return function (sender) {
  23178. var grid1 = sender.up('yvgrid');
  23179. moveUpGridRow(grid1);
  23180. };
  23181. };
  23182. SystemEventFu.prototype.commitMe = function () {
  23183. return function (sender) {
  23184. commitMe(sender);
  23185. };
  23186. };
  23187. SystemEventFu.prototype.moveDownGridRow = function () {
  23188. return function (sender) {
  23189. var grid1 = sender.up('yvgrid');
  23190. moveDownGridRow(grid1);
  23191. };
  23192. };
  23193. SystemEventFu.prototype.saveGridRow = function () {
  23194. return function (sender) {
  23195. var grid1 = sender.up('yvgrid');
  23196. saveGridRow(grid1);
  23197. };
  23198. };
  23199. SystemEventFu.prototype.insertGridRow = function () {
  23200. return function (sender) {
  23201. var grid1 = sender.up('yvgrid');
  23202. insertGridRow(grid1);
  23203. };
  23204. };
  23205. SystemEventFu.prototype.removeGridRow = function () {
  23206. return function (sender) {
  23207. var grid1 = sender.up('yvgrid');
  23208. removeGridRow(grid1);
  23209. };
  23210. };
  23211. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  23212. return function (sender, config) {
  23213. if (!config.listeners) {
  23214. config.listeners = {};
  23215. }
  23216. config.listeners.afterrender = function (sender) {
  23217. var scope = lookupScope(sender);
  23218. // $(sender.el.dom).on('keydown', (e) => {
  23219. // const xtype = Ext.fly(e.target).component.xtype
  23220. // if (xtype === 'textfield' && e.keyCode === 13) {
  23221. // Ext.defer(() => {
  23222. // raiseClick(scope.refs[btnReferenceName])
  23223. // })
  23224. // e.preventDefault()
  23225. // e.stopPropagation()
  23226. // return false
  23227. // }
  23228. // })
  23229. $(sender.el.dom).on('keyup', function (e) {
  23230. var tt = Ext.fly(e.target).component;
  23231. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  23232. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  23233. ![10, 13, 20, 40].includes(e.keyCode)) {
  23234. return;
  23235. }
  23236. e.preventDefault();
  23237. e.stopPropagation();
  23238. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  23239. return;
  23240. });
  23241. };
  23242. };
  23243. };
  23244. SystemEventFu.prototype.confirm = function (text, fn) {
  23245. return function (sender) {
  23246. var scope = lookupScope(sender);
  23247. var msg = calcExpress(scope.viewModel.data, text);
  23248. confirm(msg, sender).then(function () {
  23249. fn.call(scope, sender);
  23250. });
  23251. };
  23252. };
  23253. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  23254. return function (sender) {
  23255. var scope = lookupScope(sender);
  23256. var grid = scope.refs[gridRefName];
  23257. if (grid) {
  23258. var records = grid.getSelectionModel().getLastSelected();
  23259. grid.store.remove(records);
  23260. }
  23261. };
  23262. };
  23263. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  23264. //可以是 scope.XX / system.XX / string / lookup表达式
  23265. writeTarget) {
  23266. return function (sender) {
  23267. if (!invokeUrl) {
  23268. return;
  23269. }
  23270. var scope = lookupScope(sender);
  23271. scope.setLoading(true);
  23272. var data = scope.viewModel.data;
  23273. if (invokeParam) {
  23274. data = calcObjectFlat(data, invokeParam);
  23275. }
  23276. invokeServer$1(invokeUrl, data).then(function (res) {
  23277. if (res.success) {
  23278. if (typeof writeTarget === "string") {
  23279. _$2.forOwn(res.data, function (v, k) {
  23280. scope.viewModel.set(writeTarget + "." + k, v);
  23281. });
  23282. }
  23283. else if (typeof writeTarget === 'function') {
  23284. writeTarget.call(scope, res.data);
  23285. }
  23286. else if (typeof writeTarget === 'object') {
  23287. var ret = calcObjectFlat(res.data, writeTarget);
  23288. _$2.forOwn(ret, function (v, k) {
  23289. scope.viewModel.set(k, v);
  23290. });
  23291. }
  23292. }
  23293. else {
  23294. showErrorDialog$1(res.msg || '未知错误', sender);
  23295. }
  23296. }).catch(function (e) {
  23297. var _a, _b;
  23298. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23299. showErrorDialog$1(msg || e.toString(), sender);
  23300. }).finally(function () {
  23301. scope.setLoading(false);
  23302. });
  23303. };
  23304. };
  23305. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  23306. return function (sender) {
  23307. var scope = lookupScope(sender);
  23308. scope.setLoading(true);
  23309. var data = scope.viewModel.data;
  23310. if (arg0) {
  23311. data = calcObjectFlat(data, arg0);
  23312. }
  23313. invokeServer$1(groovyUrl, data).then(function (res) {
  23314. if (res.success) {
  23315. if (res.msg) {
  23316. msg(res.msg);
  23317. }
  23318. if (typeof successCallback === 'function') {
  23319. successCallback.call(scope, sender, res.data);
  23320. }
  23321. }
  23322. else {
  23323. showErrorDialog$1(res.msg || '未知错误', sender);
  23324. }
  23325. }).catch(function (e) {
  23326. var _a, _b;
  23327. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23328. showErrorDialog$1(msg || e.toString(), sender);
  23329. }).finally(function () {
  23330. scope.setLoading(false);
  23331. });
  23332. };
  23333. };
  23334. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  23335. return function (sender) {
  23336. var scope = lookupScope(sender);
  23337. var form = scope.down('form');
  23338. if (form) {
  23339. // 如果下级有表单,就做表单校验
  23340. var valid = form.isValid();
  23341. if (!valid) {
  23342. return;
  23343. }
  23344. }
  23345. scope.setLoading(true);
  23346. var data = scope.viewModel.data;
  23347. if (arg0) {
  23348. data = calcObjectFlat(data, arg0);
  23349. }
  23350. invokeServer$1(groovyUrl, data).then(function (res) {
  23351. if (res.success) {
  23352. if (res.msg) {
  23353. msg(res.msg);
  23354. }
  23355. scope.dialogSuccess(res);
  23356. }
  23357. else {
  23358. showErrorDialog$1(res.msg || '未知错误', sender);
  23359. }
  23360. }).catch(function (e) {
  23361. var _a, _b;
  23362. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23363. showErrorDialog$1(msg || e.toString(), sender);
  23364. }).finally(function () {
  23365. scope.setLoading(false);
  23366. });
  23367. };
  23368. };
  23369. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  23370. return function (sender) {
  23371. var scope = lookupScope(sender);
  23372. if (lookupObject) {
  23373. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  23374. }
  23375. else {
  23376. scope.dialogSuccess();
  23377. }
  23378. };
  23379. };
  23380. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  23381. return function (sender) {
  23382. var scope = lookupScope(sender);
  23383. clearViewModelValues(scope.viewModel, propertyName);
  23384. };
  23385. };
  23386. SystemEventFu.prototype.getGrid = function (url) {
  23387. return function (sender, config) {
  23388. if (config.xtype == "combogridmulti") {
  23389. // @ts-ignore
  23390. require([url], function (grid) {
  23391. _$2.forOwn(grid.default, function (v, k) {
  23392. sender[k] = v;
  23393. sender.config[k] = v;
  23394. if (sender.rendered) {
  23395. // 已经渲染出来了,重新调用 reload 强制刷新
  23396. sender.reload();
  23397. }
  23398. });
  23399. });
  23400. }
  23401. else {
  23402. // @ts-ignore
  23403. require([url], function (grid) {
  23404. sender.grid = grid.default;
  23405. config.grid = grid.default;
  23406. });
  23407. }
  23408. };
  23409. };
  23410. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  23411. return function (sender) {
  23412. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  23413. };
  23414. };
  23415. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  23416. return function (sender) {
  23417. var _a, _b;
  23418. var scope = lookupScope(sender);
  23419. if (!gridRefName) {
  23420. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  23421. }
  23422. else {
  23423. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  23424. }
  23425. };
  23426. };
  23427. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  23428. return function (sender) {
  23429. var scope = lookupScope(sender);
  23430. var data = scope.viewModel.data;
  23431. var param = calcObjectFlat(data, lookupForData);
  23432. // @ts-ignore
  23433. require([url], function (module) {
  23434. var ScopeClass = module.default;
  23435. var scope = new ScopeClass();
  23436. scope.success = successCallback;
  23437. scope.showDialog(sender, {}, { data: param });
  23438. });
  23439. };
  23440. };
  23441. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  23442. return function (sender, queryValue) {
  23443. showWidget(widgetUrl, lookup, sender, queryValue);
  23444. };
  23445. };
  23446. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  23447. return function (sender) {
  23448. clearViewModelByLookup(sender, lookup);
  23449. };
  23450. };
  23451. SystemEventFu.prototype.closeMe = function (callBack) {
  23452. return function (sender) {
  23453. var scope = lookupScope(sender);
  23454. scope.close();
  23455. if (callBack) {
  23456. callBack.call(sender);
  23457. }
  23458. };
  23459. };
  23460. // 未完成
  23461. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  23462. return function (sender) {
  23463. var scope = lookupScope(sender);
  23464. var data = scope.viewModel.data;
  23465. var billSetting = scope.billSetting;
  23466. var param = calcObjectFlat(data, lookupForData);
  23467. return new Promise(function (resolve, reject) {
  23468. var sf = function (scope) {
  23469. scope.success = function (dlgScope, dlgSender, reData) {
  23470. };
  23471. scope.showDialog(sender, {}, { data: param });
  23472. };
  23473. // @ts-ignore
  23474. require([url], function (module) {
  23475. // 业务描述文件
  23476. if (url.endsWith(".bill")) {
  23477. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  23478. sf(scope);
  23479. });
  23480. }
  23481. else { //原生yvanui文件
  23482. var ScopeClass = module.default;
  23483. var scope_1 = new ScopeClass();
  23484. sf(scope_1);
  23485. }
  23486. });
  23487. });
  23488. };
  23489. };
  23490. __decorate([
  23491. Lib({
  23492. title: '为某个表格,上移行',
  23493. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23494. }),
  23495. __metadata("design:type", Function),
  23496. __metadata("design:paramtypes", []),
  23497. __metadata("design:returntype", void 0)
  23498. ], SystemEventFu.prototype, "moveUpGridRow", null);
  23499. __decorate([
  23500. Lib({
  23501. title: '为某个表格,上移行',
  23502. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23503. }),
  23504. __metadata("design:type", Function),
  23505. __metadata("design:paramtypes", []),
  23506. __metadata("design:returntype", void 0)
  23507. ], SystemEventFu.prototype, "commitMe", null);
  23508. __decorate([
  23509. Lib({
  23510. title: '为某个表格,下移行',
  23511. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23512. }),
  23513. __metadata("design:type", Function),
  23514. __metadata("design:paramtypes", []),
  23515. __metadata("design:returntype", void 0)
  23516. ], SystemEventFu.prototype, "moveDownGridRow", null);
  23517. __decorate([
  23518. Lib({
  23519. title: '为某个表格,批量保存至数据库',
  23520. author: '罗一帆',
  23521. createAt: '2022-07-19',
  23522. updateAt: '2022-07-19',
  23523. type: 'system',
  23524. category: '表格',
  23525. }),
  23526. __metadata("design:type", Function),
  23527. __metadata("design:paramtypes", []),
  23528. __metadata("design:returntype", void 0)
  23529. ], SystemEventFu.prototype, "saveGridRow", null);
  23530. __decorate([
  23531. Lib({
  23532. title: '为某个表格插入数据行',
  23533. author: '罗一帆',
  23534. createAt: '2022-07-19',
  23535. updateAt: '2022-07-19',
  23536. type: 'system',
  23537. category: '表格',
  23538. }),
  23539. __metadata("design:type", Function),
  23540. __metadata("design:paramtypes", []),
  23541. __metadata("design:returntype", void 0)
  23542. ], SystemEventFu.prototype, "insertGridRow", null);
  23543. __decorate([
  23544. Lib({
  23545. title: '为某个表格删除所选数据行',
  23546. author: '罗一帆',
  23547. createAt: '2022-07-19',
  23548. updateAt: '2022-07-19',
  23549. type: 'system',
  23550. category: '表格',
  23551. }),
  23552. __metadata("design:type", Function),
  23553. __metadata("design:paramtypes", []),
  23554. __metadata("design:returntype", void 0)
  23555. ], SystemEventFu.prototype, "removeGridRow", null);
  23556. __decorate([
  23557. Lib({
  23558. title: '按下回车键之后默认是否按下某个按钮',
  23559. author: '罗一帆',
  23560. createAt: '2021-07-02',
  23561. updateAt: '2021-07-02',
  23562. type: 'system',
  23563. category: '字典',
  23564. }),
  23565. __metadata("design:type", Function),
  23566. __metadata("design:paramtypes", [Object]),
  23567. __metadata("design:returntype", void 0)
  23568. ], SystemEventFu.prototype, "enterToClick", null);
  23569. __decorate([
  23570. Lib({
  23571. title: '弹出确认对话框,回答 YES 之后调用某方法',
  23572. author: '罗一帆',
  23573. createAt: '2021-07-06',
  23574. updateAt: '2021-07-06',
  23575. type: 'system',
  23576. category: '对话框',
  23577. }),
  23578. __param(0, LibParam('对话框的确认文字', 'string')),
  23579. __param(1, LibParam('确认之后的调用的方法', 'event')),
  23580. __metadata("design:type", Function),
  23581. __metadata("design:paramtypes", [Object, Object]),
  23582. __metadata("design:returntype", void 0)
  23583. ], SystemEventFu.prototype, "confirm", null);
  23584. __decorate([
  23585. Lib({
  23586. title: '删除表格当前的选中行(前端删除)',
  23587. author: '罗一帆',
  23588. createAt: '2021-07-08',
  23589. updateAt: '2021-07-08',
  23590. type: 'system',
  23591. category: '表格',
  23592. }),
  23593. __param(0, LibParam('表格引用名', 'refs')),
  23594. __metadata("design:type", Function),
  23595. __metadata("design:paramtypes", [Object]),
  23596. __metadata("design:returntype", void 0)
  23597. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  23598. __decorate([
  23599. Lib({
  23600. title: '查询表单,如果 url 为空值,就取消查询',
  23601. author: '罗一帆',
  23602. createAt: '2021-07-06',
  23603. updateAt: '2021-07-06',
  23604. type: 'system',
  23605. category: '表单',
  23606. }),
  23607. __param(0, LibParam('后端服务路径', 'string')),
  23608. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23609. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  23610. __metadata("design:type", Function),
  23611. __metadata("design:paramtypes", [String, Object, Object]),
  23612. __metadata("design:returntype", void 0)
  23613. ], SystemEventFu.prototype, "loadForm", null);
  23614. __decorate([
  23615. Lib({
  23616. title: '提交(不做校验、不关闭窗体)',
  23617. author: '罗一帆',
  23618. createAt: '2021-07-02',
  23619. updateAt: '2021-07-02',
  23620. type: 'system',
  23621. category: '表单',
  23622. }),
  23623. __param(0, LibParam('后端服务路径', 'string')),
  23624. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23625. __param(2, LibParam('提交成功后的回调', 'event', true)),
  23626. __metadata("design:type", Function),
  23627. __metadata("design:paramtypes", [String, Object, Object]),
  23628. __metadata("design:returntype", void 0)
  23629. ], SystemEventFu.prototype, "commit", null);
  23630. __decorate([
  23631. Lib({
  23632. title: '提交表单',
  23633. author: '罗一帆',
  23634. createAt: '2021-07-02',
  23635. updateAt: '2021-07-02',
  23636. type: 'system',
  23637. category: '表单',
  23638. }),
  23639. __param(0, LibParam('后端服务路径', 'string')),
  23640. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  23641. __metadata("design:type", Function),
  23642. __metadata("design:paramtypes", [String, Object]),
  23643. __metadata("design:returntype", void 0)
  23644. ], SystemEventFu.prototype, "formCommit", null);
  23645. __decorate([
  23646. Lib({
  23647. title: '对话框成功回调',
  23648. author: '罗一帆',
  23649. createAt: '2021-07-02',
  23650. updateAt: '2021-07-02',
  23651. type: 'system',
  23652. category: '对话框',
  23653. }),
  23654. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  23655. __metadata("design:type", Function),
  23656. __metadata("design:paramtypes", [Object]),
  23657. __metadata("design:returntype", void 0)
  23658. ], SystemEventFu.prototype, "dialogSuccess", null);
  23659. __decorate([
  23660. Lib({
  23661. title: '清空 viewModel 某个属性',
  23662. author: '罗一帆',
  23663. createAt: '2021-07-02',
  23664. updateAt: '2021-07-02',
  23665. type: 'system',
  23666. category: '表单',
  23667. }),
  23668. __param(0, LibParam('属性路径', 'viewModel', true)),
  23669. __metadata("design:type", Function),
  23670. __metadata("design:paramtypes", [String]),
  23671. __metadata("design:returntype", void 0)
  23672. ], SystemEventFu.prototype, "clearViewModelValues", null);
  23673. __decorate([
  23674. Lib({
  23675. title: '从其他资源获取表格设置',
  23676. author: '罗一帆',
  23677. createAt: '2021-07-02',
  23678. updateAt: '2021-07-02',
  23679. type: 'system',
  23680. category: '表单',
  23681. }),
  23682. __param(0, LibParam('定义文件', 'module')),
  23683. __metadata("design:type", Function),
  23684. __metadata("design:paramtypes", [Object]),
  23685. __metadata("design:returntype", void 0)
  23686. ], SystemEventFu.prototype, "getGrid", null);
  23687. __decorate([
  23688. Lib({
  23689. title: '清空 viewModel 某个属性,并刷新表格',
  23690. author: '罗一帆',
  23691. createAt: '2021-07-02',
  23692. updateAt: '2021-07-02',
  23693. type: 'system',
  23694. category: '表单',
  23695. }),
  23696. __param(0, LibParam('清空的属性', 'viewModel')),
  23697. __param(1, LibParam('要刷新的表格', 'refs', true)),
  23698. __metadata("design:type", Function),
  23699. __metadata("design:paramtypes", [String, String]),
  23700. __metadata("design:returntype", void 0)
  23701. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  23702. __decorate([
  23703. Lib({
  23704. title: '刷新表格',
  23705. author: '罗一帆',
  23706. createAt: '2021-07-02',
  23707. updateAt: '2021-07-02',
  23708. type: 'system',
  23709. category: '表单',
  23710. }),
  23711. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  23712. __metadata("design:type", Function),
  23713. __metadata("design:paramtypes", [String]),
  23714. __metadata("design:returntype", void 0)
  23715. ], SystemEventFu.prototype, "reloadGrid", null);
  23716. __decorate([
  23717. Lib({
  23718. title: '显示对话框',
  23719. author: '罗一帆',
  23720. createAt: '2021-07-02',
  23721. updateAt: '2021-07-02',
  23722. type: 'system',
  23723. category: '对话框',
  23724. }),
  23725. __param(0, LibParam('业务模块名', 'module')),
  23726. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23727. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  23728. __metadata("design:type", Function),
  23729. __metadata("design:paramtypes", [String, Object, Object]),
  23730. __metadata("design:returntype", void 0)
  23731. ], SystemEventFu.prototype, "showDialog", null);
  23732. __decorate([
  23733. Lib({
  23734. title: '弹出查找框(不借助 search)',
  23735. author: '罗一帆',
  23736. createAt: '2021-07-02',
  23737. updateAt: '2021-07-02',
  23738. type: 'system',
  23739. category: '对话框',
  23740. }),
  23741. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  23742. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  23743. __metadata("design:type", Function),
  23744. __metadata("design:paramtypes", [Object, Object]),
  23745. __metadata("design:returntype", void 0)
  23746. ], SystemEventFu.prototype, "showWidget", null);
  23747. __decorate([
  23748. Lib({
  23749. title: '根据 lookup 清空 viewModel',
  23750. author: '罗一帆',
  23751. createAt: '2021-07-05',
  23752. updateAt: '2021-07-05',
  23753. type: 'system',
  23754. category: '表单',
  23755. }),
  23756. __param(0, LibParam('设值表达式', 'lookup')),
  23757. __metadata("design:type", Function),
  23758. __metadata("design:paramtypes", [Object]),
  23759. __metadata("design:returntype", void 0)
  23760. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  23761. __decorate([
  23762. Lib({
  23763. title: '关闭对话框',
  23764. author: '罗一帆',
  23765. createAt: '2021-07-05',
  23766. updateAt: '2021-07-05',
  23767. type: 'system',
  23768. category: '对话框',
  23769. }),
  23770. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  23771. __metadata("design:type", Function),
  23772. __metadata("design:paramtypes", [Object]),
  23773. __metadata("design:returntype", void 0)
  23774. ], SystemEventFu.prototype, "closeMe", null);
  23775. __decorate([
  23776. Lib({
  23777. title: '打开对话框并返回数据',
  23778. author: '余亮',
  23779. createAt: '2022-07-07',
  23780. updateAt: '2022-07-07',
  23781. type: 'system',
  23782. category: '对话框',
  23783. }),
  23784. __param(0, LibParam('业务模块名', 'module')),
  23785. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23786. __param(2, LibParam('结果映射关系', 'string', true)),
  23787. __metadata("design:type", Function),
  23788. __metadata("design:paramtypes", [String, Object, Object]),
  23789. __metadata("design:returntype", void 0)
  23790. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  23791. return SystemEventFu;
  23792. }());
  23793. /**
  23794. * 清空 viewmodel 里下属的所有属性
  23795. * @param viewModel VM对象
  23796. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  23797. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  23798. */
  23799. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  23800. var data = viewModel.data;
  23801. if (propertyKey) {
  23802. data = _$2.get(data, propertyKey);
  23803. }
  23804. _$2.forOwn(data, function (value, key) {
  23805. var targetKey = propertyKey ? propertyKey + "." + key : key;
  23806. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  23807. return;
  23808. }
  23809. viewModel.set(targetKey, '');
  23810. });
  23811. }
  23812. function clearViewModelByLookup(sender, lookup) {
  23813. if (_$2.isPlainObject(lookup)) {
  23814. var parentScope_1 = lookupScope(sender);
  23815. _$2.forOwn(lookup, function (value, key) {
  23816. if (SIMPLE_RE.test(value)) {
  23817. // '{foo}' 简单表达式
  23818. var path = value.substring(1, value.length - 1);
  23819. if (path !== 'queryValue') {
  23820. parentScope_1.viewModel.set(path, '');
  23821. }
  23822. }
  23823. });
  23824. }
  23825. }
  23826. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  23827. if (vjson === void 0) { vjson = {}; }
  23828. var parentScope = lookupScope(sender);
  23829. var me = sender;
  23830. // @ts-ignore
  23831. require([widgetUrl], function (widgetScope) {
  23832. var WidgetScopeClass = widgetScope.default;
  23833. widgetScope = new WidgetScopeClass();
  23834. // 传递进 widget.model 的数据
  23835. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  23836. widgetScope.parentScope = parentScope;
  23837. widgetScope.searchWidgetSuccess = function (data) {
  23838. if (typeof lookup === 'string') {
  23839. // lookup 是字符串的情况下,就是取某个列作为 value 值
  23840. me.setValue(data[lookup]);
  23841. return;
  23842. }
  23843. /**
  23844. * lookup: {
  23845. * // 扩展到 viewModel 的值做更改
  23846. * WH_CODE: "{queryValue}",
  23847. * WH_NAME: "{query.WH_NAME}",
  23848. * }
  23849. */
  23850. if (_$2.isPlainObject(lookup)) {
  23851. var parentScope_2 = lookupScope(sender);
  23852. tryWriteObject(lookup, data, function (path, value) {
  23853. if (path === 'queryValue') {
  23854. me.setValue(value);
  23855. }
  23856. else {
  23857. parentScope_2.viewModel.set(path, value);
  23858. }
  23859. });
  23860. }
  23861. return true;
  23862. };
  23863. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  23864. });
  23865. }
  23866. /**
  23867. * 停止事件的默认行为
  23868. * @param e
  23869. */
  23870. function stopEvent(e) {
  23871. e.preventDefault();
  23872. e.stopPropagation();
  23873. // @ts-ignore
  23874. window.event.cancelBubble = true;
  23875. e.returnValue = false;
  23876. e.cancelBubble = true;
  23877. }
  23878. /**
  23879. * 屏幕中央显示一个黑框提示
  23880. */
  23881. function msg$1(content) {
  23882. msg(content);
  23883. }
  23884. /**
  23885. * 错误对话框的强提醒
  23886. */
  23887. function showErrorDialog$1(msg, sender) {
  23888. showErrorDialog(msg, sender);
  23889. }
  23890. /**
  23891. * 错误对话框的强提醒
  23892. */
  23893. function showInfoDialog(msg, sender) {
  23894. showInfoDialogSimple(msg, sender);
  23895. }
  23896. /**
  23897. * 错误对话框的强提醒
  23898. */
  23899. function prompt$2(message, defaultValue, multiLine) {
  23900. if (defaultValue === void 0) { defaultValue = ""; }
  23901. if (multiLine === void 0) { multiLine = false; }
  23902. return prompt$1(message, defaultValue, multiLine);
  23903. }
  23904. /**
  23905. * 用于计算 express 表达式
  23906. */
  23907. function evalFunction(data, express) {
  23908. var keys = [];
  23909. var values = [];
  23910. _$2.forOwn(data, function (value, key) {
  23911. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  23912. if (match) {
  23913. key = key.substring(0, match.index);
  23914. }
  23915. keys.push(key);
  23916. values.push(value);
  23917. });
  23918. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  23919. try {
  23920. return func.apply(void 0, __spread(values));
  23921. }
  23922. catch (e) {
  23923. return;
  23924. }
  23925. }
  23926. /**
  23927. * 获取表格编辑的行数据
  23928. */
  23929. function getGridEditRows(grid) {
  23930. return grid.getGridEditRows();
  23931. }
  23932. //# sourceMappingURL=systemLib.js.map
  23933. var SystemLib = /*#__PURE__*/Object.freeze({
  23934. __proto__: null,
  23935. SIMPLE_RE: SIMPLE_RE,
  23936. pinyinMatch: pinyinMatch,
  23937. calcExpress: calcExpress,
  23938. calcObjectFlat: calcObjectFlat,
  23939. mergeViewModel: mergeViewModel,
  23940. flatRow: flatRow,
  23941. replaceNA: replaceNA,
  23942. deepTravJson: deepTravJson,
  23943. tryWriteByExpress: tryWriteByExpress,
  23944. tryWriteObject: tryWriteObject,
  23945. tryVarSimple: tryVarSimple,
  23946. calcObject: calcObject,
  23947. getParentGrid: getParentGrid,
  23948. tryEnable: tryEnable,
  23949. setComboStore: setComboStore,
  23950. invokeServer: invokeServer$1,
  23951. clearViewModelValues: clearViewModelValues,
  23952. reloadGrid: reloadGrid,
  23953. toPlainObject: toPlainObject,
  23954. confirm: confirm,
  23955. normId: normId,
  23956. clearViewModelReloadGrid: clearViewModelReloadGrid,
  23957. saveGridRow: saveGridRow,
  23958. insertGridRow: insertGridRow,
  23959. commitMe: commitMe,
  23960. removeGridRow: removeGridRow,
  23961. moveUpGridRow: moveUpGridRow,
  23962. moveDownGridRow: moveDownGridRow,
  23963. SystemEventFu: SystemEventFu,
  23964. clearViewModel: clearViewModel,
  23965. clearViewModelByLookup: clearViewModelByLookup,
  23966. showWidget: showWidget,
  23967. stopEvent: stopEvent,
  23968. msg: msg$1,
  23969. showErrorDialog: showErrorDialog$1,
  23970. showInfoDialog: showInfoDialog,
  23971. prompt: prompt$2,
  23972. evalFunction: evalFunction,
  23973. getGridEditRows: getGridEditRows
  23974. });
  23975. function initTree () {
  23976. Ext.define('Yvan.Tree', {
  23977. extend: 'Ext.tree.Panel',
  23978. alias: 'widget.yvtree',
  23979. xtype: 'yvtree',
  23980. constructor: function (config) {
  23981. var newConfig = _$2.defaultsDeep({
  23982. // 强制性属性
  23983. }, baseConfig(config, 'row-item'), config, tree);
  23984. _$2.assign(newConfig, {
  23985. tbar: [
  23986. {
  23987. xtype: 'textfield',
  23988. // triggerCls: 'x-form-clear-trigger',
  23989. flex: 1,
  23990. emptyText: '搜索过滤',
  23991. enableKeyEvents: true,
  23992. listeners: {
  23993. change: function (sender) {
  23994. var tree = sender.up("treepanel");
  23995. tree.filterByText(this.getRawValue());
  23996. },
  23997. keyup: function (sender, e) {
  23998. var tree = sender.up("treepanel");
  23999. if (e.ESC === e.getKey()) {
  24000. sender.setValue('');
  24001. tree.filterByText('');
  24002. }
  24003. }
  24004. }
  24005. },
  24006. ],
  24007. });
  24008. if (!newConfig.hideRefresh) {
  24009. newConfig.tbar.push({
  24010. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  24011. listeners: {
  24012. click: function (sender) {
  24013. var scope = sender.up("yvtree");
  24014. scope.reload();
  24015. }
  24016. }
  24017. });
  24018. }
  24019. if (!newConfig.hideExpand) {
  24020. newConfig.tbar.push({
  24021. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  24022. listeners: {
  24023. click: function (sender) {
  24024. var scope = sender.up("yvtree");
  24025. scope.expandAll();
  24026. }
  24027. }
  24028. });
  24029. }
  24030. if (!newConfig.hideCollapse) {
  24031. newConfig.tbar.push({
  24032. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  24033. listeners: {
  24034. click: function (sender) {
  24035. var scope = sender.up("yvtree");
  24036. scope.collapseAll();
  24037. }
  24038. }
  24039. });
  24040. }
  24041. this.superclass.constructor.call(this, newConfig);
  24042. },
  24043. /**
  24044. * 在根节点上增加一个节点,会触发 addNode 事件
  24045. * @param props
  24046. */
  24047. addRoot: function (props) {
  24048. var me = this;
  24049. var tableNode = me.getRootNode();
  24050. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  24051. if (_$2.isFunction(props)) {
  24052. props = props.call(this, parent);
  24053. }
  24054. _$2.forOwn(props, function (value, key) {
  24055. fieldNode.set(key, value);
  24056. });
  24057. var node = tableNode.appendChild(fieldNode);
  24058. me.ensureVisible(node);
  24059. me.setSelection(node);
  24060. me.fireEvent('addNode', me, {
  24061. parent: tableNode,
  24062. node: node,
  24063. });
  24064. },
  24065. addLast: function (props) {
  24066. var me = this;
  24067. var sel = me.selModel.getSelection();
  24068. if (!sel || sel.length <= 0) {
  24069. msg('请选择一个要添加的同级节点路径');
  24070. return;
  24071. }
  24072. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  24073. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24074. if (_$2.isFunction(props)) {
  24075. props = props.call(this, parent);
  24076. }
  24077. _$2.forOwn(props, function (value, key) {
  24078. fieldNode.set(key, value);
  24079. });
  24080. var node = parent.appendChild(fieldNode);
  24081. me.ensureVisible(node);
  24082. me.setSelection(node);
  24083. me.fireEvent('addNode', me, {
  24084. parent: parent,
  24085. node: node,
  24086. });
  24087. },
  24088. addChildren: function (props) {
  24089. var me = this;
  24090. var sel = me.selModel.getSelection();
  24091. if (!sel || sel.length <= 0) {
  24092. msg('请选择一个要添加子节点的路径');
  24093. return;
  24094. }
  24095. var parent = sel[0];
  24096. if (_$2.isFunction(props)) {
  24097. props = props.call(this, parent);
  24098. }
  24099. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24100. _$2.forOwn(props, function (value, key) {
  24101. fieldNode.set(key, value);
  24102. });
  24103. var node = parent.appendChild(fieldNode);
  24104. parent.expand();
  24105. me.ensureVisible(node);
  24106. me.setSelection(node);
  24107. me.fireEvent('addNode', me, {
  24108. parent: parent,
  24109. node: node,
  24110. });
  24111. },
  24112. initComponent: function () {
  24113. var me = this;
  24114. var config = me.config;
  24115. var scope = lookupScope(this);
  24116. if (!isDesignMode(scope, config)) {
  24117. // 转换 dataSource 属性
  24118. convertDataSource(me, scope, config);
  24119. }
  24120. this.superclass.initComponent.call(this);
  24121. this.on({
  24122. afterrender: function (sender) {
  24123. var me = this;
  24124. var config = this.config;
  24125. var dataSource = config.dataSource;
  24126. if (config.autoLoad) {
  24127. if (config.dataSourceCallbackFn) {
  24128. me.reload();
  24129. }
  24130. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  24131. me.reload();
  24132. }
  24133. }
  24134. }
  24135. });
  24136. },
  24137. _setDataReal: function (value) {
  24138. var me = this;
  24139. // me.setStore(new Ext.data.TreeStore({
  24140. // root: {
  24141. // expanded: true,
  24142. // // children: value
  24143. // children: [
  24144. // {
  24145. // id: '1', text: 'A',
  24146. // children: [
  24147. // {id: '1', text: 'A',},
  24148. // {id: '2', text: 'B'},
  24149. // ]
  24150. // },
  24151. // {id: '2', text: 'B'},
  24152. // ]
  24153. // }
  24154. // }))
  24155. me.store.setRoot({
  24156. expanded: true,
  24157. children: value
  24158. });
  24159. // me.store = new Ext.data.TreeStore({
  24160. // root: {
  24161. // expanded: true,
  24162. // // children: value
  24163. // children: [
  24164. // {
  24165. // id: '1', text: 'A',
  24166. // children: [
  24167. // {id: '1', text: 'A',},
  24168. // {id: '2', text: 'B'},
  24169. // ]
  24170. // },
  24171. // {id: '2', text: 'B'},
  24172. // ]
  24173. // }
  24174. // })
  24175. },
  24176. /**
  24177. * 重新载入数据(重新计算参数)
  24178. */
  24179. reload: function (reloadParams) {
  24180. if (reloadParams === void 0) { reloadParams = {}; }
  24181. var me = this;
  24182. var config = me.config;
  24183. if (config.dataSourceCallbackFn) {
  24184. // 函数请求刷新
  24185. var scope_1 = lookupScope(this);
  24186. // me.setLoading(true)
  24187. config.dataSourceCallbackFn.call(scope_1, me, {
  24188. successCallback: function (value) {
  24189. me._setDataReal(value);
  24190. // me.setLoading(false)
  24191. me.fireEvent('dataLoadComplete', me, true, value);
  24192. },
  24193. failCallback: function (error) {
  24194. // me.setLoading(false)
  24195. me.fireEvent('dataLoadComplete', me, false, error);
  24196. }
  24197. });
  24198. return;
  24199. }
  24200. var scope = lookupScope(me);
  24201. var dataSource = config.dataSource;
  24202. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  24203. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  24204. me.setLoading(true);
  24205. invokeServer$1(dataSource.url, params)
  24206. .then(function (res) {
  24207. me._setDataReal(res.data);
  24208. me.fireEvent('dataLoadComplete', me, res);
  24209. })
  24210. .finally(function () {
  24211. me.setLoading(false);
  24212. });
  24213. }
  24214. },
  24215. filterByText: function (text) {
  24216. this._filterText = text;
  24217. this._filterBy(this, text, 'text');
  24218. },
  24219. _filterBy: _$2.debounce(function (me, text, by) {
  24220. var view = me.getView();
  24221. me.store.clearFilter();
  24222. if (!me._filterText) {
  24223. // 没有筛选内容,还原状态
  24224. var selections = me.getSelection();
  24225. var selectionPaths_1 = [];
  24226. _$2.forEach(me.getSelection(), function (item) {
  24227. selectionPaths_1.push(item.getPath());
  24228. });
  24229. me.collapseAll();
  24230. _$2.forEach(selectionPaths_1, function (path) {
  24231. me.expandPath(path);
  24232. });
  24233. me.setSelection(selections);
  24234. return;
  24235. }
  24236. // 递归查找所有需要可见的节点 id 数组
  24237. var nodesAndParents = [];
  24238. var expandPaths = [];
  24239. me.getRootNode().cascadeBy(function (tree, view) {
  24240. var currNode = this;
  24241. currNode.collapse();
  24242. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  24243. // 展开到匹配的路径
  24244. // me.expandPath(currNode.getPath());
  24245. expandPaths.push(currNode.getPath());
  24246. // 沿途父节点全部设定为可见
  24247. while (currNode.parentNode) {
  24248. nodesAndParents.push(currNode.id);
  24249. currNode = currNode.parentNode;
  24250. }
  24251. }
  24252. }, null, [me, view]);
  24253. me.store.filterBy(function (r) {
  24254. return Ext.Array.contains(nodesAndParents, r.get('id'));
  24255. });
  24256. _$2.forEach(expandPaths, function (path) {
  24257. me.expandPath(path);
  24258. });
  24259. }, 1000),
  24260. });
  24261. }
  24262. function convertDataSource(sender, scope, newConfig) {
  24263. if (typeof newConfig.store !== 'undefined') {
  24264. // 有 store 属性的情况下,不做任何事
  24265. return;
  24266. }
  24267. if (typeof newConfig.dataSource === 'undefined') {
  24268. // 没有定义 dataSource 的情况下,不做任何事
  24269. return;
  24270. }
  24271. var dataSource = newConfig.dataSource;
  24272. if (typeof dataSource === 'string') {
  24273. // dataSource 是字符串的情况下,找到成员函数
  24274. dataSource = lookupFn(scope, dataSource);
  24275. }
  24276. if (typeof dataSource === 'function') {
  24277. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  24278. newConfig.store = new Ext.data.TreeStore({
  24279. root: {
  24280. expanded: true,
  24281. children: []
  24282. }
  24283. });
  24284. newConfig.dataSourceCallbackFn = dataSource;
  24285. return;
  24286. }
  24287. // throw new TypeError('无法识别的调用方法')
  24288. }
  24289. //# sourceMappingURL=yvtree.js.map
  24290. /**
  24291. * 构建一个 grid 支持的 dataSource
  24292. */
  24293. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  24294. if (reloadParams === void 0) { reloadParams = {}; }
  24295. if (isExcelExport === void 0) { isExcelExport = false; }
  24296. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  24297. var _a;
  24298. var me = grid;
  24299. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  24300. var storeOption = {};
  24301. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  24302. if (dataSource.sqlId) {
  24303. dataSource.method = 'invoke';
  24304. dataSource.url = '/Dev@executeSQL';
  24305. if (_$2.startsWith(dataSource.sqlId, '@')) {
  24306. // sqlId 是 @ 开头,代表直接带中文名
  24307. var scope_1 = lookupScope(grid);
  24308. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  24309. params.sqlId = dataSource.sqlId.substring(1);
  24310. }
  24311. else {
  24312. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  24313. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  24314. params.path = path;
  24315. params.sqlId = sqlId;
  24316. }
  24317. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  24318. }
  24319. var fields_1 = [];
  24320. _$2.forEach(grid.columns, function (col) {
  24321. var c = {};
  24322. if (col.dataIndex) {
  24323. c.name = col.dataIndex;
  24324. fields_1.push(c);
  24325. }
  24326. if (col.dataType) {
  24327. c.type = col.dataType;
  24328. }
  24329. });
  24330. // 默认支持 gridInvoke
  24331. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  24332. //@ts-ignore
  24333. storeOption = {
  24334. fields: fields_1,
  24335. remoteSort: config.remoteSort,
  24336. remoteFilter: config.remoteFilter,
  24337. autoLoad: true,
  24338. pageSize: me.store.pageSize || config.pageSize,
  24339. proxy: {
  24340. type: 'jsonAjax',
  24341. $owner: me,
  24342. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  24343. extraParams: extraParams,
  24344. reader: {
  24345. type: 'json',
  24346. rootProperty: 'data',
  24347. totalProperty: 'pagination.total',
  24348. successProperty: 'success',
  24349. messageProperty: 'msg',
  24350. transform: function (data) {
  24351. if (typeof window['ajaxProcess'] === 'function') {
  24352. window['ajaxProcess'](data);
  24353. }
  24354. if (typeof window['apiTranslate'] === 'function') {
  24355. window['apiTranslate'](data, dataSource.url);
  24356. }
  24357. if (typeof grid._transform === 'function') {
  24358. // 系统转换函数
  24359. grid._transform(data.data);
  24360. }
  24361. if (grid.dataTransform) {
  24362. if (typeof grid.dataTransform === 'string') {
  24363. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  24364. }
  24365. return grid.dataTransform.call(scope, grid, data);
  24366. }
  24367. return data;
  24368. }
  24369. }
  24370. },
  24371. listeners: {
  24372. load: function (store, records, successful, operation) {
  24373. var _a, _b, _c;
  24374. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  24375. if (rep.pagination) {
  24376. grid.dbInfo = rep.pagination.dbInfo;
  24377. grid.exportDataSql = rep.pagination.exportDataSql;
  24378. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  24379. }
  24380. 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;
  24381. if (isExcelExport) {
  24382. if (typeof excelExportCallBack === 'function') {
  24383. excelExportCallBack(rep);
  24384. }
  24385. else if (excelExportCallBack) {
  24386. console.error("导出回调方法错误!");
  24387. }
  24388. me.fireEvent('excelDataLoadComplete', me, successful, records);
  24389. }
  24390. else {
  24391. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  24392. // 自动选中第一行
  24393. var data = grid.getStore().data;
  24394. if (data.length > 0) {
  24395. grid.setSelection(data.items[0]);
  24396. }
  24397. }
  24398. me.fireEvent('dataLoadComplete', me, successful, records);
  24399. }
  24400. }
  24401. }
  24402. };
  24403. }
  24404. else if (exports.apiConvert) {
  24405. // 外部扩展的 apiConvert
  24406. //@ts-ignore
  24407. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams);
  24408. }
  24409. else {
  24410. throw new TypeError("不支持的 API 请求方式");
  24411. }
  24412. if (isExcelExport) {
  24413. var excelStore = new Ext.data.Store(storeOption);
  24414. excelStore.load();
  24415. }
  24416. else {
  24417. if (me.groupField) {
  24418. console.log('groupField', storeOption.groupField);
  24419. storeOption.groupField = me.groupField;
  24420. }
  24421. me.setStore(new Ext.data.Store(storeOption));
  24422. }
  24423. }
  24424. function initStores () {
  24425. Ext.define('Yvan.JsonAjaxProxy', {
  24426. extend: 'Ext.data.proxy.Ajax',
  24427. alias: 'proxy.jsonAjax',
  24428. actionMethods: {
  24429. create: "POST",
  24430. read: "POST",
  24431. update: "POST",
  24432. destroy: "POST"
  24433. },
  24434. timeout: storeAjax.timeout,
  24435. buildRequest: function (operation) {
  24436. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  24437. var me = this;
  24438. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  24439. var scope = lookupScope($owner);
  24440. var gridParam = me.getParams(operation);
  24441. var customParam = {};
  24442. // 提取 srot 元素
  24443. if (gridParam.sort) {
  24444. var sort = JSON.parse(gridParam.sort);
  24445. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  24446. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  24447. customParam.sortModel = [];
  24448. _$2.forEach(sort, function (s) {
  24449. customParam.sortModel.push({
  24450. colId: s.property,
  24451. sort: _$2.toLower(s.direction)
  24452. });
  24453. });
  24454. delete gridParam.sort;
  24455. }
  24456. // 提取筛选元素
  24457. if (gridParam.filter) {
  24458. var filter = JSON.parse(gridParam.filter);
  24459. console.log('gridParam.filter', gridParam.filter);
  24460. // "[{"operator":"like","value":"1","property":"id"}]"
  24461. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  24462. customParam.filterModel = {};
  24463. _$2.forEach(filter, function (s) {
  24464. var newFilterItem = {};
  24465. if (s.operator === 'like') {
  24466. newFilterItem.filterType = 'text';
  24467. newFilterItem.type = 'contains';
  24468. newFilterItem.filter = s.value;
  24469. }
  24470. else {
  24471. // 无法识别的筛选类型
  24472. newFilterItem.filterType = 'dict';
  24473. newFilterItem.type = 'in';
  24474. newFilterItem.filter = s.value;
  24475. }
  24476. customParam.filterModel[s.property] = newFilterItem;
  24477. });
  24478. delete gridParam.filter;
  24479. }
  24480. // 被 grid.constructor 作为方法存在
  24481. var extraParams = _$2.cloneDeep(me.getExtraParams());
  24482. var params = _$2.defaultsDeep(gridParam, extraParams);
  24483. // var request = this.superclass.buildRequest.apply(this, arguments);
  24484. var request = new Ext.data.Request({
  24485. params: {},
  24486. action: operation.getAction(),
  24487. records: operation.getRecords(),
  24488. url: me.buildUrl(),
  24489. jsonData: __assign({ args: [
  24490. params
  24491. ] }, customParam),
  24492. proxy: me
  24493. });
  24494. operation.setRequest(request);
  24495. return request;
  24496. },
  24497. afterRequest: function (req, res) {
  24498. // Extend.afterExtRequest(req, res)
  24499. }
  24500. });
  24501. Ext.define('Ext.ux.data.MyReader', {
  24502. extend: 'Ext.data.reader.Json',
  24503. xtype: 'yvgridreader',
  24504. useSimpleAccessors: false,
  24505. });
  24506. }
  24507. //# sourceMappingURL=stores.js.map
  24508. function initBehaviorEdit(config) {
  24509. var _a, _b, _c;
  24510. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  24511. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  24512. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  24513. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  24514. if (dbTableName) {
  24515. // 生成增删查改
  24516. var tbar = [
  24517. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  24518. click: 'system.saveGridRow()'
  24519. }, bind: {
  24520. disabled: '{!' + config.reference + '.ischanged}'
  24521. } }, saveButtonConfig),
  24522. '-',
  24523. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  24524. click: 'system.insertGridRow()'
  24525. } }, addButtonConfig),
  24526. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  24527. click: 'system.removeGridRow()'
  24528. } }, deleteButtonConfig),
  24529. ];
  24530. if (_$2.isArray(config.tbar)) {
  24531. config.tbar = __spread(tbar, [
  24532. '-'
  24533. ], config.tbar);
  24534. }
  24535. else if (_$2.isPlainObject(config.tbar)) {
  24536. config.tbar = {
  24537. border: false,
  24538. layout: {
  24539. type: 'vbox',
  24540. align: 'stretch'
  24541. },
  24542. items: [
  24543. {
  24544. xtype: 'toolbar',
  24545. border: false,
  24546. items: tbar
  24547. },
  24548. config.tbar,
  24549. ]
  24550. };
  24551. }
  24552. else if (_$2.isUndefined(config.tbar)) {
  24553. config.tbar = tbar;
  24554. }
  24555. else {
  24556. console.error("can't build tbar property!", config.tbar);
  24557. }
  24558. }
  24559. }
  24560. //# sourceMappingURL=grid_behavior.js.map
  24561. function initGridDialog(config) {
  24562. var detailDialog = _$2.get(config, 'detailDialog');
  24563. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  24564. if (_$2.isPlainObject(detailDialog)) {
  24565. var tbar = [
  24566. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  24567. click: 'system.showGridRowDetail()',
  24568. }, bind: {
  24569. disabled: '{!' + config.reference + '.selection}'
  24570. } }, detailButtonConfig)
  24571. ];
  24572. if (_$2.isArray(config.tbar)) {
  24573. config.tbar = __spread(config.tbar, [
  24574. '-'
  24575. ], tbar);
  24576. }
  24577. else if (_$2.isPlainObject(config.tbar)) {
  24578. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  24579. config.tbar.items = __spread(config.tbar.items);
  24580. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  24581. if (!toolbar) {
  24582. config.tbar.items = __spread(config.tbar.items, [
  24583. {
  24584. xtype: 'toolbar',
  24585. border: false,
  24586. items: tbar
  24587. },
  24588. ]);
  24589. }
  24590. else {
  24591. toolbar.items = __spread(toolbar.items, [
  24592. '-'
  24593. ], tbar);
  24594. }
  24595. }
  24596. else {
  24597. config.tbar = {
  24598. border: false,
  24599. layout: {
  24600. type: 'vbox',
  24601. align: 'stretch'
  24602. },
  24603. items: [
  24604. {
  24605. xtype: 'toolbar',
  24606. border: false,
  24607. items: tbar
  24608. },
  24609. config.tbar,
  24610. ]
  24611. };
  24612. }
  24613. }
  24614. else if (_$2.isUndefined(config.tbar)) {
  24615. config.tbar = tbar;
  24616. }
  24617. else {
  24618. console.error("can't build tbar property!", config.tbar);
  24619. }
  24620. }
  24621. }
  24622. var SystemEventFu$1 = /** @class */ (function () {
  24623. function SystemEventFu() {
  24624. }
  24625. SystemEventFu.prototype.showGridRowDetail = function () {
  24626. return function (sender) {
  24627. var grid1 = sender.up('yvgrid');
  24628. showGridRowDetail(grid1);
  24629. };
  24630. };
  24631. __decorate([
  24632. Lib({
  24633. title: '为某个表格所选数据行, 显示其对话框',
  24634. author: '罗一帆',
  24635. createAt: '2022-07-27',
  24636. updateAt: '2022-07-27',
  24637. type: 'system',
  24638. category: '表格',
  24639. }),
  24640. __metadata("design:type", Function),
  24641. __metadata("design:paramtypes", []),
  24642. __metadata("design:returntype", void 0)
  24643. ], SystemEventFu.prototype, "showGridRowDetail", null);
  24644. return SystemEventFu;
  24645. }());
  24646. function showGridRowDetail(grid1, isEdit) {
  24647. if (isEdit === void 0) { isEdit = true; }
  24648. var _a, _b, _c;
  24649. if (!grid1.selection) {
  24650. msg$1('请选中要展示的数据行!');
  24651. return;
  24652. }
  24653. var record = grid1.selection;
  24654. if (_$2.isArray(record)) {
  24655. record = record[0];
  24656. }
  24657. if (!record) {
  24658. msg$1('请选中要展示的数据行!');
  24659. return;
  24660. }
  24661. var config = grid1._originVJson;
  24662. var detailDialog = config.detailDialog;
  24663. var vjson = {};
  24664. var parentScope = lookupScope(grid1);
  24665. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  24666. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  24667. _$2.defaultsDeep(vjson, {
  24668. // 强制属性
  24669. layout: 'fit',
  24670. __custom_path: __custom_path,
  24671. __custom_version: __custom_version,
  24672. fbar: __spread([
  24673. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  24674. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  24675. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  24676. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  24677. }, detailDialog, {
  24678. // 默认属性
  24679. width: 800,
  24680. height: 450,
  24681. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  24682. });
  24683. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  24684. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  24685. vjson.items.push(tabpanel);
  24686. if (tabpanel) {
  24687. // 有多个选项卡,按每个选项卡进行过滤
  24688. _$2.forEach(tabpanel.items, function (tab) {
  24689. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  24690. if (tabColumns.length > 0) {
  24691. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  24692. _$2.extend(tab, tabVjson);
  24693. }
  24694. });
  24695. }
  24696. }
  24697. else {
  24698. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  24699. }
  24700. var model = {
  24701. data: {
  24702. _edit: isEdit,
  24703. _editType: isEdit ? '编辑' : '添加',
  24704. }
  24705. };
  24706. _$2.forOwn(record.data, function (value, key) {
  24707. if (key === 'id') {
  24708. // 忽略 ID 属性
  24709. return;
  24710. }
  24711. if (_$2.startsWith(key, '_')) {
  24712. // 忽略 _ 开头的所有属性
  24713. return;
  24714. }
  24715. model.data[key] = value;
  24716. });
  24717. console.log(vjson);
  24718. var scope = new Scope({ vjson: vjson, model: model, });
  24719. //@ts-ignore
  24720. scope.commit = function () {
  24721. return new Promise(function (resolve) {
  24722. _$2.forOwn(scope.viewModel.data, function (value, key) {
  24723. if (_$2.startsWith(key, '_')) {
  24724. // _origin 等属性可以被忽略
  24725. return;
  24726. }
  24727. if (key === 'id') {
  24728. // id 属性被忽略
  24729. return;
  24730. }
  24731. record.set(key, value);
  24732. });
  24733. resolve();
  24734. });
  24735. };
  24736. scope.showDialog(grid1, {}, {});
  24737. }
  24738. function buildForm(columns, tabpanel, detailDialog) {
  24739. var vjson = __assign({ border: false, layout: {
  24740. type: 'vbox',
  24741. pack: 'start',
  24742. align: 'stretch'
  24743. }, defaults: {
  24744. border: false,
  24745. anchor: '100%',
  24746. margin: '5',
  24747. }, scrollable: true, items: [] }, detailDialog.form);
  24748. var emptyFieldset = [];
  24749. var fieldsetList = [];
  24750. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  24751. _$2.forEach(columns, function (c) {
  24752. var fieldset = _$2.get(c, 'form.fieldset');
  24753. if (fieldset) {
  24754. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  24755. if (idx < 0) {
  24756. fieldsetList.push({
  24757. fieldset: fieldset,
  24758. columns: [c]
  24759. });
  24760. }
  24761. else {
  24762. fieldsetList[idx].columns.push(c);
  24763. }
  24764. }
  24765. else {
  24766. emptyFieldset.push(c);
  24767. }
  24768. });
  24769. _$2.forEach(fieldsetList, function (fs) {
  24770. var fieldSetVjson = {
  24771. xtype: 'fieldset',
  24772. title: fs.fieldset,
  24773. items: []
  24774. };
  24775. buildFieldItems(fieldSetVjson.items, fs.columns);
  24776. vjson.items.push(fieldSetVjson);
  24777. });
  24778. buildFieldItems(vjson.items, emptyFieldset);
  24779. return vjson;
  24780. }
  24781. // 构建字段组
  24782. function buildFieldItems(items, columns) {
  24783. var _a, _b, _c, _d, _e;
  24784. var row = {
  24785. xtype: 'cols',
  24786. items: []
  24787. };
  24788. for (var i = 0; i < columns.length; i++) {
  24789. var column = columns[i];
  24790. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  24791. delete row.xtype;
  24792. row.layout = column.form.rowlayout;
  24793. }
  24794. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  24795. row.items.push({ border: false, flex: column.form.prefix });
  24796. }
  24797. var fieldVjson = buildField(column, row.items.length);
  24798. if (!fieldVjson) {
  24799. continue;
  24800. }
  24801. row.items.push(fieldVjson);
  24802. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  24803. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  24804. }
  24805. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  24806. items.push(row);
  24807. row = {
  24808. xtype: 'cols',
  24809. items: []
  24810. };
  24811. }
  24812. }
  24813. if (row.items.length > 0) {
  24814. items.push(row);
  24815. }
  24816. }
  24817. // 构建字段
  24818. function buildField(column, colIdx) {
  24819. var ret;
  24820. if (column.xtype === 'checkcolumn') {
  24821. ret = _$2.defaultsDeep({
  24822. xtype: 'checkbox',
  24823. uncheckedValue: column.uncheckedValue,
  24824. checkedValue: column.checkedValue,
  24825. boxLabel: column.header,
  24826. bind: {
  24827. value: '{' + column.dataIndex + '}'
  24828. }
  24829. }, column.form);
  24830. if (colIdx == 0) {
  24831. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  24832. ret.margin = '0 0 0 85';
  24833. }
  24834. }
  24835. else {
  24836. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  24837. fieldLabel: column.header,
  24838. bind: {
  24839. value: '{' + column.dataIndex + '}'
  24840. },
  24841. });
  24842. }
  24843. if (!ret.xtype) {
  24844. return;
  24845. }
  24846. if (!ret.dict && ret.xtype === 'combo') {
  24847. ret.dict = column.dict;
  24848. }
  24849. // 删除辅助属性
  24850. delete ret.order;
  24851. delete ret.wrap;
  24852. return ret;
  24853. }
  24854. //# sourceMappingURL=grid_dialog.js.map
  24855. var model$o = {
  24856. data: {}
  24857. };
  24858. //# sourceMappingURL=GridColumnCustom.model.js.map
  24859. var vjson$o = {
  24860. title: '自定义表格属性',
  24861. layout: 'fit',
  24862. width: 980,
  24863. height: 500,
  24864. fbar: [
  24865. {
  24866. xtype: "button",
  24867. text: "保存",
  24868. iconCls: 'x-fa fa-save',
  24869. listeners: {
  24870. click: 'scope.commit',
  24871. }
  24872. },
  24873. {
  24874. xtype: "button",
  24875. text: "关闭",
  24876. iconCls: 'x-fa fa-times',
  24877. listeners: {
  24878. click: 'system.closeMe()',
  24879. }
  24880. },
  24881. ],
  24882. items: [
  24883. {
  24884. region: 'center',
  24885. xtype: 'tabpanel',
  24886. items: [
  24887. {
  24888. title: '基本信息', reference: 'basic',
  24889. layout: {
  24890. type: 'vbox',
  24891. pack: 'start',
  24892. align: 'stretch'
  24893. },
  24894. defaults: {
  24895. border: false,
  24896. anchor: '100%',
  24897. margin: '5',
  24898. },
  24899. scrollable: true,
  24900. items: [
  24901. {
  24902. xtype: 'cols',
  24903. items: [
  24904. {
  24905. fieldLabel: '路径',
  24906. bind: { value: '{__custom_path}' },
  24907. xtype: 'textfield',
  24908. flex: 2,
  24909. },
  24910. {
  24911. fieldLabel: '版本',
  24912. bind: { value: '{__custom_version}' },
  24913. xtype: 'textfield',
  24914. },
  24915. ]
  24916. },
  24917. {
  24918. xtype: 'cols',
  24919. items: [
  24920. {
  24921. fieldLabel: '配置点',
  24922. bind: { value: '{__custom_point}' },
  24923. xtype: 'textfield',
  24924. },
  24925. {
  24926. fieldLabel: 'reference',
  24927. bind: { value: '{reference}' },
  24928. xtype: 'textfield',
  24929. },
  24930. {
  24931. fieldLabel: '编辑模式',
  24932. bind: { value: '{_mode}' },
  24933. xtype: 'combo',
  24934. dict: 'GRID_MODE',
  24935. },
  24936. ]
  24937. },
  24938. {
  24939. layout: 'hbox',
  24940. defaults: {
  24941. margin: '0 0 0 15',
  24942. },
  24943. items: [
  24944. {
  24945. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  24946. bind: {
  24947. value: "{hideFootbar}"
  24948. }
  24949. },
  24950. {
  24951. boxLabel: '隐藏刷新', xtype: 'checkbox',
  24952. bind: {
  24953. value: "{hideRefresh}"
  24954. }
  24955. },
  24956. {
  24957. boxLabel: '隐藏导出', xtype: 'checkbox',
  24958. bind: {
  24959. value: "{hideExport}"
  24960. }
  24961. },
  24962. {
  24963. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  24964. bind: {
  24965. value: "{hideAutoSize}"
  24966. }
  24967. },
  24968. {
  24969. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  24970. bind: {
  24971. value: "{hideClearFilter}"
  24972. }
  24973. },
  24974. {
  24975. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  24976. bind: {
  24977. value: "{hideSaveGridUIConfig}"
  24978. }
  24979. },
  24980. {
  24981. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  24982. bind: {
  24983. value: "{hideClearGridUIConfig}"
  24984. }
  24985. },
  24986. ]
  24987. },
  24988. {
  24989. layout: 'hbox',
  24990. defaults: {
  24991. margin: '0 0 0 15',
  24992. },
  24993. items: [
  24994. {
  24995. boxLabel: '自动载入数据源', xtype: 'checkbox',
  24996. bind: { value: '{autoLoad}' },
  24997. margin: '0 0 0 85',
  24998. },
  24999. {
  25000. boxLabel: '分页模式', xtype: 'checkbox',
  25001. bind: { value: '{pagination}' },
  25002. },
  25003. {
  25004. boxLabel: '显示行序号', xtype: 'checkbox',
  25005. bind: { value: '{show_rownum}' },
  25006. },
  25007. {
  25008. boxLabel: '后端排序', xtype: 'checkbox',
  25009. bind: {
  25010. value: "{remoteSort}"
  25011. }
  25012. },
  25013. {
  25014. boxLabel: '后端过滤', xtype: 'checkbox',
  25015. bind: {
  25016. value: "{remoteFilter}"
  25017. }
  25018. },
  25019. {
  25020. boxLabel: '隐藏', xtype: 'checkbox',
  25021. bind: {
  25022. value: "{hidden}"
  25023. }
  25024. },
  25025. ]
  25026. },
  25027. {
  25028. layout: 'hbox',
  25029. defaults: {
  25030. margin: '0 0 0 15',
  25031. },
  25032. items: [
  25033. {
  25034. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  25035. bind: {
  25036. value: "{enableColumnHide}"
  25037. }
  25038. },
  25039. {
  25040. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  25041. bind: {
  25042. value: "{enableColumnMove}"
  25043. }
  25044. },
  25045. {
  25046. boxLabel: '自定义筛选', xtype: 'checkbox',
  25047. bind: {
  25048. value: "{gridfilters}"
  25049. }
  25050. },
  25051. {
  25052. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  25053. bind: {
  25054. value: "{enableColumnResize}"
  25055. }
  25056. },
  25057. {
  25058. boxLabel: '点击列头排序', xtype: 'checkbox',
  25059. bind: {
  25060. value: "{sortOnClick}"
  25061. }
  25062. },
  25063. ]
  25064. },
  25065. {
  25066. xtype: 'cols',
  25067. items: [
  25068. {
  25069. fieldLabel: 'dbTableName',
  25070. labelWidth: 110,
  25071. bind: { value: '{behavior.dbTableName}' },
  25072. xtype: 'textfield',
  25073. },
  25074. {
  25075. fieldLabel: 'theid',
  25076. bind: { value: '{theid}' },
  25077. xtype: 'textfield',
  25078. },
  25079. {
  25080. fieldLabel: '添加行聚焦',
  25081. bind: { value: '{behavior.focusColumnAfterInsert}' },
  25082. xtype: 'textfield',
  25083. },
  25084. ]
  25085. },
  25086. {
  25087. xtype: 'cols',
  25088. items: [
  25089. {
  25090. fieldLabel: '批量删除提示',
  25091. labelWidth: 110,
  25092. bind: { value: '{behavior.batchRemoveConfirm}' },
  25093. xtype: 'textfield',
  25094. },
  25095. {
  25096. fieldLabel: '删除提示',
  25097. bind: { value: '{behavior.singleRemoveConfirm}' },
  25098. xtype: 'textfield',
  25099. },
  25100. {
  25101. fieldLabel: '触发刷新',
  25102. labelWidth: 110,
  25103. bind: { value: '{behavior.selectToReload}' },
  25104. xtype: 'textfield',
  25105. },
  25106. ]
  25107. },
  25108. ]
  25109. },
  25110. {
  25111. title: '字段', reference: 'grid1',
  25112. xtype: 'yvgrid',
  25113. pagination: false,
  25114. _mode: 'edit',
  25115. listeners: {
  25116. buttonclick: 'scope.grid1Buttonclick',
  25117. },
  25118. hideFootbar: true,
  25119. tbar: [
  25120. {
  25121. xtype: 'button',
  25122. text: '添加',
  25123. iconCls: 'x-fa fa-plus-circle',
  25124. listeners: {
  25125. click: 'scope.addField'
  25126. }
  25127. },
  25128. {
  25129. xtype: 'button',
  25130. text: '删除',
  25131. iconCls: 'x-fa fa-minus-circle',
  25132. listeners: {
  25133. click: 'scope.removeField'
  25134. }
  25135. },
  25136. '-',
  25137. {
  25138. xtype: 'button',
  25139. text: '自动分析',
  25140. iconCls: 'x-fa fa-code-fork',
  25141. listeners: {
  25142. click: 'scope.calcField'
  25143. }
  25144. },
  25145. {
  25146. xtype: 'button',
  25147. text: '上移',
  25148. iconCls: 'x-fa fa-arrow-up',
  25149. listeners: {
  25150. click: 'scope.moveUp'
  25151. }
  25152. },
  25153. {
  25154. xtype: 'button',
  25155. text: '下移',
  25156. iconCls: 'x-fa fa-arrow-down',
  25157. listeners: {
  25158. click: 'scope.moveDown'
  25159. }
  25160. },
  25161. ],
  25162. store: {},
  25163. columns: [
  25164. {
  25165. dataIndex: 'dataIndex', header: "字段名", width: 140,
  25166. editor: { xtype: 'textfield' }
  25167. },
  25168. {
  25169. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  25170. editor: { xtype: 'textfield' }
  25171. },
  25172. {
  25173. dataIndex: 'header', header: '中文', width: 140,
  25174. editor: { xtype: 'textfield' }
  25175. },
  25176. {
  25177. dataIndex: 'dict', header: '字典', width: 110,
  25178. editor: { xtype: 'combogrid' }
  25179. },
  25180. {
  25181. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  25182. editor: { xtype: 'combogrid' }, hidden: true,
  25183. },
  25184. {
  25185. dataIndex: 'width', header: '宽度', width: 80,
  25186. editor: { xtype: 'numberfield' }, hidden: true,
  25187. },
  25188. {
  25189. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  25190. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  25191. },
  25192. {
  25193. dataIndex: 'serverCreateValue', header: '服务端创建值',
  25194. editor: { xtype: 'textfield' },
  25195. },
  25196. {
  25197. dataIndex: 'createValue', text: '客户端新创建值',
  25198. editor: { xtype: 'textfield' },
  25199. },
  25200. {
  25201. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  25202. resizable: false, sortable: false, menuDisabled: true,
  25203. checkedValue: true, uncheckedValue: false,
  25204. },
  25205. {
  25206. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  25207. resizable: false, sortable: false, menuDisabled: true,
  25208. checkedValue: true, uncheckedValue: false,
  25209. },
  25210. {
  25211. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  25212. resizable: false, sortable: false, menuDisabled: true,
  25213. checkedValue: true, uncheckedValue: false,
  25214. },
  25215. {
  25216. dataIndex: 'formatter', header: '格式化', width: 110,
  25217. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  25218. },
  25219. {
  25220. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  25221. resizable: false, sortable: false, menuDisabled: true,
  25222. checkedValue: true, uncheckedValue: false, hidden: true,
  25223. },
  25224. {
  25225. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  25226. resizable: false, sortable: false, menuDisabled: true,
  25227. hidden: true,
  25228. },
  25229. {
  25230. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  25231. resizable: false, sortable: false, menuDisabled: true,
  25232. checkedValue: true, uncheckedValue: false, hidden: true,
  25233. },
  25234. {
  25235. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  25236. resizable: false, sortable: false, menuDisabled: true,
  25237. },
  25238. {
  25239. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  25240. resizable: false, sortable: false, menuDisabled: true,
  25241. checkedValue: true, uncheckedValue: false, hidden: true,
  25242. },
  25243. {
  25244. dataIndex: 'form_order', text: '对话框序号',
  25245. editor: { xtype: 'numberfield' },
  25246. },
  25247. {
  25248. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  25249. resizable: false, sortable: false, menuDisabled: true,
  25250. checkedValue: true, uncheckedValue: false,
  25251. },
  25252. {
  25253. dataIndex: 'form_xtype', text: '对话框编辑器',
  25254. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  25255. },
  25256. {
  25257. dataIndex: 'form_fieldset', text: '对话框字段组',
  25258. editor: { xtype: 'textfield' }, hidden: true,
  25259. },
  25260. {
  25261. dataIndex: 'form_tab', text: '对话框选项卡',
  25262. editor: { xtype: 'textfield' }, hidden: true,
  25263. },
  25264. {
  25265. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  25266. resizable: false, sortable: false, menuDisabled: true,
  25267. checkedValue: true, uncheckedValue: false, hidden: true,
  25268. },
  25269. ],
  25270. },
  25271. {
  25272. title: 'SQL和查询条件', reference: 'sql',
  25273. layout: 'border',
  25274. border: false,
  25275. items: [
  25276. {
  25277. region: 'north',
  25278. height: 200,
  25279. border: false,
  25280. split: true,
  25281. xtype: 'yvgrid',
  25282. reference: 'gridCondition',
  25283. pagination: false,
  25284. hideFootbar: true,
  25285. _mode: 'edit',
  25286. listeners: {
  25287. buttonclick: 'scope.conditionButtonclick',
  25288. },
  25289. store: {},
  25290. tbar: {
  25291. xtype: 'toolbar',
  25292. border: false,
  25293. items: [
  25294. {
  25295. xtype: 'button',
  25296. text: '添加条件',
  25297. iconCls: 'x-fa fa-plus-circle',
  25298. listeners: {
  25299. click: 'scope.addCondition'
  25300. }
  25301. },
  25302. {
  25303. xtype: 'button',
  25304. text: '删除条件',
  25305. iconCls: 'x-fa fa-minus-circle',
  25306. listeners: {
  25307. click: 'scope.removeCondition'
  25308. }
  25309. },
  25310. '-',
  25311. {
  25312. xtype: 'button',
  25313. text: '自动分析条件变量',
  25314. iconCls: 'x-fa fa-code-fork',
  25315. listeners: {
  25316. click: 'scope.calcCondition'
  25317. }
  25318. },
  25319. {
  25320. xtype: 'button',
  25321. text: '上移',
  25322. iconCls: 'x-fa fa-arrow-up',
  25323. listeners: {
  25324. click: 'scope.moveUpCondition'
  25325. }
  25326. },
  25327. {
  25328. xtype: 'button',
  25329. text: '下移',
  25330. iconCls: 'x-fa fa-arrow-down',
  25331. listeners: {
  25332. click: 'scope.moveDownCondition'
  25333. }
  25334. },
  25335. ]
  25336. },
  25337. columns: [
  25338. {
  25339. text: '条件变量',
  25340. dataIndex: 'param_name',
  25341. width: 140,
  25342. sortable: false,
  25343. menuDisabled: true,
  25344. editor: {
  25345. selectOnFocus: true
  25346. },
  25347. },
  25348. {
  25349. text: '中文标题',
  25350. dataIndex: 'fieldLabel',
  25351. width: 120,
  25352. sortable: false,
  25353. menuDisabled: true,
  25354. editor: {
  25355. selectOnFocus: true
  25356. },
  25357. },
  25358. {
  25359. text: '编辑类型',
  25360. dataIndex: 'xtype',
  25361. width: 80,
  25362. sortable: false,
  25363. menuDisabled: true,
  25364. editor: {
  25365. xtype: 'combo',
  25366. typeAhead: true,
  25367. triggerAction: 'all',
  25368. selectOnFocus: true,
  25369. store: [
  25370. ['textfield', 'textfield'],
  25371. ['combo', 'combo'],
  25372. ['datefield', 'datefield'],
  25373. ['datetimefield', 'datetimefield'],
  25374. ['numberfield', 'numberfield'],
  25375. ['multiplesearch', 'multiplesearch'],
  25376. ]
  25377. }
  25378. },
  25379. {
  25380. text: '权重',
  25381. dataIndex: 'conditionFieldFlex',
  25382. align: 'right',
  25383. width: 60,
  25384. sortable: false,
  25385. menuDisabled: true,
  25386. editor: {
  25387. xtype: 'numberfield',
  25388. selectOnFocus: false,
  25389. minValue: 0,
  25390. maxValue: 10
  25391. },
  25392. },
  25393. {
  25394. text: '字典',
  25395. dataIndex: 'conditionFieldDict',
  25396. width: 160,
  25397. sortable: false,
  25398. menuDisabled: true,
  25399. editor: {
  25400. selectOnFocus: false
  25401. },
  25402. },
  25403. {
  25404. xtype: 'checkcolumn',
  25405. dataIndex: "conditionFieldWrap", header: "换行",
  25406. width: 65,
  25407. sortable: false,
  25408. menuDisabled: true,
  25409. },
  25410. {
  25411. text: '扩展参数',
  25412. dataIndex: 'conditionFieldExtend',
  25413. sortable: false,
  25414. menuDisabled: true,
  25415. editor: {
  25416. selectOnFocus: false
  25417. },
  25418. },
  25419. ]
  25420. },
  25421. {
  25422. region: 'center',
  25423. xtype: 'sqleditor',
  25424. layout: 'fit',
  25425. reference: 'sqlEditor',
  25426. split: true,
  25427. },
  25428. ]
  25429. },
  25430. {
  25431. title: '详情对话框',
  25432. layout: {
  25433. type: 'vbox',
  25434. pack: 'start',
  25435. align: 'stretch'
  25436. },
  25437. defaults: {
  25438. border: false,
  25439. anchor: '100%',
  25440. margin: '5',
  25441. },
  25442. scrollable: true,
  25443. items: [
  25444. {
  25445. xtype: 'cols',
  25446. items: [
  25447. {
  25448. fieldLabel: '对话框标题',
  25449. bind: { value: '{detailDialog.title}' },
  25450. xtype: 'textfield',
  25451. flex: 2,
  25452. },
  25453. {
  25454. fieldLabel: '宽度',
  25455. bind: { value: '{detailDialog.width}' },
  25456. xtype: 'numberfield',
  25457. },
  25458. {
  25459. fieldLabel: '高度',
  25460. bind: { value: '{detailDialog.height}' },
  25461. xtype: 'numberfield',
  25462. },
  25463. ]
  25464. },
  25465. ]
  25466. },
  25467. {
  25468. title: '界面源码',
  25469. xtype: 'jseditor',
  25470. reference: 'jseditor'
  25471. }
  25472. ]
  25473. }
  25474. ]
  25475. };
  25476. //# sourceMappingURL=GridColumnCustom.view.js.map
  25477. var GridColumnCustom = /** @class */ (function (_super) {
  25478. __extends(GridColumnCustom, _super);
  25479. function GridColumnCustom() {
  25480. return _super.call(this, { model: model$o, vjson: vjson$o }) || this;
  25481. }
  25482. GridColumnCustom.prototype.commit = function () {
  25483. };
  25484. GridColumnCustom.prototype.grid1Buttonclick = function () {
  25485. };
  25486. GridColumnCustom.prototype.conditionButtonclick = function () {
  25487. };
  25488. GridColumnCustom.prototype.addField = function () {
  25489. };
  25490. GridColumnCustom.prototype.removeField = function () {
  25491. };
  25492. GridColumnCustom.prototype.calcField = function () {
  25493. };
  25494. GridColumnCustom.prototype.moveUp = function () {
  25495. };
  25496. GridColumnCustom.prototype.moveDown = function () {
  25497. };
  25498. GridColumnCustom.prototype.addCondition = function () {
  25499. };
  25500. GridColumnCustom.prototype.removeCondition = function () {
  25501. };
  25502. GridColumnCustom.prototype.calcCondition = function () {
  25503. };
  25504. GridColumnCustom.prototype.moveUpCondition = function () {
  25505. };
  25506. GridColumnCustom.prototype.moveDownCondition = function () {
  25507. };
  25508. return GridColumnCustom;
  25509. }(Scope));
  25510. //# sourceMappingURL=GridColumnCustom.js.map
  25511. function initGridCode(grid, newConfig, buttons) {
  25512. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  25513. buttons.push({
  25514. xtype: 'button',
  25515. tooltip: '定义表格属性',
  25516. iconCls: 'x-fa fa-codepen',
  25517. handler: function (btn) {
  25518. var customWindow = new GridColumnCustom();
  25519. customWindow.showDialog(btn, {}, {});
  25520. }
  25521. });
  25522. buttons.push({
  25523. xtype: 'button',
  25524. tooltip: '定义表格数据源',
  25525. iconCls: 'x-fa fa-database',
  25526. handler: function () {
  25527. // showCustomGridDataSource(grid)
  25528. }
  25529. });
  25530. }
  25531. }
  25532. //# sourceMappingURL=grid_code.js.map
  25533. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  25534. var hexToString = function (hex) {
  25535. var arr = hex.split("");
  25536. var out = "";
  25537. for (var i = 0; i < arr.length / 2; i++) {
  25538. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  25539. // @ts-ignore
  25540. var charValue = String.fromCharCode(tmp);
  25541. out += charValue;
  25542. }
  25543. return out;
  25544. };
  25545. var defaultGrid = grid;
  25546. function initGrid () {
  25547. Ext.define('Yvan.Grid', {
  25548. extend: 'Ext.grid.Panel',
  25549. xtype: 'yvgrid',
  25550. __suspendReload: false,
  25551. _originVJson: {},
  25552. constructor: function (config) {
  25553. var _this = this;
  25554. var _a, _b, _c, _d, _e, _f;
  25555. var me = this;
  25556. var dataSource = config.dataSource;
  25557. 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);
  25558. me._originVJson = config;
  25559. if (!isDesignMode(scope, config)) {
  25560. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  25561. if (Array.isArray(config.columns) && config.columns.length > 0) {
  25562. var cacheData = this.getColumnConfigCache();
  25563. if (Array.isArray(cacheData) && cacheData.length > 0) {
  25564. var newColumns = [];
  25565. for (var j = 0; j < cacheData.length; j++) {
  25566. var itData = cacheData[j];
  25567. for (var i = 0; i < config.columns.length; i++) {
  25568. var column = config.columns[i];
  25569. if (itData.dataIndex === column.dataIndex) {
  25570. if (itData.width) {
  25571. column.width = itData.width;
  25572. }
  25573. column.hidden = itData.hidden;
  25574. column.locked = itData.locked;
  25575. newColumns.push(column);
  25576. break;
  25577. }
  25578. }
  25579. }
  25580. config.columns = newColumns;
  25581. }
  25582. }
  25583. }
  25584. var newConfig = _$2.defaultsDeep({
  25585. // 强制性属性 bug.
  25586. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  25587. // enableLocking: false,
  25588. // syncRowHeight: false,
  25589. }, baseConfig(config, 'row-item'), config, grid);
  25590. // 在面板上的组件
  25591. // const scope = newConfig.$initParent?.yvanScope ||
  25592. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  25593. // config.$vmParent?.yvanScope ||
  25594. // newConfig.$vmParent?._parent?.yvanScope;
  25595. var buttons = [];
  25596. var getRowClass = newConfig.getRowClass;
  25597. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  25598. _$2.startsWith(getRowClass, "system."))) {
  25599. var fn = lookupFn(scope, getRowClass);
  25600. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  25601. }
  25602. if (!newConfig.hideExport) {
  25603. buttons.push({
  25604. xtype: 'button',
  25605. tooltip: '导出Excel',
  25606. iconCls: 'x-fa fa-download',
  25607. listeners: {
  25608. click: this.exportExcel
  25609. },
  25610. });
  25611. }
  25612. if (!newConfig.hideAutoSize) {
  25613. buttons.push({
  25614. xtype: 'button',
  25615. iconCls: 'x-fa fa-text-width',
  25616. tooltip: '自适应宽度',
  25617. listeners: {
  25618. click: this.autoSizeColumns
  25619. }
  25620. });
  25621. }
  25622. if (!newConfig.hideClearFilter) {
  25623. buttons.push({
  25624. xtype: 'button',
  25625. tooltip: '清空筛选',
  25626. iconCls: 'x-fa fa-filter',
  25627. handler: this.clearFilter
  25628. });
  25629. }
  25630. if (!newConfig.hideSaveGridUIConfig) {
  25631. buttons.push({
  25632. xtype: 'button',
  25633. tooltip: '保存布局',
  25634. iconCls: 'x-fa fa-cogs',
  25635. handler: this.saveGridUIConfig
  25636. });
  25637. }
  25638. if (!newConfig.hideClearGridUIConfig) {
  25639. buttons.push({
  25640. xtype: 'button',
  25641. tooltip: '还原布局',
  25642. iconCls: 'x-fa fa-reply-all',
  25643. handler: this.clearGridUIConfig
  25644. });
  25645. }
  25646. initGridCode(me, newConfig, buttons);
  25647. if (!newConfig.hideFootbar) {
  25648. if (newConfig.pagination) {
  25649. newConfig.bbar = new Ext.PagingToolbar({
  25650. // pageSize: newConfig.pageSize, 这个值是无效的
  25651. displayInfo: true,
  25652. store: this.store,
  25653. emptyMsg: '没有记录',
  25654. cls: 'grid-bbar',
  25655. items: __spread([
  25656. {
  25657. xtype: 'combobox',
  25658. tooltip: '分页',
  25659. queryMode: 'local',
  25660. editable: false,
  25661. allowBlank: true,
  25662. labelAlign: 'right',
  25663. width: 90,
  25664. // labelWidth: 30,
  25665. listConfig: {
  25666. minWidth: null
  25667. },
  25668. value: 50,
  25669. valueField: undefined,
  25670. displayField: undefined,
  25671. hideClear: true,
  25672. store: newConfig.pageSizeOption,
  25673. listeners: {
  25674. change: function (sender, nv, ov) {
  25675. _this.store.pageSize = nv;
  25676. _this.store.loadPage(1);
  25677. }
  25678. }
  25679. }
  25680. ], buttons),
  25681. doRefresh: function () {
  25682. me.reload();
  25683. }
  25684. });
  25685. }
  25686. else {
  25687. newConfig.bbar = {
  25688. xtype: 'toolbar', overflowHandler: 'menu',
  25689. cls: 'grid-bbar',
  25690. items: __spread([
  25691. {
  25692. xtype: 'button',
  25693. tooltip: '刷新',
  25694. iconCls: 'x-fa fa-refresh',
  25695. handler: function () {
  25696. _this.reload();
  25697. }
  25698. },
  25699. '-'
  25700. ], buttons)
  25701. };
  25702. if (newConfig.hideRefresh) {
  25703. newConfig.bbar.items.splice(0, 1);
  25704. }
  25705. }
  25706. }
  25707. if (_$2.isArray(newConfig.condition)) {
  25708. // 带查询条件
  25709. var conditionRows_1 = [];
  25710. var newRow_1 = false;
  25711. var currentRow_1 = { xtype: 'cols', items: [], };
  25712. conditionRows_1.push(currentRow_1);
  25713. _$2.forEach(newConfig.condition, function (item) {
  25714. var _a;
  25715. if (newRow_1) {
  25716. currentRow_1 = { xtype: 'cols', items: [], };
  25717. conditionRows_1.push(currentRow_1);
  25718. }
  25719. var vj = _$2.cloneDeep(item);
  25720. if (vj.xtype) {
  25721. if (item.xtype === 'combo' && item.dict) {
  25722. vj.fix = ['system.getDict("' + item.dict + '")'];
  25723. }
  25724. if (item.xtype === 'datetimefield') {
  25725. _$2.defer(function () {
  25726. //@ts-ignore
  25727. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  25728. });
  25729. }
  25730. else if (item.xtype === 'datefield') {
  25731. _$2.defer(function () {
  25732. //@ts-ignore
  25733. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  25734. });
  25735. }
  25736. else {
  25737. scope.viewModel.set(item.param_name, '');
  25738. }
  25739. }
  25740. else {
  25741. // 没有组件类型,是个空占位符
  25742. vj.border = false;
  25743. }
  25744. if (item.param_name) {
  25745. vj.bind = {
  25746. value: '{' + item.param_name + '}'
  25747. };
  25748. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25749. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25750. }
  25751. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  25752. currentRow_1.items.push(vj);
  25753. });
  25754. newConfig.tbar = {
  25755. xtype: 'form',
  25756. border: false,
  25757. items: conditionRows_1,
  25758. defaults: {
  25759. margin: '8 0 8 0'
  25760. },
  25761. };
  25762. console.log('newConfig', newConfig);
  25763. }
  25764. _$2.each(newConfig.columns, function (c) {
  25765. var renderer = c.renderer, formatter = c.formatter;
  25766. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  25767. _$2.startsWith(renderer, "system."))) {
  25768. if (newConfig.$initParent) {
  25769. if (scope) {
  25770. var rendererFn = lookupFn(scope, renderer);
  25771. c.renderer = rendererFn.bind(scope);
  25772. }
  25773. }
  25774. }
  25775. if (c.dict) {
  25776. c.fix = ['system.getDict("' + c.dict + '")'];
  25777. if (c.editor && c.editor.xtype === 'combo') {
  25778. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  25779. c.editor.typeAhead = true;
  25780. c.editor.triggerAction = 'all';
  25781. c.editor.selectOnFocus = false;
  25782. c.editor.listConfig = {
  25783. minWidth: 200
  25784. };
  25785. }
  25786. }
  25787. if (formatter === 'button') {
  25788. c.tdCls = 'td-btn';
  25789. if (!c.listeners) {
  25790. c.listeners = {};
  25791. }
  25792. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  25793. if ($(event.target).is('input')) {
  25794. me.fireEvent('buttonclick', me, this, record);
  25795. }
  25796. };
  25797. }
  25798. else if (formatter === 'percentRenderer') {
  25799. c.tdCls = 'td-percent';
  25800. }
  25801. });
  25802. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  25803. // 强制为编辑模式
  25804. newConfig.selModel = {
  25805. type: 'spreadsheet',
  25806. columnSelect: true,
  25807. pruneRemoved: false,
  25808. extensible: 'y'
  25809. };
  25810. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  25811. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  25812. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25813. }
  25814. else {
  25815. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  25816. }
  25817. }
  25818. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  25819. // 强制为勾选模式
  25820. newConfig.selModel = {
  25821. type: 'checkboxmodel',
  25822. mode: 'MULTI',
  25823. };
  25824. }
  25825. else if (newConfig._mode === 'checkonly') {
  25826. newConfig.selModel = {
  25827. type: 'checkboxmodel',
  25828. mode: 'MULTI',
  25829. checkOnly: true,
  25830. };
  25831. }
  25832. else if (newConfig._mode === 'select') {
  25833. // 强制为选择模式
  25834. newConfig.selModel = {
  25835. selType: 'rowmodel',
  25836. mode: 'SINGLE',
  25837. };
  25838. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  25839. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25840. }
  25841. }
  25842. initBehaviorEdit(newConfig);
  25843. initGridDialog(newConfig);
  25844. this.superclass.constructor.call(this, newConfig);
  25845. this.store.pageSize = newConfig.pageSize;
  25846. },
  25847. setData: function (value) {
  25848. var me = this;
  25849. me._setDataReal(value);
  25850. },
  25851. /**
  25852. * 添加行,并进入编辑状态
  25853. * @param record 新行的属性集
  25854. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  25855. */
  25856. appendEditRow: function (record, editRowCol) {
  25857. var records = this.getStore().add(record);
  25858. var recNew = records[0];
  25859. this.setSelection(records);
  25860. if (typeof editRowCol === 'string' && editRowCol) {
  25861. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25862. }
  25863. if (typeof editRowCol === 'number') {
  25864. var ce = this.findPlugin('cellediting');
  25865. this.editingPlugin = ce;
  25866. ce.startEdit(recNew, editRowCol);
  25867. }
  25868. },
  25869. beginEdit: function (record, editRowCol) {
  25870. if (typeof record === 'number') {
  25871. record = this.store.data.getAt(record);
  25872. }
  25873. if (record.isEntity === true) {
  25874. this.setSelection([record]);
  25875. if (typeof editRowCol === 'string' && editRowCol) {
  25876. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25877. }
  25878. if (typeof editRowCol === 'number') {
  25879. var ce = this.findPlugin('cellediting');
  25880. this.editingPlugin = ce;
  25881. ce.startEdit(record, editRowCol);
  25882. }
  25883. }
  25884. },
  25885. /**
  25886. * 移除行
  25887. * @param record 如果记录传空,就是当前选中的行
  25888. */
  25889. removeEditRow: function (record) {
  25890. if (!record) {
  25891. record = this.selection;
  25892. }
  25893. if (!record) {
  25894. msg('请选中要删除的行');
  25895. return;
  25896. }
  25897. this.getStore().remove(record);
  25898. },
  25899. /**
  25900. * 获取全部原始数据
  25901. */
  25902. getDataRows: function () {
  25903. return this.getStore().data.items.map(function (r) { return r.data; });
  25904. },
  25905. /**
  25906. * 获取全部原始数据, 不带 id/ 不带 origin
  25907. */
  25908. getDataRowsOnlyData: function () {
  25909. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  25910. delete r.id;
  25911. delete r._origin;
  25912. return r;
  25913. });
  25914. },
  25915. rowMoveUp: function () {
  25916. var grid = this;
  25917. if (!grid.selection) {
  25918. msg('无法对多行进行移动');
  25919. return;
  25920. }
  25921. var record = grid.selection;
  25922. if (_$2.isArray(record)) {
  25923. record = record[0];
  25924. }
  25925. if (!record) {
  25926. msg('无法对多行进行移动');
  25927. return;
  25928. }
  25929. // const records = grid.selModel.getSelection()
  25930. // if (records.length !== 1) {
  25931. // msg('无法对多行进行移动')
  25932. // return
  25933. // }
  25934. //
  25935. // const [record] = records
  25936. var index = grid.store.indexOf(record);
  25937. if (index > 0) {
  25938. grid.store.removeAt(index);
  25939. grid.store.insert(index - 1, record);
  25940. grid.getView().refresh();
  25941. grid.selModel.select([record]);
  25942. }
  25943. },
  25944. rowMoveDown: function () {
  25945. var grid = this;
  25946. // const records = grid.selModel.getSelection()
  25947. // if (records.length !== 1) {
  25948. // msg('无法对多行进行移动')
  25949. // return
  25950. // }
  25951. if (!grid.selection) {
  25952. msg('无法对多行进行移动');
  25953. return;
  25954. }
  25955. var record = grid.selection;
  25956. if (_$2.isArray(record)) {
  25957. record = record[0];
  25958. }
  25959. if (!record) {
  25960. msg('无法对多行进行移动');
  25961. return;
  25962. }
  25963. var index = grid.store.indexOf(record);
  25964. if (index < grid.store.getCount() - 1) {
  25965. grid.store.removeAt(index);
  25966. grid.store.insert(index + 1, record);
  25967. grid.getView().refresh();
  25968. grid.selModel.select([record]);
  25969. }
  25970. },
  25971. getEditRecord: function () {
  25972. var _a, _b;
  25973. var me = this;
  25974. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  25975. 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;
  25976. var record;
  25977. if (typeof rowIdx === 'undefined') {
  25978. record = me.getSelectionModel().getLastSelected();
  25979. }
  25980. else {
  25981. record = me.store.getAt(rowIdx);
  25982. }
  25983. return record;
  25984. },
  25985. getEditRow: function () {
  25986. var _a;
  25987. var me = this;
  25988. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  25989. },
  25990. setEditRow: function (rowValues) {
  25991. var me = this;
  25992. var record = me.getEditRecord();
  25993. if (record) {
  25994. _$2.forOwn(rowValues, function (v, k) {
  25995. record.set(k, v);
  25996. });
  25997. }
  25998. },
  25999. _transform: function (data) {
  26000. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  26001. _$2.forEach(data, function (row) {
  26002. row._origin = _$2.clone(row);
  26003. });
  26004. },
  26005. _setDataReal: function (value) {
  26006. var me = this;
  26007. this._transform(value);
  26008. var storeOpt = {
  26009. fields: getFileds(this),
  26010. data: value,
  26011. };
  26012. if (this.groupField) {
  26013. storeOpt.groupField = this.groupField;
  26014. }
  26015. var store = new Ext.data.Store(storeOpt);
  26016. me.setStore(store);
  26017. },
  26018. setStore: function (store) {
  26019. var me = this;
  26020. if (_$2.isArray(store)) {
  26021. var value = store;
  26022. this._transform(value);
  26023. var storeOpt = {
  26024. fields: getFileds(this),
  26025. data: value,
  26026. };
  26027. if (this.groupField) {
  26028. storeOpt.groupField = this.groupField;
  26029. }
  26030. store = new Ext.data.Store(storeOpt);
  26031. }
  26032. me.superclass.setStore.call(this, store);
  26033. var reference = this.reference;
  26034. if (reference) {
  26035. var scope = lookupScope(this);
  26036. scope.viewModel.set(reference + '.ischanged', false);
  26037. scope.viewModel.set(reference + '.theid', null);
  26038. scope.viewModel.set(reference + '.theid2', null);
  26039. scope.viewModel.set(reference + '.theid3', null);
  26040. }
  26041. if (store) {
  26042. store.on({
  26043. add: function (store, records, index, eOpts) {
  26044. me._raiseChange(store, 'add');
  26045. },
  26046. remove: function (store, records, index, isMove, eOpts) {
  26047. me._raiseChange(store, 'remove');
  26048. },
  26049. datachanged: function (sender, opt) {
  26050. me._raiseChange(store, 'datachanged');
  26051. }
  26052. });
  26053. }
  26054. },
  26055. _raiseChange: function (store, type) {
  26056. var _a, _b;
  26057. var reference = this.reference;
  26058. if (reference && store) {
  26059. var ischanged = false;
  26060. if (store.getModifiedRecords().length > 0 ||
  26061. store.getNewRecords().length > 0 ||
  26062. store.getRemovedRecords().length > 0) {
  26063. ischanged = true;
  26064. }
  26065. else {
  26066. ischanged = false;
  26067. }
  26068. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  26069. }
  26070. },
  26071. /**
  26072. * 轻量级刷新
  26073. */
  26074. refreshData: function () {
  26075. var store = this.getStore();
  26076. if (store) {
  26077. store.reload();
  26078. }
  26079. },
  26080. /**
  26081. * 为表格强制设置焦点
  26082. * @param seq 顺序号
  26083. */
  26084. focusRow: function (seq) {
  26085. this.setSelection(this.store.getAt(seq));
  26086. this.getView().focusRow(seq);
  26087. },
  26088. /**
  26089. * 重新载入数据(重新计算参数)
  26090. */
  26091. reload: function (reloadParams) {
  26092. if (reloadParams === void 0) { reloadParams = {}; }
  26093. var me = this;
  26094. var config = me.config;
  26095. if (config.dataSourceCallbackFn) {
  26096. // 函数请求刷新
  26097. var scope_1 = lookupScope(this);
  26098. _$2.defer(function () {
  26099. me.setLoading(true);
  26100. });
  26101. config.dataSourceCallbackFn.call(scope_1, me, {
  26102. successCallback: function (value) {
  26103. me._setDataReal(value);
  26104. _$2.defer(function () {
  26105. me.setLoading(false);
  26106. });
  26107. // 自动选中第一行
  26108. var data = me.getStore().data;
  26109. if (data.length > 0) {
  26110. me.setSelection(data.items[0]);
  26111. }
  26112. me.fireEvent('dataLoadComplete', me, true, value);
  26113. },
  26114. failCallback: function (error) {
  26115. _$2.defer(function () {
  26116. me.setLoading(false);
  26117. });
  26118. me.fireEvent('dataLoadComplete', me, false, error);
  26119. }
  26120. });
  26121. return;
  26122. }
  26123. // if (this.store) {
  26124. // this.store.reload({aaaa: 1, bbbb: 2})
  26125. // }
  26126. var dataSource = config.dataSource;
  26127. var scope = lookupScope(me);
  26128. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  26129. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  26130. }
  26131. },
  26132. exportCurrentExcelClick: function () {
  26133. var _a;
  26134. var me = this;
  26135. var config = me.config;
  26136. var scope = lookupScope(me);
  26137. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26138. if (excelFileName.endsWith(".xlsx")) {
  26139. excelFileName = excelFileName.split(".xlsx")[0];
  26140. }
  26141. excelFileName += ".xlsx";
  26142. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  26143. var excelData = me.makeExcelData(rowsAll);
  26144. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  26145. },
  26146. exportExcelClick: function (excelExportParams) {
  26147. var me = this;
  26148. var config = me.config;
  26149. excelExportParams.isExcelExport = true;
  26150. var scope = lookupScope(me);
  26151. var dataSource = config.dataSource;
  26152. scope.setLoading(true);
  26153. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26154. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  26155. var _a, _b, _c, _d;
  26156. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  26157. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  26158. 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;
  26159. me.exportExcelCurrentPage = page;
  26160. me.exportExcelPageSize = size;
  26161. me.exportExcelTotal = total;
  26162. if (excelFileName.endsWith(".xlsx")) {
  26163. excelFileName = excelFileName.split(".xlsx")[0];
  26164. }
  26165. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  26166. excelFileName += ".xlsx";
  26167. var excelData = me.makeExcelData(responseData.data);
  26168. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  26169. if (page < total / size) {
  26170. page++;
  26171. me.exportExcelCurrentPage = page;
  26172. }
  26173. scope.setLoading(false);
  26174. });
  26175. },
  26176. exportBigExcelClick: function () {
  26177. var _a;
  26178. var me = this;
  26179. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  26180. showErrorDialog('当前表格不支持大批量导出');
  26181. return;
  26182. }
  26183. var config = me.config;
  26184. var scope = lookupScope(me);
  26185. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26186. var head = [];
  26187. var dict = {};
  26188. _$2.forEach(me.columns, function (column) {
  26189. if (column.isHidden())
  26190. return;
  26191. if (!column.dataIndex)
  26192. return;
  26193. if (!column.text)
  26194. return;
  26195. head.push({ field: column.dataIndex, name: column.text });
  26196. if (column.dictForExcel) {
  26197. dict[column.dataIndex] = column.dictForExcel;
  26198. }
  26199. });
  26200. // 判断是否需要解密
  26201. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  26202. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  26203. me.dbInfo.password = hexToString(me.dbInfo.password);
  26204. me.dbInfo.username = hexToString(me.dbInfo.username);
  26205. }
  26206. scope.setLoading(true);
  26207. Ext.Ajax.request({
  26208. timeout: 15000,
  26209. url: window["EXPORT_DATA_HOST"],
  26210. method: "POST",
  26211. jsonData: {
  26212. file: excelFileName,
  26213. dbInfo: me.dbInfo,
  26214. exportDataSql: me.exportDataSql,
  26215. exportDataSqlParams: me.exportDataSqlParams,
  26216. head: head,
  26217. dict: dict,
  26218. },
  26219. }).then(function () {
  26220. scope.setLoading(false);
  26221. msg('请求成功');
  26222. }).catch(function () {
  26223. scope.setLoading(false);
  26224. showErrorDialog('请求失败,请确认是否已安装客户端');
  26225. });
  26226. },
  26227. makeExcelData: function (jsonData) {
  26228. var me = this;
  26229. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  26230. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  26231. return;
  26232. }
  26233. var data = [];
  26234. // 获取表格的列定义
  26235. var headerTextArr = [];
  26236. var headers = [];
  26237. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  26238. var header = me.headerCt.getGridColumns()[i];
  26239. if (!header.isHidden()) {
  26240. var textStr = _$2.trim(header.text);
  26241. var dataIndexStr = _$2.trim(header.dataIndex);
  26242. if (dataIndexStr) {
  26243. if (textStr === '') {
  26244. headerTextArr.push(dataIndexStr);
  26245. }
  26246. else {
  26247. headerTextArr.push(textStr);
  26248. }
  26249. headers.push(header);
  26250. }
  26251. }
  26252. }
  26253. if (headers.length === 0) {
  26254. return;
  26255. }
  26256. data.push(headerTextArr);
  26257. for (var i = 0; i < jsonData.length; i++) {
  26258. var dataRow = jsonData[i];
  26259. var row = [];
  26260. for (var j = 0; j < headers.length; j++) {
  26261. var key = headers[j].dataIndex;
  26262. var value = dataRow[key];
  26263. if (!value && value !== 0) {
  26264. value = '';
  26265. }
  26266. var oValue = value;
  26267. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  26268. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  26269. try {
  26270. value = headers[j].renderer(value);
  26271. if (!value && value !== 0) {
  26272. value = oValue;
  26273. }
  26274. }
  26275. catch (e) {
  26276. value = oValue;
  26277. }
  26278. }
  26279. row.push(value);
  26280. }
  26281. data.push(row);
  26282. }
  26283. return data;
  26284. },
  26285. initComponent: function () {
  26286. var _this = this;
  26287. var _a;
  26288. var me = this;
  26289. var config = me.config;
  26290. var scope = lookupScope(this);
  26291. if (isDesignMode(scope, config)) {
  26292. this.superclass.initComponent.call(this);
  26293. return;
  26294. }
  26295. // 转换 dataSource 属性
  26296. convertDataSource$1(me, scope, config);
  26297. this.on({
  26298. afterrender: function (sender) {
  26299. var me = this;
  26300. var config = this.config;
  26301. var dataSource = config.dataSource;
  26302. if (config.autoLoad) {
  26303. if (config.dataSourceCallbackFn) {
  26304. me.reload();
  26305. }
  26306. else if (_$2.isPlainObject(dataSource)) {
  26307. me.reload();
  26308. }
  26309. }
  26310. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  26311. var vm = this.lookupViewModel();
  26312. this.contextMenu = this.add(new Ext.menu.Menu({
  26313. viewModel: vm,
  26314. items: _$2.map(config.tbar, function (item) {
  26315. var menuItem = __assign({}, item);
  26316. if (menuItem.xtype === 'button') {
  26317. delete menuItem.xtype;
  26318. }
  26319. return menuItem;
  26320. })
  26321. }));
  26322. }
  26323. else if (_$2.isPlainObject(config.contextMenu)) {
  26324. this.contextMenu = this.add(config.contextMenu);
  26325. }
  26326. var $dom = $(sender.el.dom);
  26327. $dom.on('keydown', function (e) {
  26328. me.fireEvent('keydown', me, e);
  26329. }).on('keyup', function (e) {
  26330. me.fireEvent('keyup', me, e);
  26331. });
  26332. // 默认显示提示
  26333. if (this.cellTip) {
  26334. this.tip = Ext.create('Ext.tip.ToolTip', {
  26335. target: this.el,
  26336. delegate: '.x-grid-cell-inner',
  26337. trackMouse: true,
  26338. ancor: 'top',
  26339. style: 'background-color: #0D6EFD;',
  26340. listeners: {
  26341. beforeshow: function (tip) {
  26342. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  26343. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  26344. return false;
  26345. }
  26346. tip.update(tipText);
  26347. }
  26348. }
  26349. });
  26350. }
  26351. },
  26352. itemcontextmenu: function (view, rec, node, index, e) {
  26353. if (this.contextMenu) {
  26354. e.stopEvent();
  26355. this.contextMenu.show().setLocalXY(e.getXY());
  26356. return false;
  26357. }
  26358. },
  26359. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  26360. // this.setColumnConfigCache()
  26361. // },
  26362. // columnhide(sender, column, eOpts) {
  26363. // this.setColumnConfigCache()
  26364. // },
  26365. // columnshow(sender, column, eOpts) {
  26366. // this.setColumnConfigCache()
  26367. // },
  26368. // columnresize(sender, column, width, eOpts) {
  26369. // this.setColumnConfigCache()
  26370. // },
  26371. destory: function () {
  26372. },
  26373. selectionchange: function (sender, param) {
  26374. var record = undefined;
  26375. if (_$2.isArray(param)) {
  26376. record = param[0];
  26377. }
  26378. else if (_$2.isObject(param)) {
  26379. record = _$2.get(param, 'endCell.record');
  26380. }
  26381. itemselectFun(this, sender, record);
  26382. },
  26383. itemclick: function (sender, record) {
  26384. itemselectFun(this, sender, record);
  26385. },
  26386. show: function (sender) {
  26387. if (sender.__suspendReload) {
  26388. sender.__suspendReload = false;
  26389. sender.reload();
  26390. }
  26391. }
  26392. });
  26393. _$2.defer(function () {
  26394. var ce = _this.findPlugin('cellediting');
  26395. ce.on({
  26396. beforeedit: function (editor, context, eOpts) {
  26397. me.fireEvent('editbefore', me, editor, context, eOpts);
  26398. },
  26399. canceledit: function (editor, context, eOpts) {
  26400. me.fireEvent('editcancel', me, editor, context, eOpts);
  26401. },
  26402. edit: function (editor, context, eOpts) {
  26403. me.fireEvent('editfinish', me, editor, context, eOpts);
  26404. },
  26405. validateedit: function (editor, context, eOpts) {
  26406. me.fireEvent('editvalidate', me, editor, context, eOpts);
  26407. },
  26408. });
  26409. });
  26410. var itemselectFun = _$2.debounce(function (me, sender, record) {
  26411. var reference = me.reference;
  26412. var scope = lookupScope(me);
  26413. var theid = _$2.get(config, 'behavior.theid');
  26414. if (theid && reference) {
  26415. if (!record) {
  26416. scope.viewModel.set(reference + '.theid', null);
  26417. }
  26418. else {
  26419. scope.viewModel.set(reference + '.theid', record.get(theid));
  26420. }
  26421. }
  26422. var theid2 = _$2.get(config, 'behavior.theid2');
  26423. if (theid2 && reference) {
  26424. if (!record) {
  26425. scope.viewModel.set(reference + '.theid2', null);
  26426. }
  26427. else {
  26428. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  26429. }
  26430. }
  26431. var theid3 = _$2.get(config, 'behavior.theid3');
  26432. if (theid3 && reference) {
  26433. if (!record) {
  26434. scope.viewModel.set(reference + '.theid3', null);
  26435. }
  26436. else {
  26437. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  26438. }
  26439. }
  26440. me.fireEvent('itemselect', sender, record);
  26441. }, 50);
  26442. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  26443. // 为 stores.proxy.buildRequest 做准备
  26444. this.store.proxy.$owner = this;
  26445. }
  26446. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  26447. if (selectToReload) {
  26448. // 点击后触发某个目标表格刷新
  26449. this.on({
  26450. itemselect: function (sender) {
  26451. if (_$2.isArray(selectToReload)) {
  26452. _$2.forEach(selectToReload, function (ref) {
  26453. if (ref) {
  26454. var ctlTarget = scope.refs[ref];
  26455. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26456. if (ctlTarget.isVisible()) {
  26457. ctlTarget.reload();
  26458. }
  26459. else {
  26460. ctlTarget.__suspendReload = true;
  26461. }
  26462. }
  26463. }
  26464. });
  26465. }
  26466. else if (_$2.isString(selectToReload)) {
  26467. var ctlTarget = scope.refs[selectToReload];
  26468. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26469. ctlTarget.reload();
  26470. }
  26471. }
  26472. }
  26473. });
  26474. }
  26475. this.superclass.initComponent.call(this);
  26476. },
  26477. // 生成列自定义的缓存key
  26478. makeColumnConfigCacheKey: function (config) {
  26479. var _a, _b, _c, _d, _e, _f;
  26480. 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);
  26481. var key = "gridColumnCache-" + scope.scopeKey + "-";
  26482. if (config.reference) {
  26483. key += config.reference;
  26484. }
  26485. else {
  26486. var subKey = "";
  26487. for (var i = 0; i < config.columns.length; i++) {
  26488. var column = config.columns[i];
  26489. if (column.dataIndex) {
  26490. subKey += column.dataIndex;
  26491. }
  26492. }
  26493. key += subKey;
  26494. }
  26495. return key;
  26496. },
  26497. getColumnConfigCache: function () {
  26498. var key = this.columnConfigCacheKey;
  26499. var dataStr = localStorage.getItem(key);
  26500. if (dataStr) {
  26501. return JSON.parse(dataStr);
  26502. }
  26503. return "";
  26504. },
  26505. setColumnConfigCache: function () {
  26506. var key = this.columnConfigCacheKey;
  26507. var cacheData = [];
  26508. var columns = this.headerCt.getGridColumns();
  26509. var index = 0;
  26510. for (var i = 0; i < columns.length; i++) {
  26511. var column = columns[i];
  26512. if (column.dataIndex) {
  26513. cacheData.push({
  26514. dataIndex: column.dataIndex,
  26515. width: column.width,
  26516. hidden: column.hidden,
  26517. locked: column.locked,
  26518. index: index
  26519. });
  26520. index++;
  26521. }
  26522. }
  26523. localStorage.setItem(key, JSON.stringify(cacheData));
  26524. },
  26525. autoSizeColumns: function (sender) {
  26526. var grid = sender ? sender.up('grid') : this;
  26527. // const columns = grid.columns;
  26528. // for (let i = 0; i < columns.length; i++) {
  26529. // const column = columns[i];
  26530. // grid.getView().autoSizeColumn(column);
  26531. // column.setWidth(column.getWidth() + 5);
  26532. // }
  26533. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26534. grid.headerCt.getGridColumns()[i].autoSize(i);
  26535. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26536. }
  26537. },
  26538. clearFilter: function (sender) {
  26539. var grid = sender.up('grid');
  26540. grid.filters.clearFilters();
  26541. grid.getStore().sorters.removeAll();
  26542. // grid.getStore().reload()
  26543. },
  26544. saveGridUIConfig: function (sender) {
  26545. var grid = sender.up('grid');
  26546. grid.setColumnConfigCache();
  26547. msg('保存设置成功!');
  26548. },
  26549. clearGridUIConfig: function (sender) {
  26550. var grid = sender.up('grid');
  26551. var key = grid.columnConfigCacheKey;
  26552. localStorage.setItem(key, "");
  26553. msg('清空设置成功,重新打开后生效!');
  26554. },
  26555. setLoading: function (value) {
  26556. if (value) {
  26557. this.mask('读取中');
  26558. }
  26559. else {
  26560. this.unmask();
  26561. }
  26562. },
  26563. exportExcel: function (sender) {
  26564. var rect = sender.btnEl.dom.getBoundingClientRect();
  26565. var scope = lookupScope(this);
  26566. var grid = sender.up('grid');
  26567. var treeMenu = new Ext.menu.Menu({
  26568. xtype: 'menu',
  26569. floated: false,
  26570. width: 300,
  26571. docked: 'left',
  26572. items: [
  26573. {
  26574. text: '大批量导出 (需要客户端支持!)',
  26575. iconCls: 'x-fa fa-download',
  26576. listeners: {
  26577. click: function (sender, value) {
  26578. // @ts-ignore
  26579. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  26580. .then(function (res) {
  26581. grid.exportBigExcelClick();
  26582. });
  26583. }
  26584. }
  26585. },
  26586. '-',
  26587. {
  26588. text: '导出当前数据',
  26589. iconCls: 'x-fa fa-download',
  26590. listeners: {
  26591. click: function (sender, value) {
  26592. grid.exportCurrentExcelClick();
  26593. }
  26594. }
  26595. },
  26596. {
  26597. xtype: "textfield",
  26598. fieldLabel: '当前导出页',
  26599. maskRe: /[0-9]/,
  26600. value: grid.exportExcelCurrentPage,
  26601. listeners: {
  26602. render: function (sender) {
  26603. grid.exportExcelCurrentPageCmp = sender;
  26604. },
  26605. change: function (sender, value) {
  26606. var v = parseInt(value);
  26607. if (isNaN(v) || v === 0) {
  26608. window['system'].msg("页码不能为0");
  26609. v = 1;
  26610. sender.setValue(v);
  26611. }
  26612. var size = parseInt(grid.exportExcelPageSize);
  26613. var total = parseInt(grid.exportExcelTotal);
  26614. if (v > total / size) {
  26615. v = parseInt(total / size + "");
  26616. }
  26617. grid.exportExcelCurrentPage = v + "";
  26618. }
  26619. }
  26620. },
  26621. {
  26622. xtype: "textfield",
  26623. fieldLabel: '导出页大小',
  26624. maskRe: /[0-9]/,
  26625. value: grid.exportExcelPageSize,
  26626. listeners: {
  26627. render: function (sender) {
  26628. grid.exportExcelPageSizeCmp = sender;
  26629. },
  26630. change: function (sender, value) {
  26631. var v = parseInt(value);
  26632. if (isNaN(v) || v === 0) {
  26633. window['system'].msg("导出页大小不能为0");
  26634. v = defaultGrid.exportExcelPageSize;
  26635. sender.setValue(v);
  26636. }
  26637. if (v > 10000) {
  26638. window['system'].msg("导出页大小不能大于10000");
  26639. v = 10000;
  26640. sender.setValue(v);
  26641. }
  26642. var page = parseInt(grid.exportExcelCurrentPage);
  26643. var total = parseInt(grid.exportExcelTotal);
  26644. if (page > total / v) {
  26645. page = parseInt(total / v + "") + 1;
  26646. grid.exportExcelCurrentPageCmp.setValue(page);
  26647. }
  26648. grid.exportExcelPageSize = v + "";
  26649. }
  26650. }
  26651. },
  26652. {
  26653. xtype: "textfield",
  26654. fieldLabel: '总条数',
  26655. value: grid.exportExcelTotal,
  26656. readOnly: true
  26657. },
  26658. {
  26659. text: '导出',
  26660. iconCls: 'x-fa fa-download',
  26661. listeners: {
  26662. click: function (sender, value) {
  26663. grid.exportExcelClick({
  26664. exportExcelPageSize: grid.exportExcelPageSize,
  26665. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26666. });
  26667. }
  26668. }
  26669. },
  26670. ]
  26671. });
  26672. treeMenu.showAt(rect.left, rect.top - 120);
  26673. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26674. // grid.headerCt.getGridColumns()[i].autoSize(i);
  26675. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26676. // }
  26677. },
  26678. /**
  26679. * 获取表格编辑的行数据
  26680. */
  26681. getGridEditRows: function () {
  26682. var grid = this;
  26683. var store = grid.getStore();
  26684. var rows = [];
  26685. var modifyRows = [];
  26686. var newRows = [];
  26687. var err = "";
  26688. var records = store.getModifiedRecords();
  26689. var newRecords = store.getNewRecords();
  26690. var removeRecords = [];
  26691. _$2.forEach(store.getRemovedRecords(), function (row) {
  26692. removeRecords.push(row.data);
  26693. });
  26694. _$2.forEach(records, function (record) {
  26695. var colums = grid.columns;
  26696. var errFunc = undefined;
  26697. _$2.forEach(colums, function (col) {
  26698. var name = col.dataIndex;
  26699. var value = record.data[name];
  26700. var colIndex = col.getIndex(); //获得列号
  26701. var rowIndex = store.indexOfId(record.id); //获得行号
  26702. var editor = col.getEditor(); //使用的编辑器
  26703. var tmpErrFunc = function () {
  26704. var text = col.text || col.name;
  26705. msg(text + ' 校验失败, 请确保输入的数据正确');
  26706. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  26707. };
  26708. if (editor && !editor.allowBlank && isEmpty(value)) {
  26709. errFunc = tmpErrFunc;
  26710. return false;
  26711. }
  26712. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  26713. errFunc = tmpErrFunc;
  26714. return false;
  26715. }
  26716. });
  26717. if (typeof errFunc === 'function') {
  26718. err = "1";
  26719. _$2.remove(rows, function (n) {
  26720. return true;
  26721. });
  26722. //@ts-ignore
  26723. errFunc();
  26724. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  26725. return false;
  26726. }
  26727. else {
  26728. if (_$2.findIndex(newRecords, function (item) {
  26729. return item === record;
  26730. }) >= 0) {
  26731. newRows.push(record.data);
  26732. }
  26733. else {
  26734. modifyRows.push(record.data);
  26735. }
  26736. rows.push(record.data);
  26737. }
  26738. });
  26739. return {
  26740. rows: rows,
  26741. newRows: newRows,
  26742. modifyRows: modifyRows,
  26743. removeRecords: removeRecords,
  26744. err: err
  26745. };
  26746. }
  26747. // reload() {
  26748. // dataSourceReload(this)
  26749. // },
  26750. });
  26751. }
  26752. /**
  26753. * 获取 columns 中所有的 dataIndex
  26754. */
  26755. function getFileds(newConfig) {
  26756. var fields = [];
  26757. _$2.forEach(newConfig.columns, function (c) {
  26758. if (c.dataIndex) {
  26759. fields.push(c.dataIndex);
  26760. }
  26761. });
  26762. return fields;
  26763. }
  26764. function convertDataSource$1(sender, scope, newConfig) {
  26765. if (typeof newConfig.store !== 'undefined') {
  26766. // 有 store 属性的情况下,不做任何事
  26767. return;
  26768. }
  26769. if (typeof newConfig.dataSource === 'undefined') {
  26770. // 没有定义 dataSource 的情况下,不做任何事
  26771. return;
  26772. }
  26773. if (_$2.isArray(newConfig.data)) {
  26774. // 有 data 属性赋值的情况下
  26775. newConfig.store = {
  26776. fields: getFileds(newConfig),
  26777. data: newConfig.data
  26778. };
  26779. delete newConfig.data;
  26780. return;
  26781. }
  26782. var dataSource = newConfig.dataSource;
  26783. if (typeof dataSource === 'string') {
  26784. // dataSource 是字符串的情况下,找到成员函数
  26785. dataSource = lookupFn(scope, dataSource);
  26786. }
  26787. if (typeof dataSource === 'function') {
  26788. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  26789. newConfig.store = new Ext.data.Store({
  26790. fields: getFileds(newConfig),
  26791. // data: [],
  26792. autoLoad: true,
  26793. proxy: {
  26794. type: 'memory',
  26795. data: [],
  26796. }
  26797. });
  26798. newConfig.dataSourceCallbackFn = dataSource;
  26799. return;
  26800. }
  26801. // throw new TypeError('无法识别的调用方法')
  26802. }
  26803. //# sourceMappingURL=grid.js.map
  26804. function initTextfield () {
  26805. var cc = Ext.form.field.Text.prototype.constructor;
  26806. var initComponent = Ext.form.field.Text.prototype.initComponent;
  26807. Ext.form.field.Text.override({
  26808. constructor: function (config) {
  26809. var newConfig = _$2.defaultsDeep({
  26810. // 强制属性
  26811. triggers: {
  26812. clear: {
  26813. weight: -1,
  26814. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  26815. hidden: true,
  26816. handler: 'onClearClick',
  26817. },
  26818. }
  26819. }, baseConfig(config, 'col-item'), config, text);
  26820. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26821. newConfig.enableKeyEvents = true;
  26822. }
  26823. cc.call(this, newConfig);
  26824. },
  26825. /**
  26826. * 清空所有值
  26827. */
  26828. onClearClick: function (sender, e) {
  26829. var me = this;
  26830. me.setValue('');
  26831. },
  26832. /**
  26833. * 尝试获取下一个要获取焦点的控件
  26834. */
  26835. _raiseNextFocus: function (sender) {
  26836. var config = sender.config;
  26837. var scope = lookupScope(sender);
  26838. if (typeof config.nextFocus === 'function') {
  26839. config.nextFocus(sender);
  26840. }
  26841. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  26842. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  26843. var fn = lookupFn(scope, config.nextFocus);
  26844. if (typeof fn === 'function') {
  26845. var nextCtlReference = fn(sender);
  26846. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  26847. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  26848. if (ctl) {
  26849. if (typeof ctl.focus2 === 'function') {
  26850. ctl.focus2();
  26851. }
  26852. else {
  26853. ctl.focus();
  26854. }
  26855. }
  26856. }
  26857. }
  26858. }
  26859. else {
  26860. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  26861. if (ctl) {
  26862. if (typeof ctl.focus2 === 'function') {
  26863. ctl.focus2();
  26864. }
  26865. else {
  26866. ctl.focus();
  26867. }
  26868. }
  26869. }
  26870. }
  26871. },
  26872. initComponent: function () {
  26873. /**
  26874. * 改变必填项之前加星号
  26875. */
  26876. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  26877. // this.beforeLabelTextTpl = [
  26878. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26879. // ];
  26880. this.afterLabelTextTpl = [
  26881. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26882. ];
  26883. }
  26884. var me = this;
  26885. this.on({
  26886. change: function (sender, newVal) {
  26887. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  26888. if (hideTrigger || disabled || readOnly || hideClear) {
  26889. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  26890. return;
  26891. }
  26892. var value = newVal;
  26893. if (value) {
  26894. me.getTrigger('clear').show();
  26895. me.updateLayout();
  26896. }
  26897. else {
  26898. me.getTrigger('clear').hide();
  26899. me.updateLayout();
  26900. }
  26901. },
  26902. afterrender: function (sender) {
  26903. var _this = this;
  26904. var _a;
  26905. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  26906. sender.inputEl.dom.setAttribute('spellcheck', "false");
  26907. $$2(sender.inputEl.dom).on('click', function (e) {
  26908. sender.fireEvent('click', _this, e);
  26909. });
  26910. $$2(sender.inputEl.dom).on('keydown', function (e) {
  26911. var _a, _b, _c, _d;
  26912. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  26913. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  26914. if (sender.isExpanded === true) {
  26915. // 弹开下拉框的基础上,不干预上下选择
  26916. return;
  26917. }
  26918. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  26919. var grid = sender.ownerCt.up('grid');
  26920. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  26921. if (editingPlugin) {
  26922. 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;
  26923. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  26924. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  26925. // editingPlugin
  26926. var targetRecord = void 0;
  26927. if (e.code === 'ArrowDown') {
  26928. targetRecord = grid.store.data.getAt(rowIdx + 1);
  26929. }
  26930. else {
  26931. targetRecord = grid.store.data.getAt(rowIdx - 1);
  26932. }
  26933. if (targetRecord) {
  26934. grid.setSelection([targetRecord]);
  26935. editingPlugin.startEdit(targetRecord, column);
  26936. }
  26937. e.stopPropagation();
  26938. e.preventDefault();
  26939. }
  26940. }
  26941. }
  26942. }
  26943. });
  26944. }
  26945. var config = sender.config;
  26946. if (config.ff && config.ff > 0) {
  26947. setTimeout(function () {
  26948. if (typeof sender.focus2 === 'function') {
  26949. sender.focus2();
  26950. }
  26951. else {
  26952. sender.focus();
  26953. }
  26954. }, config.ff);
  26955. }
  26956. }
  26957. });
  26958. var config = this.config;
  26959. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26960. this.on({
  26961. keyup: function (sender, e) {
  26962. if ([10, 13, 20, 40].includes(e.keyCode)) {
  26963. sender._raiseNextFocus(sender);
  26964. }
  26965. }
  26966. });
  26967. }
  26968. var that = this;
  26969. this.on({
  26970. keyup: function (sender, e, eOpts) {
  26971. if (![10, 13, 20, 40].includes(e.keyCode)) {
  26972. return;
  26973. }
  26974. that.keydown_fun_item(sender, e, eOpts);
  26975. }
  26976. });
  26977. initComponent.call(this);
  26978. },
  26979. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  26980. var that = sender;
  26981. if ([10, 13, 20, 40].includes(event.keyCode)) {
  26982. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  26983. var value = _$2.trim(sender.rawValue);
  26984. var r = that.fireEvent('scancode', that, value, event);
  26985. if (r === 'OK') {
  26986. // 停止事件的默认处理程序,停止事件的冒泡
  26987. // event.stopEvent();
  26988. event.preventDefault();
  26989. event.stopPropagation();
  26990. }
  26991. }
  26992. }, 100)
  26993. });
  26994. }
  26995. //# sourceMappingURL=textfield.js.map
  26996. function initTbFill () {
  26997. /**
  26998. *
  26999. */
  27000. var ct = Ext.toolbar.Fill.prototype.constructor;
  27001. Ext.toolbar.Fill.override({
  27002. constructor: function (config) {
  27003. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  27004. ct.call(this, newConfig);
  27005. }
  27006. });
  27007. }
  27008. //# sourceMappingURL=tbfill.js.map
  27009. function initTbSeparator () {
  27010. /**
  27011. *
  27012. */
  27013. var ct = Ext.toolbar.Separator.prototype.constructor;
  27014. Ext.toolbar.Separator.override({
  27015. constructor: function (config) {
  27016. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  27017. ct.call(this, newConfig);
  27018. }
  27019. });
  27020. }
  27021. //# sourceMappingURL=tbseparator.js.map
  27022. function initToolbar () {
  27023. /**
  27024. *
  27025. */
  27026. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  27027. Ext.toolbar.Toolbar.override({
  27028. constructor: function (config) {
  27029. var newConfig = _$2.defaultsDeep({
  27030. // 强制性属性
  27031. }, baseConfig(config, 'cols-container'), config, toolbar);
  27032. ct.call(this, newConfig);
  27033. }
  27034. });
  27035. initTbFill();
  27036. initTbSeparator();
  27037. }
  27038. //# sourceMappingURL=toolbar.js.map
  27039. function initSplitter () {
  27040. var ct = Ext.resizer.Splitter.prototype.constructor;
  27041. Ext.resizer.Splitter.override({
  27042. constructor: function (config) {
  27043. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  27044. ct.call(this, newConfig);
  27045. }
  27046. });
  27047. }
  27048. //# sourceMappingURL=splitter.js.map
  27049. /**
  27050. * 通用 dataSource 解析,
  27051. * Tree/Combo/Grid/PageList ... 都会从这里解析
  27052. */
  27053. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  27054. var config = ctl.config;
  27055. return new Promise(function (resolve, reject) {
  27056. if (!config.dataSource) {
  27057. // 没有设置数据源,直接置空
  27058. return Promise.resolve();
  27059. }
  27060. var option = {
  27061. extraParam: extraParam,
  27062. _successCb: _successCb,
  27063. successCallback: function (value) {
  27064. if (typeof successCallback === "function") {
  27065. successCallback(value);
  27066. }
  27067. else {
  27068. ctl.setData(value);
  27069. }
  27070. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  27071. ctl.setLoading(false);
  27072. resolve(value);
  27073. },
  27074. failCallback: function (error) {
  27075. if (typeof failCallback === "function") {
  27076. failCallback(error);
  27077. }
  27078. ctl.fireEvent('dataLoadComplete', ctl, false);
  27079. ctl.setLoading(false);
  27080. reject(error);
  27081. }
  27082. };
  27083. // 请求前要求确认一下
  27084. var isCanceled = false;
  27085. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  27086. isCanceled = true;
  27087. } }, option));
  27088. if (!isCanceled) {
  27089. // 请求没有被取消
  27090. // 调用异步接口返回 Promise
  27091. return _innerReload(ctl, option);
  27092. }
  27093. return reject();
  27094. });
  27095. }
  27096. function _innerReload(ctl, option) {
  27097. var config = ctl.config;
  27098. ctl.setLoading(true);
  27099. var scope = lookupScope(ctl);
  27100. var dataSource = config.dataSource;
  27101. if (typeof dataSource == 'string') {
  27102. dataSource = lookupFn(scope, config.dataSource);
  27103. }
  27104. if (typeof dataSource === 'function') {
  27105. // @ts-ignore
  27106. dataSource.call(scope, ctl, option);
  27107. return;
  27108. }
  27109. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27110. if (!ajax.func) {
  27111. console.error("没有配置 ajax");
  27112. return;
  27113. }
  27114. var params_1 = {};
  27115. var sortModel = null;
  27116. var filterModel = null;
  27117. if (option.extraParam && option.extraParam.filterModel) {
  27118. filterModel = option.extraParam.filterModel;
  27119. }
  27120. if (option.extraParam && option.extraParam.sortModel) {
  27121. sortModel = option.extraParam.sortModel;
  27122. }
  27123. _$2.forOwn(option.extraParam, function (v, key) {
  27124. if (key != "filterModel" && key != "sortModel") {
  27125. if (typeof v === 'function') {
  27126. params_1[key] = v();
  27127. }
  27128. else {
  27129. params_1[key] = v;
  27130. }
  27131. }
  27132. });
  27133. var ds = dataSource;
  27134. _$2.forOwn(ds.params, function (v, key) {
  27135. if (typeof v === 'function') {
  27136. params_1[key] = v();
  27137. }
  27138. else {
  27139. params_1[key] = v;
  27140. }
  27141. });
  27142. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  27143. // @ts-ignore
  27144. ajax.func({
  27145. method: dataSource.method,
  27146. url: ds.url,
  27147. data: params_1,
  27148. filterModel: filterModel,
  27149. sortModel: sortModel,
  27150. }).then(function (res) {
  27151. if (res.success) {
  27152. option.successCallback(res.data);
  27153. }
  27154. else {
  27155. option.failCallback(res.msg);
  27156. }
  27157. }).catch(function (e) {
  27158. option.failCallback(e);
  27159. });
  27160. }
  27161. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27162. var ds_1 = ctl.dataSource;
  27163. // @ts-ignore
  27164. Extend.ajax.func({
  27165. url: ds_1.sqlId,
  27166. data: params_1,
  27167. db: ds_1.db,
  27168. method: 'sql',
  27169. filterModel: filterModel,
  27170. sortModel: sortModel,
  27171. }).then(function (res) {
  27172. if (res.success) {
  27173. option.successCallback(res.data);
  27174. }
  27175. else {
  27176. option.failCallback(res.msg);
  27177. }
  27178. }).catch(function (e) {
  27179. option.failCallback(e);
  27180. }).finally(function () {
  27181. ctl.loading = false;
  27182. });
  27183. return;
  27184. }
  27185. else {
  27186. console.error("非法的 dataSource", ctl.dataSource);
  27187. debugger;
  27188. throw new Error("非法的 dataSource");
  27189. }
  27190. }
  27191. }
  27192. //# sourceMappingURL=DataSourceHelper.js.map
  27193. function initCombo () {
  27194. var cc = Ext.form.field.ComboBox.prototype.constructor;
  27195. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27196. Ext.form.field.ComboBox.override({
  27197. constructor: function (config) {
  27198. var newConfig = _$2.defaultsDeep({
  27199. // 强制性属性
  27200. }, baseConfig(config, 'col-item'), config, combo);
  27201. if (typeof config.dict === 'string') {
  27202. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27203. }
  27204. else if (typeof newConfig.store == 'undefined') {
  27205. if (_$2.isArray(newConfig.data)) {
  27206. // ExtJS 无法直接接受数组模式
  27207. newConfig.store = {
  27208. fields: [newConfig.valueField, newConfig.displayField],
  27209. data: newConfig.data
  27210. };
  27211. delete newConfig.data;
  27212. }
  27213. else if (typeof newConfig.data !== 'object') {
  27214. newConfig.store = {
  27215. fields: [newConfig.valueField, newConfig.displayField],
  27216. data: []
  27217. };
  27218. delete newConfig.data;
  27219. }
  27220. }
  27221. cc.call(this, newConfig);
  27222. },
  27223. setDict: function (bizKey) {
  27224. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27225. this.dict = bizKey;
  27226. },
  27227. getDict: function () {
  27228. return this.dict;
  27229. },
  27230. setData: function (value) {
  27231. if (!value) {
  27232. return;
  27233. }
  27234. var config = value.config;
  27235. if (!this.store) {
  27236. this.store = new Ext.data.Store({
  27237. fields: [config.valueField, config.displayField],
  27238. data: value
  27239. });
  27240. }
  27241. else {
  27242. this.store.getProxy().setData(value);
  27243. this.store.load();
  27244. }
  27245. },
  27246. setLoading: function (value) {
  27247. if (value) {
  27248. if (!this.loadMask) {
  27249. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27250. }
  27251. }
  27252. else {
  27253. if (this.loadMask) {
  27254. this.loadMask.destroy();
  27255. delete this.loadMask;
  27256. }
  27257. }
  27258. },
  27259. reload: function () {
  27260. dataSourceReload(this);
  27261. },
  27262. initComponent: function () {
  27263. var that = this;
  27264. var toggle = function (e) {
  27265. var readOnly = that.readOnly, disabled = that.disabled;
  27266. if (readOnly || disabled) {
  27267. return;
  27268. }
  27269. if ($(e.target).is('.x-form-trigger')) {
  27270. return;
  27271. }
  27272. // 点击后下拉
  27273. if (that.isExpanded) {
  27274. that.collapse();
  27275. }
  27276. else {
  27277. that.expand();
  27278. that.doQuery(that.allQuery, true);
  27279. }
  27280. };
  27281. this.on({
  27282. afterrender: function (sender) {
  27283. var config = this.config;
  27284. if (config.dataSource && config.autoLoad) {
  27285. dataSourceReload(this);
  27286. }
  27287. // 点击后下拉
  27288. $(this.el.dom).on('click', toggle.bind(this));
  27289. },
  27290. focusenter: function (sender, event, opt) {
  27291. var _a;
  27292. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27293. // 表格内编辑框,获取焦点后自动弹开
  27294. toggle.call(this, event);
  27295. }
  27296. },
  27297. destory: function () {
  27298. $(this.el.dom).off('click', toggle.bind(this));
  27299. },
  27300. beforequery: function (context) {
  27301. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  27302. // console.log('beforequery', query)
  27303. if (!forceAll && query) {
  27304. combo.store.clearFilter();
  27305. combo.store.filterBy(function (record, id) {
  27306. var text = record.get(combo.displayField);
  27307. // 用拼音筛选的方式
  27308. return keywordFilter(query, text, id);
  27309. });
  27310. combo.expand();
  27311. return false;
  27312. }
  27313. combo.store.clearFilter();
  27314. combo.expand();
  27315. return false;
  27316. },
  27317. });
  27318. initComponent.call(this);
  27319. },
  27320. focus2: function () {
  27321. this.focus();
  27322. var that = this;
  27323. _$2.defer(function () {
  27324. if (that.isExpanded) {
  27325. that.collapse();
  27326. }
  27327. else {
  27328. that.expand();
  27329. that.doQuery(that.allQuery, true);
  27330. }
  27331. });
  27332. }
  27333. });
  27334. }
  27335. //# sourceMappingURL=combo.js.map
  27336. /**
  27337. xtype: 'tagfield',
  27338. displayField: 'show',
  27339. valueField: 'id',
  27340. queryMode: 'local',
  27341. filterPickList: true,
  27342. store: {
  27343. fields: ['id', 'show'],
  27344. data: [
  27345. {id: 0, show: 'Battlestar Galactica'},
  27346. {id: 1, show: 'Doctor Who'},
  27347. {id: 2, show: 'Farscape'},
  27348. {id: 3, show: 'Firefly'},
  27349. {id: 4, show: 'Star Trek'},
  27350. {id: 5, show: 'Star Wars: Christmas Special'}
  27351. ]
  27352. }
  27353. */
  27354. function initTag () {
  27355. var cc = Ext.form.field.Tag.prototype.constructor;
  27356. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27357. Ext.form.field.Tag.override({
  27358. constructor: function (config) {
  27359. var newConfig = _$2.defaultsDeep({
  27360. // 强制性属性
  27361. }, baseConfig(config, 'col-item'), config, tagfield);
  27362. if (typeof config.dict === 'string') {
  27363. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27364. }
  27365. else if (typeof newConfig.store == 'undefined') {
  27366. if (_$2.isArray(newConfig.data)) {
  27367. // ExtJS 无法直接接受数组模式
  27368. newConfig.store = {
  27369. fields: [newConfig.valueField, newConfig.displayField],
  27370. data: newConfig.data
  27371. };
  27372. delete newConfig.data;
  27373. }
  27374. else if (typeof newConfig.data !== 'object') {
  27375. newConfig.store = {
  27376. fields: [newConfig.valueField, newConfig.displayField],
  27377. data: []
  27378. };
  27379. delete newConfig.data;
  27380. }
  27381. }
  27382. cc.call(this, newConfig);
  27383. },
  27384. setDict: function (bizKey) {
  27385. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27386. this.dict = bizKey;
  27387. },
  27388. getDict: function () {
  27389. return this.dict;
  27390. },
  27391. setData: function (value) {
  27392. if (!value) {
  27393. return;
  27394. }
  27395. var config = value.config;
  27396. if (!this.store) {
  27397. this.store = new Ext.data.Store({
  27398. fields: [config.valueField, config.displayField],
  27399. data: value
  27400. });
  27401. }
  27402. else {
  27403. this.store.getProxy().setData(value);
  27404. this.store.load();
  27405. }
  27406. },
  27407. setLoading: function (value) {
  27408. if (value) {
  27409. if (!this.loadMask) {
  27410. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27411. }
  27412. }
  27413. else {
  27414. if (this.loadMask) {
  27415. this.loadMask.destroy();
  27416. delete this.loadMask;
  27417. }
  27418. }
  27419. },
  27420. reload: function () {
  27421. dataSourceReload(this);
  27422. },
  27423. initComponent: function () {
  27424. var that = this;
  27425. var toggle = function (e) {
  27426. var readOnly = that.readOnly, disabled = that.disabled;
  27427. if (readOnly || disabled) {
  27428. return;
  27429. }
  27430. if ($(e.target).is('.x-form-trigger')) {
  27431. return;
  27432. }
  27433. // 点击后下拉
  27434. if (that.isExpanded) {
  27435. that.collapse();
  27436. }
  27437. else {
  27438. that.expand();
  27439. that.doQuery(that.allQuery, true);
  27440. }
  27441. };
  27442. this.on({
  27443. afterrender: function (sender) {
  27444. var config = this.config;
  27445. if (config.dataSource && config.autoLoad) {
  27446. dataSourceReload(this);
  27447. }
  27448. // 点击后下拉
  27449. $(this.el.dom).on('click', toggle.bind(this));
  27450. },
  27451. focusenter: function (sender, event, opt) {
  27452. var _a;
  27453. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27454. // 表格内编辑框,获取焦点后自动弹开
  27455. toggle.call(this, event);
  27456. }
  27457. },
  27458. destory: function () {
  27459. $(this.el.dom).off('click', toggle.bind(this));
  27460. },
  27461. });
  27462. initComponent.call(this);
  27463. },
  27464. focus2: function () {
  27465. this.focus();
  27466. var that = this;
  27467. _$2.defer(function () {
  27468. if (that.isExpanded) {
  27469. that.collapse();
  27470. }
  27471. else {
  27472. that.expand();
  27473. that.doQuery(that.allQuery, true);
  27474. }
  27475. });
  27476. }
  27477. });
  27478. }
  27479. //# sourceMappingURL=tagfield.js.map
  27480. function initComboGridMulti () {
  27481. Ext.define('Yvan.LocalComboGrid', {
  27482. extend: 'Ext.form.field.Picker',
  27483. // extend: 'Yvan.PickerAlignCenter',
  27484. xtype: 'combogridmulti',
  27485. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  27486. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  27487. editable: false,
  27488. initComponent: function () {
  27489. this.on({
  27490. afterrender: function () {
  27491. var config = this.config;
  27492. if (config.dataSource && config.autoLoad) {
  27493. dataSourceReload(this);
  27494. }
  27495. },
  27496. });
  27497. this.superclass.initComponent.apply(this, arguments);
  27498. },
  27499. setStore: function (store) {
  27500. this.store = store;
  27501. var me = this;
  27502. if (me.store) {
  27503. if (me.picker) {
  27504. me.picker.setStore(store);
  27505. if (me.isExpanded) {
  27506. me.collapse();
  27507. delete me.picker;
  27508. me.expand();
  27509. }
  27510. }
  27511. this.onLoad();
  27512. me.mon(me.store, {
  27513. scope: me,
  27514. load: me.onLoad,
  27515. update: me.onUpdate
  27516. });
  27517. }
  27518. },
  27519. reload: function () {
  27520. dataSourceReload(this);
  27521. },
  27522. setData: function (value) {
  27523. var me = this;
  27524. var config = me.config;
  27525. if (!value) {
  27526. return;
  27527. }
  27528. if (!this.store) {
  27529. this.store = new Ext.data.Store({
  27530. fields: [config.valueField, config.displayField],
  27531. data: value
  27532. });
  27533. }
  27534. else {
  27535. this.store.getProxy().setData(value);
  27536. this.store.load();
  27537. }
  27538. this.onLoad();
  27539. },
  27540. createPicker: function () {
  27541. var me = this;
  27542. 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: {
  27543. scope: me,
  27544. selectionchange: me.onSelectionChange,
  27545. itemkeydown: me.onPickerKeyDown
  27546. } })), view = picker.getView();
  27547. if (Ext.isIE9 && Ext.isStrict) {
  27548. view.on({
  27549. scope: me,
  27550. highlightitem: me.repaintPickerView,
  27551. unhighlightitem: me.repaintPickerView,
  27552. afteritemexpand: me.repaintPickerView,
  27553. afteritemcollapse: me.repaintPickerView
  27554. });
  27555. }
  27556. return picker;
  27557. },
  27558. repaintPickerView: function () {
  27559. var style = this.picker.getView().getEl().dom.style;
  27560. style.display = style.display;
  27561. },
  27562. onSelectionChange: function (view, record, node, rowIndex, e) {
  27563. this.selectItem(view, record);
  27564. },
  27565. onPickerKeyDown: function (treeView, record, item, index, e) {
  27566. var key = e.getKey();
  27567. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  27568. this.selectItem(treeView, record);
  27569. }
  27570. },
  27571. selectItem: function (sender, record) {
  27572. var me = this;
  27573. var ids = [];
  27574. _$2.forEach(me.picker.getSelection(), function (record) {
  27575. ids.push(record.get(me.valueField));
  27576. });
  27577. me.fireEvent('select', me, record);
  27578. me.setValue(ids.join(me.splitChar));
  27579. // me.collapse();
  27580. },
  27581. onExpand: function () {
  27582. var me = this;
  27583. var picker = this.picker;
  27584. var value = this.value;
  27585. if (!me.store) {
  27586. msg('正在初始化数据,请稍后');
  27587. me.collapse();
  27588. return;
  27589. }
  27590. var vs = _$2.split(value, me.splitChar);
  27591. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  27592. picker.setSelection(records);
  27593. },
  27594. setValue: function (value) {
  27595. var me = this;
  27596. console.log('setValue', value);
  27597. me.value = value;
  27598. if (!me.store || me.store.loading) {
  27599. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  27600. return me.mixins.field.setValue.call(me, value);
  27601. // return me;
  27602. }
  27603. var vs = _$2.split(value, me.splitChar);
  27604. var displayValues = [];
  27605. _$2.forEach(vs, function (v) {
  27606. var _a;
  27607. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  27608. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  27609. if (dv) {
  27610. displayValues.push(dv);
  27611. }
  27612. else {
  27613. displayValues.push(v);
  27614. }
  27615. });
  27616. // set the raw value to the record's display field if a record was found
  27617. me.setRawValue(displayValues.join(me.splitChar));
  27618. return me.mixins.field.setValue.call(me, value);
  27619. },
  27620. getSubmitValue: function () {
  27621. return this.value;
  27622. },
  27623. getValue: function () {
  27624. return this.value;
  27625. },
  27626. onLoad: function () {
  27627. var value = this.value;
  27628. if (value) {
  27629. this.setValue(value);
  27630. }
  27631. },
  27632. onUpdate: function (store, rec, type, modifiedFieldNames) {
  27633. var display = this.displayField;
  27634. var me = this;
  27635. if (type === 'edit' && modifiedFieldNames &&
  27636. Ext.Array.contains(modifiedFieldNames, display) &&
  27637. this.value === rec.getId()) {
  27638. me.mixins.field.setValue.call(me, this.value);
  27639. this.setRawValue(rec.get(display));
  27640. }
  27641. }
  27642. });
  27643. }
  27644. //# sourceMappingURL=combogridmulti.js.map
  27645. function initSearch () {
  27646. Ext.define('Yvan.Search', {
  27647. extend: 'Ext.form.field.Text',
  27648. alias: 'widget.searchfield',
  27649. xtype: 'searchfield',
  27650. constructor: function (config) {
  27651. var self = this;
  27652. var newConfig = _$2.defaultsDeep({
  27653. // 强制性属性
  27654. triggers: {
  27655. clear: {
  27656. weight: 0,
  27657. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27658. hidden: true,
  27659. handler: 'onClearClick',
  27660. },
  27661. search: {
  27662. weight: 1,
  27663. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  27664. handler: 'onSearchClick'
  27665. },
  27666. },
  27667. listeners: {
  27668. blur: function (sender, e) {
  27669. this.revertOnblur();
  27670. },
  27671. specialkey: function (sender, e) {
  27672. var _a;
  27673. var me = this;
  27674. if (e.getKey() === e.ENTER) {
  27675. me.onSearchClick(sender, {}, e);
  27676. return;
  27677. }
  27678. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27679. },
  27680. afterrender: function (sender, e) {
  27681. var _a;
  27682. this.replaceRawInputEvent();
  27683. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27684. }
  27685. },
  27686. }, baseConfig(config, 'col-item'), config, search);
  27687. this.superclass.constructor.call(self, newConfig);
  27688. },
  27689. revertOnblur: function () {
  27690. this.setRawValue(this.lastValue);
  27691. },
  27692. onSearchClick: function (sender, vv, e) {
  27693. var me = this;
  27694. var config = me.config;
  27695. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  27696. if (e) {
  27697. e.preventDefault();
  27698. e.stopPropagation();
  27699. }
  27700. this.fireEvent('search', sender, e);
  27701. if (!widget) {
  27702. return;
  27703. }
  27704. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  27705. },
  27706. replaceRawInputEvent: function () {
  27707. var me = this;
  27708. var $dom = $(me.inputEl.dom);
  27709. $dom.on('input', function (e) {
  27710. stopEvent(e);
  27711. // console.log('has input', e)
  27712. });
  27713. $dom.on('keyup', function (e) {
  27714. if (e.key === "Enter") {
  27715. me.onSearchClick(me, {}, e);
  27716. return;
  27717. }
  27718. stopEvent(e);
  27719. });
  27720. $dom.on('change', function (e) {
  27721. stopEvent(e);
  27722. });
  27723. },
  27724. onChange: function (newVal, oldVal) {
  27725. var me = this;
  27726. var value = newVal;
  27727. if (value) {
  27728. me.getTrigger('clear').show();
  27729. me.updateLayout();
  27730. }
  27731. else {
  27732. me.getTrigger('clear').hide();
  27733. me.updateLayout();
  27734. }
  27735. },
  27736. /**
  27737. * 清空所有值
  27738. */
  27739. onClearClick: function (sender, e) {
  27740. var me = this;
  27741. var config = me.config;
  27742. var lookup = config.lookup;
  27743. me.setValue('');
  27744. clearViewModelByLookup(sender, lookup);
  27745. }
  27746. });
  27747. }
  27748. //# sourceMappingURL=search.js.map
  27749. function initMultipleSearch () {
  27750. Ext.define('Yvan.MultipleSearch', {
  27751. extend: 'Ext.form.field.Text',
  27752. xtype: 'multiplesearch',
  27753. bindTargert: '',
  27754. constructor: function (config) {
  27755. var _a, _b, _c, _d;
  27756. var self = this;
  27757. var newConfig = _$2.defaultsDeep({
  27758. // 强制性属性
  27759. triggers: {
  27760. clear: {
  27761. weight: 0,
  27762. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27763. hidden: true,
  27764. handler: 'onClearClick',
  27765. }
  27766. },
  27767. transformRawValue: function (o) {
  27768. return o;
  27769. },
  27770. listeners: {
  27771. specialkey: function (sender, e) {
  27772. var me = this;
  27773. if (e.getKey() === e.ENTER) {
  27774. me.fireEvent('search', me, e);
  27775. }
  27776. },
  27777. afterrender: function (sender, e) {
  27778. var _a;
  27779. this.replaceRawInputEvent();
  27780. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27781. }
  27782. },
  27783. }, baseConfig(config, 'col-item'), config, search);
  27784. this.superclass.constructor.call(self, newConfig);
  27785. 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 : '';
  27786. vv = _$2.replace(vv, "{", "");
  27787. vv = _$2.replace(vv, "}", "");
  27788. this.bindTargert = vv;
  27789. this.bindTargert = _$2.trim(this.bindTargert);
  27790. },
  27791. setBindValue: function (arrValue) {
  27792. if (this.bindTargert) {
  27793. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  27794. }
  27795. },
  27796. replaceRawInputEvent: function () {
  27797. var me = this;
  27798. var $dom = $(me.inputEl.dom);
  27799. $dom.on('input', function (e) {
  27800. var _a, _b, _c, _d, _e, _f;
  27801. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  27802. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  27803. if (!a.endsWith(",") && a.length > 0) {
  27804. e.currentTarget.value = a + ",";
  27805. }
  27806. else {
  27807. e.currentTarget.value = a;
  27808. }
  27809. }
  27810. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  27811. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  27812. _$2.remove(arr, function (it) {
  27813. return !it;
  27814. });
  27815. me.setBindValue(arr);
  27816. stopEvent(e);
  27817. });
  27818. $dom.on('keyup', function (e) {
  27819. me.fireEvent('keyup', me, e);
  27820. // invokeMethod(me.config.listeners?.keyup, me, e)
  27821. stopEvent(e);
  27822. });
  27823. $dom.on('keydown', function (e) {
  27824. me.fireEvent('keydown', me, e);
  27825. // invokeMethod(me.config.listeners?.keydown, me, e)
  27826. //stopEvent(e)
  27827. });
  27828. $dom.on('change', function (e) {
  27829. stopEvent(e);
  27830. });
  27831. $dom.on('paste', function (e) {
  27832. var _a;
  27833. // @ts-ignore
  27834. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  27835. var text = clipdata.getData("text/plain");
  27836. var spliter = ',';
  27837. text = text.replaceAll("\r", "");
  27838. text = text.replaceAll("\n", spliter);
  27839. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  27840. var arr = text.split(spliter);
  27841. if (arr && Array.isArray(arr)) {
  27842. for (var i = 0; i < arr.length; i++) {
  27843. arr[i] = _$2.trim(arr[i]);
  27844. }
  27845. }
  27846. _$2.remove(arr, function (it) {
  27847. return !it;
  27848. });
  27849. me.setBindValue(arr);
  27850. stopEvent(e);
  27851. });
  27852. },
  27853. onChange: function (newVal, oldVal) {
  27854. var me = this;
  27855. var value = newVal;
  27856. if (value) {
  27857. me.getTrigger('clear').show();
  27858. me.updateLayout();
  27859. }
  27860. else {
  27861. me.getTrigger('clear').hide();
  27862. me.updateLayout();
  27863. }
  27864. },
  27865. /**
  27866. * 清空所有值
  27867. */
  27868. onClearClick: function (sender, e) {
  27869. var me = this;
  27870. var config = me.config;
  27871. var lookup = config.lookup;
  27872. me.setValue('');
  27873. clearViewModelByLookup(sender, lookup);
  27874. }
  27875. });
  27876. }
  27877. //# sourceMappingURL=multiplesearch.js.map
  27878. function initDate () {
  27879. var cc = Ext.form.field.Date.prototype.constructor;
  27880. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  27881. Ext.form.field.Date.override({
  27882. format: 'Y-m-d',
  27883. altFormats: 'Y-m-d',
  27884. constructor: function (config) {
  27885. var newConfig = _$2.defaultsDeep({
  27886. // 强制属性
  27887. }, baseConfig(config, 'col-item'), config, date);
  27888. cc.call(this, newConfig);
  27889. },
  27890. getValue: function () {
  27891. var ov = getValue.call(this);
  27892. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  27893. // console.log('cc:', nv, ov)
  27894. return nv;
  27895. },
  27896. // focus2() {
  27897. // const that = this
  27898. // if (that.isExpanded) {
  27899. // that.collapse()
  27900. //
  27901. // } else {
  27902. // that.expand();
  27903. // }
  27904. // _.defer(() => {
  27905. // that.focus()
  27906. // })
  27907. // },
  27908. initComponent: function () {
  27909. this.on({
  27910. afterrender: function () {
  27911. var config = this.config;
  27912. // 日期框,不要默认弹出
  27913. // $(this.el.dom).on('click', toggle.bind(this))
  27914. },
  27915. destory: function () {
  27916. // 日期框,不要默认弹出
  27917. // $(this.el.dom).off('click', toggle.bind(this))
  27918. },
  27919. change: {
  27920. fn: function (sender) {
  27921. if (sender.format === 'Y-m-d') {
  27922. // 年月日格式
  27923. var value = sender.getRawValue();
  27924. if (/^\d{8}$/.test(value)) {
  27925. // 8位数字,自动转换为 YYYY-MM-DD
  27926. var newValue = [
  27927. value.substr(0, 4),
  27928. value.substr(4, 2),
  27929. value.substr(6, 2)
  27930. ].join('-');
  27931. sender.setValue(newValue);
  27932. }
  27933. }
  27934. },
  27935. }
  27936. // focus: {
  27937. // // 获得焦点后自动下拉
  27938. // fn(sender) {
  27939. // sender.expand();
  27940. // this.doQuery(this.allQuery, true);
  27941. // },
  27942. // },
  27943. });
  27944. initComponent.call(this);
  27945. },
  27946. createInitialDate: function (value) {
  27947. var minValue = this.minValue, maxValue = this.maxValue;
  27948. value = value || syncDate(new Date());
  27949. if (minValue && minValue > value) {
  27950. value = minValue;
  27951. }
  27952. else if (maxValue && maxValue < value) {
  27953. value = maxValue;
  27954. }
  27955. return value;
  27956. },
  27957. });
  27958. }
  27959. //# sourceMappingURL=datefield.js.map
  27960. function initDateTimePicker () {
  27961. Ext.define('Yvan.DateTimePicker', {
  27962. extend: 'Ext.picker.Date',
  27963. alias: 'datetimepicker',
  27964. alternateClassName: 'Ext.DateTimePicker',
  27965. renderTpl: [
  27966. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  27967. '<div class="{baseCls}-header">',
  27968. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  27969. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  27970. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  27971. '</div>',
  27972. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  27973. '<thead>',
  27974. '<tr role="row">',
  27975. '<tpl for="dayNames">',
  27976. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  27977. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  27978. '</th>',
  27979. '</tpl>',
  27980. '</tr>',
  27981. '</thead>',
  27982. '<tbody>',
  27983. '<tr role="row">',
  27984. '<tpl for="days">',
  27985. '{#:this.isEndOfWeek}',
  27986. '<td role="gridcell">',
  27987. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  27988. '</td>',
  27989. '</tpl>',
  27990. '</tr>',
  27991. '</tbody>',
  27992. '</table>',
  27993. '<tpl if="showToday">',
  27994. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  27995. '</tpl>',
  27996. // These elements are used with Assistive Technologies such as screen readers
  27997. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  27998. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  27999. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  28000. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  28001. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  28002. '</div>',
  28003. {
  28004. firstInitial: function (value) {
  28005. return Ext.picker.Date.prototype.getDayInitial(value);
  28006. },
  28007. isEndOfWeek: function (value) {
  28008. // convert from 1 based index to 0 based
  28009. // by decrementing value once.
  28010. value--;
  28011. // eslint-disable-next-line vars-on-top
  28012. var end = value % 7 === 0 && value !== 0;
  28013. return end ? '</tr><tr role="row">' : '';
  28014. },
  28015. renderTodayBtn: function (values, out) {
  28016. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  28017. },
  28018. renderMonthBtn: function (values, out) {
  28019. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  28020. }
  28021. }
  28022. ],
  28023. beforeRender: function () {
  28024. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  28025. this.superclass.beforeRender.call(this);
  28026. function handleInput(extHandle, $input) {
  28027. var $dom = $(extHandle.el.dom);
  28028. // const $up = $dom.find('.x-form-spinner-up')
  28029. // const $down = $dom.find('.x-form-spinner-down')
  28030. // debugger
  28031. // $up.on('mousedown', () => {
  28032. // debugger
  28033. // });
  28034. // $up.on('click', () => {
  28035. // debugger
  28036. // });
  28037. extHandle.on('click', function (sender) {
  28038. var hideBak = me.hide;
  28039. me.hide = Ext.emptyFn;
  28040. extHandle.focus();
  28041. me.hide = hideBak;
  28042. });
  28043. var changeValue = function (delta) {
  28044. if (_$2.trim(extHandle.getValue()) === '') {
  28045. extHandle.setValue(extHandle.minValue);
  28046. }
  28047. else {
  28048. var v = parseInt('' + extHandle.getValue());
  28049. if (v + delta > extHandle.maxValue) {
  28050. extHandle.setValue(extHandle.minValue);
  28051. }
  28052. else if (v + delta < extHandle.minValue) {
  28053. extHandle.setValue(extHandle.maxValue);
  28054. }
  28055. else {
  28056. extHandle.setValue(v + delta);
  28057. }
  28058. }
  28059. };
  28060. $input.on('mousewheel', function (e) {
  28061. e.stopPropagation();
  28062. var event = e.originalEvent;
  28063. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  28064. // if (event.wheelDelta) {
  28065. // delta = event.wheelDelta / 120;
  28066. // } else if (event.detail) {
  28067. // delta = -event.detail / 3;
  28068. // }
  28069. var zoomSize = Math.ceil(eventDelta / 120);
  28070. changeValue(zoomSize);
  28071. // console.log('delta', delta)
  28072. // $input.focus()
  28073. });
  28074. }
  28075. me.input1 = Ext.create('Ext.form.field.Number', {
  28076. minValue: 0,
  28077. maxValue: 23,
  28078. flex: 1,
  28079. enableKeyEvents: true,
  28080. fieldLabel: '时',
  28081. labelWidth: 20,
  28082. hideLabel: true,
  28083. spinDownEnabled: false,
  28084. spinUpEnabled: false,
  28085. style: {
  28086. marginLeft: '5px',
  28087. },
  28088. listeners: {
  28089. afterrender: function (sender) {
  28090. var $input = $(sender.inputEl.dom);
  28091. handleInput(me.input1, $input);
  28092. },
  28093. change: function (sender, e) {
  28094. if (me.getValue()) {
  28095. me.value.setHours(sender.getValue());
  28096. }
  28097. },
  28098. }
  28099. });
  28100. me.input2 = Ext.create('Ext.form.field.Number', {
  28101. minValue: 0,
  28102. maxValue: 59,
  28103. flex: 1,
  28104. enableKeyEvents: true,
  28105. fieldLabel: ' ',
  28106. hideLabel: false,
  28107. labelWidth: 8,
  28108. spinDownEnabled: false,
  28109. spinUpEnabled: false,
  28110. listeners: {
  28111. afterrender: function (sender) {
  28112. var $input = $(sender.inputEl.dom);
  28113. handleInput(me.input2, $input);
  28114. },
  28115. change: function (sender, e) {
  28116. if (me.getValue()) {
  28117. me.value.setMinutes(sender.getValue());
  28118. }
  28119. },
  28120. }
  28121. });
  28122. me.input3 = Ext.create('Ext.form.field.Number', {
  28123. minValue: 0,
  28124. maxValue: 59,
  28125. flex: 1,
  28126. enableKeyEvents: true,
  28127. fieldLabel: ' ',
  28128. hideLabel: false,
  28129. labelWidth: 8,
  28130. spinDownEnabled: false,
  28131. spinUpEnabled: false,
  28132. style: {
  28133. marginRight: '5px',
  28134. },
  28135. listeners: {
  28136. afterrender: function (sender) {
  28137. var $input = $(sender.inputEl.dom);
  28138. handleInput(me.input3, $input);
  28139. },
  28140. change: function (sender, e) {
  28141. if (me.getValue()) {
  28142. me.value.setSeconds(sender.getValue());
  28143. }
  28144. },
  28145. }
  28146. });
  28147. me.confirmBtn = new Ext.button.Button({
  28148. text: '确认',
  28149. handler: me.confirmClick,
  28150. scope: me
  28151. });
  28152. me.tdBtn = new Ext.button.Button({
  28153. text: '现在',
  28154. handler: me.selectToday,
  28155. scope: me
  28156. });
  28157. me.todayBtn = Ext.create('Ext.container.Container', {
  28158. layout: 'anchor', border: false,
  28159. defaults: {
  28160. border: false, anchor: '100%',
  28161. margin: '0 0 5 0',
  28162. },
  28163. items: [
  28164. {
  28165. layout: 'hbox',
  28166. items: [
  28167. me.input1,
  28168. me.input2,
  28169. me.input3,
  28170. ]
  28171. },
  28172. {
  28173. layout: 'hbox',
  28174. items: [
  28175. me.confirmBtn,
  28176. me.tdBtn,
  28177. ]
  28178. }
  28179. ]
  28180. });
  28181. },
  28182. // finishRenderChildren() {
  28183. // var me = this;
  28184. //
  28185. // this.superclass.finishRenderChildren.call(this);
  28186. // //*
  28187. // me.input1.finishRender();
  28188. // me.input2.finishRender();
  28189. // me.input3.finishRender();
  28190. // //
  28191. // me.tdBtn.finishRender();
  28192. // me.confirmBtn.finishRender();
  28193. // },
  28194. setValue: function (value) {
  28195. //this.value = Ext.Date.clearTime(value, true);
  28196. this.value = value;
  28197. this.input1.setValue(this.value.getHours());
  28198. this.input2.setValue(this.value.getMinutes());
  28199. this.input3.setValue(this.value.getSeconds());
  28200. return this.update(this.value);
  28201. },
  28202. selectDate: function (value) {
  28203. if (this.showTime) {
  28204. value.setHours(this.input1.getValue());
  28205. value.setMinutes(this.input2.getValue());
  28206. value.setSeconds(this.input3.getValue());
  28207. }
  28208. this.value = value;
  28209. return this.update(this.value);
  28210. },
  28211. setDisabledStatus: function (disabled) {
  28212. var me = this;
  28213. debugger;
  28214. // me.callParent();
  28215. if (me.showTime) {
  28216. me.confirmBtn.setDisabled(disabled);
  28217. }
  28218. if (me.isShowFooter()) {
  28219. me.footerContainer.setDisabled(disabled);
  28220. }
  28221. },
  28222. handleDateClick: function (e, t) {
  28223. var me = this, handler = me.handler;
  28224. // e.stopEvent();
  28225. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  28226. me.doCancelFocus = me.focusOnSelect === false;
  28227. me.selectDate(new Date(t.dateValue));
  28228. delete me.doCancelFocus;
  28229. /* 有时间输入时单击事件不退出选择,只移动光标 */
  28230. if (me.showTime) {
  28231. return;
  28232. }
  28233. me.fireEvent('select', me, me.value);
  28234. if (handler) {
  28235. handler.call(me.scope || me, me, me.value);
  28236. }
  28237. me.onSelect();
  28238. }
  28239. },
  28240. selectToday: function () {
  28241. var me = this, btn = me.todayBtn, handler = me.handler;
  28242. if (btn && !btn.disabled) {
  28243. me.value = syncDate(new Date());
  28244. me.update(me.value);
  28245. me.fireEvent('select', me, me.value);
  28246. if (handler) {
  28247. handler.call(me.scope || me, me, me.value);
  28248. }
  28249. me.onSelect();
  28250. me.hide();
  28251. }
  28252. return me;
  28253. },
  28254. confirmClick: function () {
  28255. var me = this, btn = me.confirmBtn, handler = me.handler;
  28256. if (btn && !btn.disabled) {
  28257. me.fireEvent('select', me, me.value);
  28258. if (handler) {
  28259. handler.call(me.scope || me, me, me.value);
  28260. }
  28261. me.onSelect();
  28262. me.hide();
  28263. }
  28264. return me;
  28265. },
  28266. selectedUpdate: function (date) {
  28267. var me = this,
  28268. //t = date.getTime(),
  28269. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  28270. cells.removeCls(cls);
  28271. for (c = 0; c < cLen; c++) {
  28272. cell = Ext.fly(cellItems[c]);
  28273. if (cell.dom.firstChild.dateValue == t) {
  28274. me.fireEvent('highlightitem', me, cell);
  28275. cell.addCls(cls);
  28276. if (me.isVisible() && !me.doCancelFocus) {
  28277. Ext.fly(cell.dom.firstChild).focus(50);
  28278. }
  28279. break;
  28280. }
  28281. }
  28282. },
  28283. // private, inherit docs
  28284. beforeDestroy: function () {
  28285. var me = this;
  28286. if (me.rendered) {
  28287. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  28288. }
  28289. me.superclass.beforeDestroy.call(this);
  28290. }
  28291. });
  28292. }
  28293. //# sourceMappingURL=datetimepicker.js.map
  28294. function initDateTime () {
  28295. Ext.define('Yvan.DateTimeField', {
  28296. extend: 'Ext.form.field.Date',
  28297. xtype: 'datetimefield',
  28298. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  28299. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28300. showTime: true,
  28301. format: "Y-m-d H:i:s",
  28302. constructor: function (config) {
  28303. var newConfig = _$2.defaultsDeep({
  28304. // 强制属性
  28305. }, baseConfig(config, 'col-item'), config, date);
  28306. this.superclass.constructor.call(this, newConfig);
  28307. },
  28308. initComponent: function () {
  28309. this.superclass.initComponent.call(this);
  28310. var setInitValue = function () {
  28311. var value = this.getRawValue();
  28312. if (!value) {
  28313. // 没填内容的时候,自动设置当前时间
  28314. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  28315. }
  28316. };
  28317. this.on({
  28318. afterrender: function () {
  28319. var config = this.config;
  28320. // 日期框,不要默认弹出
  28321. $(this.el.dom).on('click', setInitValue.bind(this));
  28322. },
  28323. destory: function () {
  28324. // 日期框,不要默认弹出
  28325. $(this.el.dom).off('click', setInitValue.bind(this));
  28326. },
  28327. change: {
  28328. fn: function (sender) {
  28329. if (sender.format === "Y-m-d H:i:s") {
  28330. // 年月日格式
  28331. var value = sender.getRawValue();
  28332. if (/^\d{14}$/.test(value)) {
  28333. // 8位数字,自动转换为 YYYY-MM-DD
  28334. var newValue = [
  28335. value.substr(0, 4),
  28336. '-',
  28337. value.substr(4, 2),
  28338. '-',
  28339. value.substr(6, 2),
  28340. ' ',
  28341. value.substr(8, 2),
  28342. ':',
  28343. value.substr(10, 2),
  28344. ':',
  28345. value.substr(12, 2)
  28346. ].join('');
  28347. sender.setValue(newValue);
  28348. }
  28349. }
  28350. },
  28351. }
  28352. });
  28353. },
  28354. getValue: function () {
  28355. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  28356. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  28357. // console.log('cc:', nv, ov)
  28358. return nv;
  28359. },
  28360. onExpand: function () {
  28361. var strValue = this.getValue();
  28362. var value;
  28363. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  28364. 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)));
  28365. }
  28366. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  28367. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  28368. }
  28369. else {
  28370. value = syncDate(new Date());
  28371. }
  28372. this.picker.setValue(value);
  28373. },
  28374. createPicker: function () {
  28375. var me = this, format = Ext.String.format;
  28376. //@ts-ignore
  28377. return new Yvan.DateTimePicker({
  28378. pickerField: me,
  28379. ownerCt: me.ownerCt,
  28380. renderTo: document.body,
  28381. floating: true,
  28382. hidden: true,
  28383. focusOnShow: true,
  28384. minDate: me.minValue,
  28385. maxDate: me.maxValue,
  28386. disabledDatesRE: me.disabledDatesRE,
  28387. disabledDatesText: me.disabledDatesText,
  28388. disabledDays: me.disabledDays,
  28389. disabledDaysText: me.disabledDaysText,
  28390. format: me.format,
  28391. showToday: me.showToday,
  28392. showTime: me.showTime,
  28393. startDay: me.startDay,
  28394. minText: format(me.minText, me.formatDate(me.minValue)),
  28395. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  28396. listeners: {
  28397. scope: me,
  28398. select: me.onSelect
  28399. },
  28400. keyNavConfig: {
  28401. esc: function () {
  28402. me.collapse();
  28403. }
  28404. }
  28405. });
  28406. },
  28407. });
  28408. }
  28409. //# sourceMappingURL=datetimefield.js.map
  28410. function initNumber () {
  28411. var cc = Ext.form.field.Number.prototype.constructor;
  28412. var initComponent = Ext.form.field.Number.prototype.initComponent;
  28413. Ext.form.field.Number.override({
  28414. constructor: function (config) {
  28415. var newConfig = _$2.defaultsDeep({
  28416. // 强制属性
  28417. }, baseConfig(config, 'col-item'), config, numberfield);
  28418. cc.call(this, newConfig);
  28419. },
  28420. initComponent: function () {
  28421. this.on({
  28422. afterrender: function (sender) {
  28423. var _this = this;
  28424. var _a;
  28425. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  28426. sender.inputEl.dom.setAttribute('spellcheck', "false");
  28427. $$2(sender.inputEl.dom).on('click', function (e) {
  28428. sender.fireEvent('click', _this, e);
  28429. });
  28430. }
  28431. }
  28432. });
  28433. initComponent.call(this);
  28434. },
  28435. });
  28436. }
  28437. //# sourceMappingURL=numberfield.js.map
  28438. function initCheckbox () {
  28439. var cc = Ext.form.field.Checkbox.prototype.constructor;
  28440. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  28441. Ext.form.field.Checkbox.override({
  28442. constructor: function (config) {
  28443. var newConfig = _$2.defaultsDeep({
  28444. // 强制属性
  28445. }, baseConfig(config, 'col-item'), config, checkbox);
  28446. cc.call(this, newConfig);
  28447. },
  28448. getValue: function () {
  28449. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28450. var ov = getValue.call(this);
  28451. // const ov = this.getRawValue()
  28452. return (ov ? checkedValue : uncheckedValue);
  28453. },
  28454. setValue: function (nv) {
  28455. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28456. var value;
  28457. if (nv === checkedValue) {
  28458. value = true;
  28459. }
  28460. else if (nv === uncheckedValue) {
  28461. value = false;
  28462. }
  28463. else {
  28464. value = !!nv;
  28465. }
  28466. // me.setRawValue(value)
  28467. // me.checked = value
  28468. // return me.mixins.field.setValue.call(me, value);
  28469. setValue.call(this, value);
  28470. },
  28471. updateCheckedCls: function (checked) {
  28472. var me = this;
  28473. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  28474. checked = checked != null ? checked : me.getValue();
  28475. if (checked === uncheckedValue) {
  28476. checked = false;
  28477. }
  28478. else if (checked === checkedValue) {
  28479. checked = true;
  28480. }
  28481. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  28482. },
  28483. initComponent: function () {
  28484. initComponent.call(this);
  28485. },
  28486. });
  28487. }
  28488. //# sourceMappingURL=checkbox.js.map
  28489. function initCheckboxGroup () {
  28490. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  28491. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  28492. Ext.form.CheckboxGroup.override({
  28493. constructor: function (config) {
  28494. var newConfig = _$2.defaultsDeep({
  28495. // 强制属性
  28496. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  28497. cc.call(this, newConfig);
  28498. },
  28499. initComponent: function () {
  28500. initComponent.call(this);
  28501. },
  28502. });
  28503. }
  28504. //# sourceMappingURL=checkboxgroup.js.map
  28505. function initRadio () {
  28506. var cc = Ext.form.field.Radio.prototype.constructor;
  28507. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  28508. Ext.form.field.Radio.override({
  28509. constructor: function (config) {
  28510. var newConfig = _$2.defaultsDeep({
  28511. // 强制属性
  28512. }, baseConfig(config, 'col-item'), config, radio);
  28513. cc.call(this, newConfig);
  28514. },
  28515. initComponent: function () {
  28516. initComponent.call(this);
  28517. },
  28518. });
  28519. }
  28520. //# sourceMappingURL=radio.js.map
  28521. function initRadioGroup () {
  28522. var cc = Ext.form.RadioGroup.prototype.constructor;
  28523. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  28524. Ext.form.RadioGroup.override({
  28525. constructor: function (config) {
  28526. var newConfig = _$2.defaultsDeep({
  28527. // 强制属性
  28528. }, baseConfig(config, 'col-item'), config, radiogroup);
  28529. cc.call(this, newConfig);
  28530. },
  28531. initComponent: function () {
  28532. initComponent.call(this);
  28533. },
  28534. });
  28535. }
  28536. //# sourceMappingURL=radiogroup.js.map
  28537. function initFieldset () {
  28538. /**
  28539. *
  28540. */
  28541. var ct = Ext.form.FieldSet.prototype.constructor;
  28542. Ext.form.FieldSet.override({
  28543. constructor: function (config) {
  28544. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  28545. ct.call(this, newConfig);
  28546. }
  28547. });
  28548. }
  28549. //# sourceMappingURL=fieldset.js.map
  28550. function initCombotree () {
  28551. Ext.define('Yvan.ComboTree', {
  28552. extend: 'Ext.form.field.Picker',
  28553. xtype: 'combotree',
  28554. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28555. config: {
  28556. store: null,
  28557. displayField: null,
  28558. columns: null,
  28559. selectOnTab: true,
  28560. maxPickerHeight: 300,
  28561. minPickerHeight: 100,
  28562. minPickerWidth: 350,
  28563. rootVisible: true,
  28564. },
  28565. editable: false,
  28566. setStore: function (store) {
  28567. this.store = store;
  28568. var me = this;
  28569. if (me.store) {
  28570. if (me.picker) {
  28571. me.picker.setStore(store);
  28572. if (me.isExpanded) {
  28573. me.collapse();
  28574. delete me.picker;
  28575. me.expand();
  28576. }
  28577. }
  28578. this.onLoad();
  28579. me.mon(me.store, {
  28580. scope: me,
  28581. load: me.onLoad,
  28582. update: me.onUpdate
  28583. });
  28584. }
  28585. },
  28586. createPicker: function () {
  28587. var me = this;
  28588. var picker = new Ext.tree.Panel({
  28589. border: false,
  28590. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28591. shrinkWrapDock: 2,
  28592. store: me.store,
  28593. floating: true,
  28594. rootVisible: me.rootVisible,
  28595. displayField: me.displayField,
  28596. columns: me.columns,
  28597. minHeight: me.minPickerHeight,
  28598. maxHeight: me.maxPickerHeight,
  28599. minWidth: me.minPickerWidth,
  28600. manageHeight: false,
  28601. shadow: false,
  28602. scrollable: true,
  28603. // modal: true,
  28604. // constrain: true,
  28605. // constrainTo: topScope._handle.el.dom,
  28606. // renderTo: topScope._handle.el.dom,
  28607. // alignTarget: topScope._handle,
  28608. listeners: {
  28609. scope: me,
  28610. itemclick: me.onItemClick,
  28611. itemkeydown: me.onPickerKeyDown
  28612. }
  28613. }), view = picker.getView();
  28614. if (Ext.isIE9 && Ext.isStrict) {
  28615. view.on({
  28616. scope: me,
  28617. highlightitem: me.repaintPickerView,
  28618. unhighlightitem: me.repaintPickerView,
  28619. afteritemexpand: me.repaintPickerView,
  28620. afteritemcollapse: me.repaintPickerView
  28621. });
  28622. }
  28623. return picker;
  28624. },
  28625. repaintPickerView: function () {
  28626. var style = this.picker.getView().getEl().dom.style;
  28627. style.display = style.display;
  28628. },
  28629. onItemClick: function (view, record, node, rowIndex, e) {
  28630. this.selectItem(view, record);
  28631. },
  28632. onPickerKeyDown: function (treeView, record, item, index, e) {
  28633. var key = e.getKey();
  28634. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  28635. this.selectItem(treeView, record);
  28636. }
  28637. },
  28638. selectItem: function (sender, record) {
  28639. var me = this;
  28640. me.setValue(record.getId());
  28641. me.fireEvent('select', me, record);
  28642. me.collapse();
  28643. },
  28644. onExpand: function () {
  28645. var picker = this.picker;
  28646. var store = picker.store;
  28647. var value = this.value;
  28648. var node;
  28649. if (value) {
  28650. node = store.getNodeById(value);
  28651. }
  28652. if (!node) {
  28653. node = store.getRoot();
  28654. }
  28655. picker.ensureVisible(node, {
  28656. select: true,
  28657. focus: true
  28658. });
  28659. },
  28660. setValue: function (value) {
  28661. var me = this;
  28662. console.log('setValue', value);
  28663. me.value = value;
  28664. if (!me.store || me.store.loading) {
  28665. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  28666. return me.mixins.field.setValue.call(me, value);
  28667. // return me;
  28668. }
  28669. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  28670. if (value === undefined) {
  28671. record = me.store.getRoot();
  28672. console.log('setValue', record.getId());
  28673. me.value = record.getId();
  28674. return me.mixins.field.setValue.call(me, value);
  28675. }
  28676. else {
  28677. record = me.store.getNodeById(value);
  28678. }
  28679. // set the raw value to the record's display field if a record was found
  28680. me.setRawValue(record ? record.get(me.displayField) : '');
  28681. return me.mixins.field.setValue.call(me, value);
  28682. },
  28683. getSubmitValue: function () {
  28684. return this.value;
  28685. },
  28686. getValue: function () {
  28687. return this.value;
  28688. },
  28689. onLoad: function () {
  28690. var value = this.value;
  28691. if (value) {
  28692. this.setValue(value);
  28693. }
  28694. },
  28695. onUpdate: function (store, rec, type, modifiedFieldNames) {
  28696. var display = this.displayField;
  28697. var me = this;
  28698. if (type === 'edit' && modifiedFieldNames &&
  28699. Ext.Array.contains(modifiedFieldNames, display) &&
  28700. this.value === rec.getId()) {
  28701. me.mixins.field.setValue.call(me, this.value);
  28702. this.setRawValue(rec.get(display));
  28703. }
  28704. }
  28705. });
  28706. }
  28707. //# sourceMappingURL=combotree.js.map
  28708. function initPickerPlus () {
  28709. Ext.define('Yvan.PickerAlignCenter', {
  28710. extend: 'Ext.form.field.Picker',
  28711. /**
  28712. * Performs the alignment on the picker using the class defaults
  28713. * @private
  28714. */
  28715. doAlign: function () {
  28716. // 不要挪动就好
  28717. },
  28718. });
  28719. }
  28720. //# sourceMappingURL=pickerplus.js.map
  28721. function initCombogrid () {
  28722. Ext.define('Yvan.ComboGrid', {
  28723. extend: 'Ext.form.field.Picker',
  28724. // extend: 'Yvan.PickerAlignCenter',
  28725. xtype: 'combogrid',
  28726. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  28727. triggers: {
  28728. clear: {
  28729. weight: 0,
  28730. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  28731. hidden: true,
  28732. handler: 'onClearClick',
  28733. },
  28734. },
  28735. config: __assign({}, comboGrid),
  28736. editable: true,
  28737. _superBlur: false,
  28738. allowCustomInput: false,
  28739. pressEnterPopup: true,
  28740. initComponent: function () {
  28741. var that = this;
  28742. var scope = lookupScope(that);
  28743. var config = that.config;
  28744. if (isDesignMode(scope, config)) {
  28745. this.superclass.initComponent.call(this, arguments);
  28746. return;
  28747. }
  28748. this.on({
  28749. blur: function (sender, e) {
  28750. if (this._superBlur) {
  28751. // 挂起时不恢复内容
  28752. return;
  28753. }
  28754. // 离开焦点时,恢复原来的值
  28755. sender.setRawValue(sender.value);
  28756. },
  28757. afterrender: function (sender) {
  28758. var $dom = $(sender.inputEl.dom);
  28759. that.scope = lookupScope(sender);
  28760. if (sender.column) {
  28761. // 列模式,拦截 keydown
  28762. $dom.on('keydown', function (e) {
  28763. if (isChartEvent(e) && !that.tryEnable()) {
  28764. // 没有达成 editEnable 条件,不用响应
  28765. stopEvent(e);
  28766. return;
  28767. }
  28768. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28769. stopEvent(e);
  28770. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28771. return;
  28772. }
  28773. });
  28774. }
  28775. else {
  28776. // 常规模式,拦截 keyup
  28777. $dom.on('keyup', function (e) {
  28778. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  28779. return;
  28780. }
  28781. if (isChartEvent(e) && !that.tryEnable()) {
  28782. // 没有达成 editEnable 条件,不用响应
  28783. stopEvent(e);
  28784. return;
  28785. }
  28786. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28787. stopEvent(e);
  28788. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28789. return;
  28790. }
  28791. if (!that.allowCustomInput) {
  28792. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  28793. stopEvent(e);
  28794. }
  28795. });
  28796. $dom.on('change', function (e) {
  28797. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  28798. // if (that.isExpanded) {
  28799. // that.filterChange(that, e.target.value)
  28800. // }
  28801. stopEvent(e);
  28802. });
  28803. }
  28804. $dom.on('input', function (e) {
  28805. stopEvent(e);
  28806. });
  28807. },
  28808. });
  28809. this.superclass.initComponent.apply(this, arguments);
  28810. },
  28811. createPicker: function () {
  28812. var me = this;
  28813. var cfg = {
  28814. layout: 'fit',
  28815. border: 0,
  28816. // border: 5,
  28817. style: {
  28818. // borderColor: 'black',
  28819. // borderWidth: '5px',
  28820. // borderStyle: 'solid',
  28821. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  28822. },
  28823. shadow: 'side',
  28824. shadowOffset: 100,
  28825. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28826. shrinkWrapDock: 2,
  28827. floating: true,
  28828. width: me.pickerWidth,
  28829. height: me.pickerHeight,
  28830. minWidth: me.pickerWidth,
  28831. minHeight: me.pickerHeight,
  28832. maxWidth: me.pickerWidth,
  28833. maxHeight: me.pickerHeight,
  28834. items: [
  28835. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  28836. xtype: 'toolbar',
  28837. items: [
  28838. { xtype: 'textfield', fieldLabel: '筛选' },
  28839. {
  28840. xtype: 'button',
  28841. text: '查询',
  28842. iconCls: 'x-fa fa-search',
  28843. cssType: 'primary',
  28844. listeners: {
  28845. click: function () {
  28846. me.reloadGrid();
  28847. }
  28848. }
  28849. },
  28850. ]
  28851. }, autoLoad: false, listeners: {
  28852. afterrender: function (grid) {
  28853. me.grid = grid;
  28854. grid.focus();
  28855. grid.on({
  28856. rowdblclick: function (sender, row) {
  28857. me.selectItem(row);
  28858. },
  28859. dataLoadComplete: function (sender) {
  28860. _$2.defer(function () {
  28861. me.setFocus();
  28862. });
  28863. },
  28864. keydown: function (sender, e) {
  28865. if (me.column) {
  28866. // 列模式,拦截 keydown
  28867. me.processKey(e);
  28868. }
  28869. },
  28870. keyup: function (sender, e) {
  28871. if (!me.column) {
  28872. // 常规模式,拦截 keyup
  28873. me.processKey(e);
  28874. }
  28875. }
  28876. });
  28877. },
  28878. } })
  28879. ]
  28880. };
  28881. // @ts-ignore
  28882. var picker = new Ext.container.Container(cfg);
  28883. return picker;
  28884. },
  28885. setFocus: function () {
  28886. if (this.grid.store.getCount() > 0) {
  28887. this.grid.focusRow(0);
  28888. }
  28889. },
  28890. processKey: function (e) {
  28891. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  28892. this.selectItem(this.grid.selection);
  28893. stopEvent(e);
  28894. }
  28895. else if (e.key === 'Escape') {
  28896. this.collapse();
  28897. }
  28898. },
  28899. repaintPickerView: function () {
  28900. var style = this.picker.getView().getEl().dom.style;
  28901. style.display = style.display;
  28902. },
  28903. onItemClick: function (view, record, node, rowIndex, e) {
  28904. this.selectItem(record);
  28905. },
  28906. onPickerKeyDown: function (treeView, record, item, index, e) {
  28907. var key = e.getKey();
  28908. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  28909. this.selectItem(record);
  28910. }
  28911. },
  28912. filterChange: _$2.debounce(function (sender, value) {
  28913. sender.onExpand();
  28914. }, 1000),
  28915. selectItem: function (record) {
  28916. var me = this;
  28917. var lookup = this.lookup;
  28918. var scope = lookupScope(this);
  28919. me.fireEvent('select', me, record);
  28920. if (record.isModel) {
  28921. record = record.data;
  28922. }
  28923. tryWriteObject(lookup, record, function (path, value) {
  28924. me._lookupSet(path, value);
  28925. });
  28926. // lookup
  28927. // fromColumn: 'toTarget'
  28928. // fromColumn: 'toTarget'
  28929. // fromColumn: 'toTarget'
  28930. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  28931. var value = _$2.get(record, fromColumn);
  28932. me._lookupSet(toTarget, value);
  28933. });
  28934. // 选定之后不能做清空
  28935. // const {lookupClearOnChange} = me
  28936. // if (_.isArray(lookupClearOnChange)) {
  28937. // _.each(lookupClearOnChange, item => {
  28938. // me._lookupSet(item, '')
  28939. // })
  28940. // }
  28941. me.collapse();
  28942. // 触发 _raiseNextFocus
  28943. me._raiseNextFocus(me);
  28944. },
  28945. onExpand: function () {
  28946. // 展开时,根据 lookup 带入查询参数
  28947. var expressData = this.getExpressData();
  28948. var txtField = this.grid.down('toolbar').down('textfield');
  28949. txtField.setValue(expressData.queryValue);
  28950. this.reloadGrid();
  28951. },
  28952. reloadGrid: function () {
  28953. // 展开时,根据 lookup 带入查询参数
  28954. var expressData = this.getExpressData();
  28955. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  28956. var txtField = this.grid.down('toolbar').down('textfield');
  28957. // 每个 combogrid 默认带上 __queryValue 属性
  28958. reloadParam["__queryValue"] = txtField.getValue();
  28959. this.grid.reload(reloadParam);
  28960. },
  28961. onTriggerClick: function (sender) {
  28962. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  28963. if (!grid) {
  28964. msg('正在初始化,请稍后');
  28965. return;
  28966. }
  28967. if (!this.tryEnable()) {
  28968. // 没有达成 editEnable 条件,不用弹出
  28969. return;
  28970. }
  28971. if (isExpanded || readOnly || disabled) {
  28972. // 已弹出、只读、禁用状态下,不允许弹出
  28973. return;
  28974. }
  28975. this._superBlur = true;
  28976. this.superclass.onTriggerClick.apply(this, arguments);
  28977. this._superBlur = false;
  28978. },
  28979. onCollapse: function () {
  28980. // 每次收回时,删除下拉组件
  28981. // delete this.picker
  28982. },
  28983. /**
  28984. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  28985. */
  28986. setValue: function (value) {
  28987. var me = this;
  28988. // 设值用户看到的表面内容
  28989. this.setRawValue(value);
  28990. // 设值 setValue 调用链,正常触发 change 事件等
  28991. return me.mixins.field.setValue.call(me, value);
  28992. },
  28993. _lookupSet: function (path, value) {
  28994. var me = this;
  28995. path = tryVarSimple(path);
  28996. if (me.column) {
  28997. // 判断写入目标,是否与自己绑定的属性相等
  28998. if (path === 'queryValue' || me.column.dataIndex === path) {
  28999. me.setValue(value);
  29000. }
  29001. // 列模式下,写当前编辑行
  29002. var parentRecord = me._lookupEditorRecord();
  29003. if (parentRecord) {
  29004. // Ext.data.Record / Ext.data.Model
  29005. parentRecord.set(path, value);
  29006. }
  29007. else {
  29008. debugger;
  29009. }
  29010. }
  29011. else {
  29012. // 常规模式下,写 viewModel
  29013. me.scope.viewModel.set(path, value);
  29014. }
  29015. },
  29016. _lookupGrid: function () {
  29017. return this.column.up('grid');
  29018. },
  29019. _lookupEditorRecord: function () {
  29020. var _a, _b, _c, _d;
  29021. // parentGrid.getSelectionModel().getLastSelected()
  29022. var grid = this._lookupGrid();
  29023. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  29024. if (!editingPlugin) {
  29025. return grid.getSelectionModel().getLastSelected();
  29026. }
  29027. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  29028. if (_$2.isNumber(rowIdx)) {
  29029. return grid.store.getAt(rowIdx);
  29030. }
  29031. else {
  29032. return grid.getSelectionModel().getLastSelected();
  29033. }
  29034. },
  29035. onChange: function (newVal, oldVal) {
  29036. var me = this;
  29037. var value = newVal;
  29038. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  29039. if (hideTrigger || disabled || readOnly || hideClear) {
  29040. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  29041. return;
  29042. }
  29043. if (value) {
  29044. me.getTrigger('clear').show();
  29045. me.updateLayout();
  29046. }
  29047. else {
  29048. me.getTrigger('clear').hide();
  29049. me.updateLayout();
  29050. }
  29051. },
  29052. /**
  29053. * 得到能用于 express 表达式计算的上下文数据
  29054. */
  29055. getExpressData: function () {
  29056. var queryValue = this.getRawValue();
  29057. if (!queryValue) {
  29058. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  29059. queryValue = this.getPicker().down('textfield').getRawValue();
  29060. }
  29061. if (this.column) {
  29062. // 列模式, 准备好判断 editEnable 表达式用的数据
  29063. var parentRecord = this._lookupEditorRecord();
  29064. if (!parentRecord) {
  29065. debugger;
  29066. }
  29067. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  29068. }
  29069. else {
  29070. // 编辑模式,准备好判断用的数据
  29071. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  29072. }
  29073. },
  29074. tryEnable: function () {
  29075. return tryEnable(this.getExpressData(), this.editEnable);
  29076. },
  29077. /**
  29078. * 清空所有值
  29079. */
  29080. onClearClick: function (sender, e) {
  29081. var me = this;
  29082. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  29083. me.fireEvent('clear', sender, e);
  29084. me.setValue('');
  29085. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  29086. me._lookupSet(toTarget, '');
  29087. });
  29088. _$2.each(lookupClearOnChange, function (item) {
  29089. me._lookupSet(item, '');
  29090. });
  29091. }
  29092. });
  29093. }
  29094. //# sourceMappingURL=combogrid.js.map
  29095. function initContainer () {
  29096. var cc = Ext.container.Container.prototype.constructor;
  29097. //const {initComponent} = Ext.container.Container.prototype
  29098. Ext.container.Container.override({
  29099. constructor: function (config) {
  29100. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  29101. cc.call(this, newConfig);
  29102. },
  29103. });
  29104. }
  29105. //# sourceMappingURL=container.js.map
  29106. function initRows () {
  29107. Ext.define('Yvan.Rows', {
  29108. extend: 'Ext.container.Container',
  29109. xtype: 'rows',
  29110. constructor: function (config) {
  29111. var self = this;
  29112. var newConfig = _$2.defaultsDeep({
  29113. // 强制性属性
  29114. layout: 'anchor', border: false,
  29115. defaults: {
  29116. border: false, anchor: '100%',
  29117. margin: '0 0 5 0',
  29118. },
  29119. }, baseConfig(config, 'rows-container'), config, rows);
  29120. this.superclass.constructor.call(self, newConfig);
  29121. },
  29122. });
  29123. }
  29124. //# sourceMappingURL=rows.js.map
  29125. function initForm () {
  29126. var ct = Ext.form.Panel.prototype.constructor;
  29127. Ext.form.Panel.override({
  29128. constructor: function (config) {
  29129. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  29130. ct.call(this, newConfig);
  29131. }
  29132. });
  29133. }
  29134. //# sourceMappingURL=form.js.map
  29135. function initCols () {
  29136. Ext.define('Yvan.Cols', {
  29137. extend: 'Ext.container.Container',
  29138. xtype: 'cols',
  29139. constructor: function (config) {
  29140. var self = this;
  29141. var newConfig = _$2.defaultsDeep({
  29142. // 强制性属性
  29143. layout: 'hbox',
  29144. minHeight: config.designMode ? 32 : 0
  29145. }, baseConfig(config, 'cols-container'), config, cols);
  29146. this.superclass.constructor.call(self, newConfig);
  29147. },
  29148. });
  29149. }
  29150. //# sourceMappingURL=cols.js.map
  29151. function initButton () {
  29152. /**
  29153. *
  29154. */
  29155. var ct = Ext.button.Button.prototype.constructor;
  29156. Ext.button.Button.override({
  29157. constructor: function (config) {
  29158. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  29159. ct.call(this, newConfig);
  29160. },
  29161. setLoading: function (value) {
  29162. if (value) {
  29163. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  29164. this._originIconCls = this.iconCls;
  29165. }
  29166. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  29167. this.setDisabled(true);
  29168. }
  29169. else {
  29170. this.setIconCls(this._originIconCls);
  29171. this.setDisabled(false);
  29172. }
  29173. }
  29174. });
  29175. }
  29176. //# sourceMappingURL=button.js.map
  29177. function initIframe () {
  29178. Ext.define('Ext.ux.IFrame', {
  29179. extend: 'Ext.Component',
  29180. alias: 'widget.uxiframe',
  29181. loadMask: 'Loading...',
  29182. src: 'about:blank',
  29183. renderTpl: [
  29184. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  29185. ],
  29186. childEls: ['iframeEl'],
  29187. initComponent: function () {
  29188. this.superclass.initComponent.call(this);
  29189. this.superclass.initEvents.call(this);
  29190. this.frameName = this.frameName || this.id + '-frame';
  29191. },
  29192. initEvents: function () {
  29193. var me = this;
  29194. this.superclass.initEvents.call(this);
  29195. me.iframeEl.on('load', me.onLoad, me);
  29196. },
  29197. initRenderData: function () {
  29198. return Ext.apply(this.superclass.initRenderData.call(this), {
  29199. src: this.src,
  29200. frameName: this.frameName
  29201. });
  29202. },
  29203. getBody: function () {
  29204. var doc = this.getDoc();
  29205. return doc.body || doc.documentElement;
  29206. },
  29207. getDoc: function () {
  29208. try {
  29209. return this.getWin().document;
  29210. }
  29211. catch (ex) {
  29212. return null;
  29213. }
  29214. },
  29215. getWin: function () {
  29216. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  29217. return win;
  29218. },
  29219. getFrame: function () {
  29220. var me = this;
  29221. return me.iframeEl.dom;
  29222. },
  29223. onLoad: function () {
  29224. var me = this, doc = me.getDoc();
  29225. if (doc) {
  29226. this.el.unmask();
  29227. this.fireEvent('load', this);
  29228. }
  29229. else if (me.src) {
  29230. this.el.unmask();
  29231. this.fireEvent('error', this);
  29232. }
  29233. },
  29234. load: function (src) {
  29235. var me = this, text = me.loadMask, frame = me.getFrame();
  29236. if (me.fireEvent('beforeload', me, src) !== false) {
  29237. if (text && me.el) {
  29238. me.el.mask(text);
  29239. }
  29240. frame.src = me.src = (src || me.src);
  29241. }
  29242. }
  29243. });
  29244. }
  29245. //# sourceMappingURL=iframe.js.map
  29246. /**
  29247. * 属性:
  29248. * - autoLoad: true
  29249. * - dataSource: ''
  29250. * 方法:
  29251. * - handleZoomBig
  29252. * - handleZoomSmall
  29253. * - handleZoomReset
  29254. * - openDiagram
  29255. * - getBpmn
  29256. * - getBpmnCanvas
  29257. * - getBpmnOverlays
  29258. * - getBpmnZoomScroll
  29259. * 事件:
  29260. * - initFinish
  29261. * - failed
  29262. * - success
  29263. * - itemHover
  29264. * - itemOut
  29265. * - itemClick
  29266. * - itemDblclick
  29267. * - itemMousedown
  29268. * - itemMouseup
  29269. */
  29270. function initBpmn () {
  29271. Ext.define('Yvan.Bpmn', {
  29272. // extend: 'Ext.container.Container',
  29273. extend: 'Ext.panel.Panel',
  29274. alias: 'widget.bpmn',
  29275. xtype: 'bpmn',
  29276. constructor: function (config) {
  29277. var self = this;
  29278. var newConfig = _$2.defaultsDeep({
  29279. // 强制性属性
  29280. }, baseConfig(config, 'row-item'), config, bpmn);
  29281. if (!newConfig.hideToolbar) {
  29282. newConfig.tbar = [];
  29283. newConfig.tbar.push({
  29284. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  29285. listeners: {
  29286. click: function (sender) {
  29287. self.reload();
  29288. }
  29289. }
  29290. });
  29291. newConfig.tbar.push({
  29292. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  29293. listeners: {
  29294. click: function (sender) {
  29295. self.handleZoomBig();
  29296. }
  29297. },
  29298. });
  29299. newConfig.tbar.push({
  29300. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  29301. listeners: {
  29302. click: function (sender) {
  29303. self.handleZoomSmall();
  29304. }
  29305. },
  29306. });
  29307. newConfig.tbar.push({
  29308. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  29309. listeners: {
  29310. click: function (sender) {
  29311. self.handleZoomReset();
  29312. }
  29313. },
  29314. });
  29315. }
  29316. this.superclass.constructor.call(self, newConfig);
  29317. },
  29318. initComponent: function () {
  29319. var _this = this;
  29320. var me = this;
  29321. var config = me.config;
  29322. var scope = lookupScope(this);
  29323. if (!isDesignMode(scope, config)) {
  29324. //@ts-ignore
  29325. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  29326. console.log('BpNavigated', me, BpNavigated);
  29327. var dom = me.el.dom;
  29328. var $dom = $(dom);
  29329. var $container = $dom.find('.x-autocontainer-innerCt');
  29330. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  29331. _this._bpmn = bpmn;
  29332. if (_this.autoLoad) {
  29333. _this.reload();
  29334. }
  29335. _this.fireEvent('initFinish', _this);
  29336. var eventBus = bpmn.get('eventBus');
  29337. eventBus.on('element.hover', function (e) {
  29338. // this.fireEvent('itemHover', this, e);
  29339. });
  29340. eventBus.on('element.out', function (e) {
  29341. _this.fireEvent('itemOut', _this, e);
  29342. });
  29343. eventBus.on('element.click', function (e) {
  29344. _this.fireEvent('itemClick', _this, e);
  29345. });
  29346. eventBus.on('element.dblclick', function (e) {
  29347. _this.fireEvent('itemDblclick', _this, e);
  29348. });
  29349. eventBus.on('element.mousedown', function (e) {
  29350. _this.fireEvent('itemMousedown', _this, e);
  29351. });
  29352. eventBus.on('element.mouseup', function (e) {
  29353. _this.fireEvent('itemMouseup', _this, e);
  29354. });
  29355. });
  29356. }
  29357. this.superclass.initComponent.call(this);
  29358. this.on({
  29359. afterrender: function (sender) {
  29360. }
  29361. });
  29362. },
  29363. /**
  29364. * 重新载入
  29365. */
  29366. reload: function () {
  29367. var _this = this;
  29368. var _a;
  29369. if (typeof this.dataSource === 'string' && this.dataSource) {
  29370. var scope = lookupScope(this);
  29371. var fn = lookupFn(scope, this.dataSource);
  29372. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  29373. _this.openDiagram(res.data);
  29374. });
  29375. }
  29376. },
  29377. /**
  29378. * 获取bpmn
  29379. */
  29380. getBpmn: function () {
  29381. return this._bpmn;
  29382. },
  29383. getBpmnCanvas: function () {
  29384. var _a;
  29385. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  29386. },
  29387. getBpmnOverlays: function () {
  29388. var _a;
  29389. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  29390. },
  29391. getBpmnZoomScroll: function () {
  29392. var _a;
  29393. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  29394. },
  29395. handleZoomBig: function () {
  29396. var _a;
  29397. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  29398. },
  29399. handleZoomSmall: function () {
  29400. var _a;
  29401. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  29402. },
  29403. handleZoomReset: function () {
  29404. var _a;
  29405. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  29406. },
  29407. openDiagram: function (diagram) {
  29408. var _this = this;
  29409. if (!this.getBpmn()) {
  29410. return;
  29411. }
  29412. this.getBpmn().importXML(diagram, function (err) {
  29413. if (err) {
  29414. // YvEventDispatch(this.onFailed, this, undefined);
  29415. _this.fireEvent('failed', _this, err);
  29416. return console.error('could not import BPMN 2.0 diagram', err);
  29417. }
  29418. // zoom to fit full viewport
  29419. _this.getBpmnCanvas().zoom('fit-viewport');
  29420. _this.fireEvent('success', _this);
  29421. });
  29422. },
  29423. });
  29424. }
  29425. //# sourceMappingURL=bpmn.js.map
  29426. function initSqlComplex () {
  29427. Ext.define('Yvan.SqlComplex', {
  29428. extend: 'Ext.panel.Panel',
  29429. xtype: 'sqlcomplex',
  29430. alias: 'widget.sqlcomplex',
  29431. getSqlExpress: function () {
  29432. },
  29433. constructor: function (config) {
  29434. var reference = config.reference;
  29435. var me = this;
  29436. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29437. {
  29438. region: 'west',
  29439. width: 280,
  29440. border: false,
  29441. split: true,
  29442. reference: reference + '_tree',
  29443. xtype: 'yvtree',
  29444. hideRefresh: true,
  29445. hideExpand: true,
  29446. hideCollapse: true,
  29447. listeners: {
  29448. itemdblclick: function (sender, record, item, index, e) {
  29449. var field = record.get('field');
  29450. var defaultValue = record.get('defaultValue');
  29451. if (!field) {
  29452. return;
  29453. }
  29454. var tabExpress = me.down('tabpanel');
  29455. var sqleditor = me.down('sqleditor');
  29456. var expressGrid = me.down('yvgrid');
  29457. if (tabExpress.getActiveTab().key !== 'grid') {
  29458. // SQL 模式
  29459. sqleditor.insertText(field + '=');
  29460. }
  29461. else {
  29462. // 表格模式
  29463. expressGrid.appendEditRow({
  29464. field: field,
  29465. operator: '=',
  29466. value: defaultValue,
  29467. remark: '',
  29468. });
  29469. _$2.defer(function () {
  29470. gridChanged(me, expressGrid);
  29471. });
  29472. }
  29473. }
  29474. },
  29475. },
  29476. {
  29477. region: 'center',
  29478. xtype: 'tabpanel',
  29479. reference: reference + '_tab',
  29480. tabPosition: 'bottom',
  29481. listeners: {
  29482. afterrender: function (sender) {
  29483. var scope = lookupScope(me);
  29484. var value = scope.viewModel.get(me.config.bindValue);
  29485. // sql 转换为 grid
  29486. try {
  29487. var list_1 = parseSqlToGrid(value);
  29488. _$2.defer(function () {
  29489. var grid = me.down('yvgrid');
  29490. grid.setData(list_1);
  29491. });
  29492. }
  29493. catch (e) {
  29494. console.error(e);
  29495. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29496. var tabSql = sender.down('sqleditor');
  29497. sender.setActiveTab(tabSql);
  29498. }
  29499. },
  29500. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29501. var scope = lookupScope(me);
  29502. var value = scope.viewModel.get(me.config.bindValue);
  29503. if (newCard.key === 'grid') {
  29504. // sql 转换为 grid
  29505. try {
  29506. var list_2 = parseSqlToGrid(value);
  29507. _$2.defer(function () {
  29508. var grid = me.down('yvgrid');
  29509. grid.setData(list_2);
  29510. });
  29511. return true;
  29512. }
  29513. catch (e) {
  29514. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29515. console.error(e);
  29516. return false;
  29517. }
  29518. }
  29519. else if (newCard.key === 'sql') {
  29520. // grid 转换为 sql
  29521. _$2.defer(function () {
  29522. var editor = me.down('sqleditor');
  29523. editor.setValue(value);
  29524. });
  29525. return true;
  29526. }
  29527. }
  29528. },
  29529. items: [
  29530. {
  29531. title: '表格模式',
  29532. key: 'grid',
  29533. xtype: 'yvgrid',
  29534. _mode: 'select',
  29535. reference: reference + '_grid',
  29536. hideFootbar: true,
  29537. pagination: false,
  29538. tbar: [
  29539. {
  29540. xtype: 'button',
  29541. text: '删除',
  29542. iconCls: 'x-fa fa-minus-circle',
  29543. cls: 'ext-btn-danger',
  29544. bind: {
  29545. disabled: '{!' + reference + '_grid.selection}',
  29546. },
  29547. listeners: {
  29548. click: function (sender) {
  29549. var grid = sender.up('yvgrid');
  29550. removeGridRow(grid);
  29551. gridChanged(me, grid);
  29552. }
  29553. },
  29554. },
  29555. ],
  29556. store: {},
  29557. listeners: {
  29558. editfinish: function (sender) {
  29559. gridChanged(me, sender);
  29560. },
  29561. },
  29562. columns: [
  29563. {
  29564. dataIndex: 'field',
  29565. header: '字段', sortable: false, menuDisabled: true,
  29566. width: 190,
  29567. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  29568. var column = context.column;
  29569. var propertyConfig = me.config.propertyConfig;
  29570. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29571. var field = record.get('field');
  29572. if (field) {
  29573. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29574. if (idx >= 0) {
  29575. var meta = propertyConfig[idx];
  29576. return meta.text;
  29577. }
  29578. }
  29579. return value;
  29580. }
  29581. },
  29582. {
  29583. dataIndex: 'operator',
  29584. header: '运算符', sortable: false, menuDisabled: true,
  29585. dict: 'operator',
  29586. width: 65,
  29587. editor: { xtype: 'combo' },
  29588. },
  29589. {
  29590. dataIndex: 'value',
  29591. header: '值', sortable: false, menuDisabled: true,
  29592. flex: 1,
  29593. getEditor: function (record) {
  29594. var column = this;
  29595. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  29596. var propertyConfig = me.config.propertyConfig;
  29597. var field = record.get('field');
  29598. if (!field) {
  29599. // 没有填 propertyName
  29600. return;
  29601. }
  29602. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29603. if (idx < 0) {
  29604. console.error('没有找到 field=' + field + ". propertyConfig");
  29605. return;
  29606. }
  29607. var meta = propertyConfig[idx];
  29608. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  29609. return new Ext.grid.CellEditor({
  29610. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  29611. });
  29612. }
  29613. return new Ext.grid.CellEditor({
  29614. field: __assign({ dict: meta.dict }, meta.editor)
  29615. });
  29616. },
  29617. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  29618. var column = context.column;
  29619. var grid = _$2.get(view, 'ownerGrid');
  29620. var propertyConfig = me.config.propertyConfig;
  29621. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29622. var field = record.get('field');
  29623. if (field) {
  29624. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  29625. if (idx >= 0) {
  29626. var meta = propertyConfig[idx];
  29627. var dictName = _$2.get(meta, 'dict');
  29628. if (dictName && window['DICT_CACHE'][dictName]) {
  29629. var dict_1 = window['DICT_CACHE'][dictName];
  29630. var valueText_1 = [];
  29631. _$2.forEach(_$2.split(valueList, ','), function (value) {
  29632. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  29633. if (idxKv >= 0) {
  29634. valueText_1.push(dict_1[idxKv].text);
  29635. }
  29636. else {
  29637. valueText_1.push(value);
  29638. }
  29639. });
  29640. return valueText_1.join(',');
  29641. }
  29642. }
  29643. }
  29644. return valueList;
  29645. },
  29646. },
  29647. ]
  29648. },
  29649. {
  29650. title: 'SQL模式',
  29651. key: 'sql',
  29652. xtype: 'sqleditor',
  29653. reference: reference + '_sql',
  29654. listeners: {
  29655. change: function (sender) {
  29656. var scope = lookupScope(me);
  29657. // 保存 editor 写入的值
  29658. scope.viewModel.set(me.config.bindValue, sender.getValue());
  29659. }
  29660. }
  29661. },
  29662. ]
  29663. }
  29664. ] });
  29665. this.superclass.constructor.call(this, newConfig);
  29666. },
  29667. initComponent: function () {
  29668. // 货位条件树
  29669. var me = this;
  29670. me.superclass.initComponent.apply(this, arguments);
  29671. var tree = this.down('yvtree');
  29672. var config = me.config;
  29673. tree.setRootNode(buildConfigTree(config.propertyConfig));
  29674. },
  29675. });
  29676. function gridChanged(me, grid) {
  29677. var data = grid.getDataRows();
  29678. var propertyConfig = me.config.propertyConfig;
  29679. var bindValue = me.config.bindValue;
  29680. var scope = lookupScope(me);
  29681. var sql = parseGridToSql(data);
  29682. scope.viewModel.set(bindValue, sql);
  29683. }
  29684. /**
  29685. * 用于从 propertyConfig 解析出树形结构
  29686. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  29687. * ->
  29688. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  29689. */
  29690. function buildConfigTree(propertyConfig) {
  29691. var root = {
  29692. expanded: true,
  29693. leaf: false,
  29694. children: []
  29695. };
  29696. var categoryObj = {};
  29697. var cfgList = propertyConfig;
  29698. _$2.forEach(cfgList, function (cfg) {
  29699. var cateNode = categoryObj[cfg.category];
  29700. if (!cateNode) {
  29701. cateNode = {
  29702. text: cfg.category, expanded: true, leaf: false,
  29703. children: []
  29704. };
  29705. categoryObj[cfg.category] = cateNode;
  29706. root.children.push(cateNode);
  29707. }
  29708. cateNode.children.push({
  29709. text: cfg.text,
  29710. field: cfg.field,
  29711. operator: cfg.operator,
  29712. defaultValue: cfg.defaultValue,
  29713. leaf: true,
  29714. });
  29715. });
  29716. return root;
  29717. }
  29718. /**
  29719. * 将表格变成 SQL where语句 [
  29720. * {field: 'f1', value: 1, operator: '='}
  29721. * {field: 'f2', value: 2, operator: '='}
  29722. * {field: 'f3', value: '3', operator: '>='}
  29723. * {field: 'f4', value: 4, operator: '='}
  29724. * ]
  29725. * ->
  29726. * f1=v1 and f2=v2
  29727. */
  29728. function parseGridToSql(list) {
  29729. var sqls = [];
  29730. _$2.forEach(list, function (i) {
  29731. var _a;
  29732. if (i.operator === 'in') {
  29733. sqls.push(i.field + ' in (' + (i.value) + ')');
  29734. }
  29735. else if (i.operator === 'notIn') {
  29736. sqls.push(i.field + ' not in (' + (i.value) + ')');
  29737. }
  29738. else {
  29739. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  29740. }
  29741. });
  29742. return sqls.join(' AND ');
  29743. }
  29744. /**
  29745. * 将 SQL 语句的 where 片段变成表格
  29746. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  29747. * @return [
  29748. {field: 'f1', value: 1, operator: '='}
  29749. {field: 'f2', value: 2, operator: '='}
  29750. {field: 'f3', value: '3', operator: '>='}
  29751. {field: 'f4', value: 4, operator: '='}
  29752. ]
  29753. */
  29754. function parseSqlToGrid(sql) {
  29755. if (!sql || !_$2.trim(sql)) {
  29756. return [];
  29757. }
  29758. var parser = new window['NodeSQLParser'].Parser();
  29759. var ast = parser.astify('select * from dual where ' + sql);
  29760. var ret = [];
  29761. exp(ast.where, ret);
  29762. return ret;
  29763. }
  29764. function exp(ast, ret) {
  29765. if (ast.type === 'binary_expr') {
  29766. if (_$2.toUpper(ast.operator) === 'AND') {
  29767. if (ast.left.type === 'binary_expr') {
  29768. exp(ast.left, ret);
  29769. }
  29770. if (ast.right.type === 'binary_expr') {
  29771. exp(ast.right, ret);
  29772. }
  29773. }
  29774. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  29775. if (ast.left.type === 'column_ref') {
  29776. if (ast.right.type === 'number' ||
  29777. ast.right.type === 'single_quote_string' ||
  29778. ast.right.type === 'double_quote_string') {
  29779. // 具体值相等
  29780. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  29781. }
  29782. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  29783. && ast.right.type === 'expr_list') {
  29784. // in / not in
  29785. var valueList_1 = [];
  29786. _$2.forEach(ast.right.value, function (item) {
  29787. valueList_1.push(item.value);
  29788. });
  29789. var operator = void 0;
  29790. if (_$2.toUpper(ast.operator) === 'IN') {
  29791. operator = 'in';
  29792. }
  29793. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  29794. operator = 'notIn';
  29795. }
  29796. ret.push({
  29797. field: ast.left.column, value: valueList_1.join(','),
  29798. operator: operator
  29799. });
  29800. }
  29801. else {
  29802. throw new Error('ast.right must is value.');
  29803. }
  29804. }
  29805. else {
  29806. throw new Error('ast.left must is column_ref.');
  29807. }
  29808. }
  29809. else {
  29810. // 必须用 AND 条件符匹配
  29811. throw new Error('ast.operator must is "AND / =".');
  29812. }
  29813. }
  29814. else {
  29815. throw new Error('ast.type must is "binary_expr".');
  29816. }
  29817. }
  29818. /**
  29819. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  29820. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  29821. {
  29822. type: 'binary_expr',
  29823. operator: 'AND',
  29824. left: {
  29825. type: 'binary_expr',
  29826. operator: 'AND',
  29827. left: {
  29828. type: 'binary_expr',
  29829. operator: 'AND',
  29830. left: {
  29831. type: 'binary_expr',
  29832. operator: 'AND',
  29833. left: {
  29834. type: 'binary_expr',
  29835. operator: '=',
  29836. left: {
  29837. type: 'column_ref',
  29838. table: null,
  29839. column: 'f1'
  29840. },
  29841. right: {
  29842. type: 'number',
  29843. value: 1
  29844. }
  29845. },
  29846. right: {
  29847. type: 'binary_expr',
  29848. operator: '=',
  29849. left: {
  29850. type: 'column_ref',
  29851. table: null,
  29852. column: 'f2'
  29853. },
  29854. right: {
  29855. type: 'number',
  29856. value: 2
  29857. }
  29858. }
  29859. },
  29860. right: {
  29861. type: 'binary_expr',
  29862. operator: '=',
  29863. left: {
  29864. type: 'column_ref',
  29865. table: null,
  29866. column: 'f3'
  29867. },
  29868. right: {
  29869. type: 'single_quote_string',
  29870. value: '3'
  29871. }
  29872. }
  29873. },
  29874. right: {
  29875. type: 'binary_expr',
  29876. operator: '>=',
  29877. left: {
  29878. type: 'column_ref',
  29879. table: null,
  29880. column: 'f4'
  29881. },
  29882. right: {
  29883. type: 'number',
  29884. value: 4
  29885. }
  29886. }
  29887. },
  29888. right: {
  29889. type: 'binary_expr',
  29890. operator: '<',
  29891. left: {
  29892. type: 'column_ref',
  29893. table: null,
  29894. column: 'f4'
  29895. },
  29896. right: {
  29897. type: 'number',
  29898. value: 3
  29899. }
  29900. }
  29901. }
  29902. * */
  29903. }
  29904. //# sourceMappingURL=SqlComplex.js.map
  29905. function initParamComplex () {
  29906. Ext.define('Yvan.ParamComplex', {
  29907. extend: 'Ext.panel.Panel',
  29908. xtype: 'paramcomplex',
  29909. alias: 'widget.paramcomplex',
  29910. getSqlExpress: function () {
  29911. },
  29912. constructor: function (config) {
  29913. var reference = config.reference;
  29914. var me = this;
  29915. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29916. {
  29917. region: 'west',
  29918. width: 280,
  29919. border: false,
  29920. split: true,
  29921. reference: reference + '_tree',
  29922. xtype: 'yvtree',
  29923. hideRefresh: true,
  29924. hideExpand: true,
  29925. hideCollapse: true,
  29926. listeners: {
  29927. itemdblclick: function (sender, record, item, index, e) {
  29928. var field = record.get('field');
  29929. var defaultValue = record.get('defaultValue');
  29930. if (!field) {
  29931. return;
  29932. }
  29933. var tabExpress = me.down('tabpanel');
  29934. var sqleditor = me.down('sqleditor');
  29935. var expressGrid = me.down('yvgrid');
  29936. if (tabExpress.getActiveTab().key !== 'grid') {
  29937. // SQL 模式
  29938. sqleditor.insertText(field + '=');
  29939. }
  29940. else {
  29941. // 表格模式
  29942. expressGrid.appendEditRow({
  29943. field: field,
  29944. operator: '=',
  29945. value: defaultValue,
  29946. remark: '',
  29947. });
  29948. _$2.defer(function () {
  29949. gridChanged(me, expressGrid);
  29950. });
  29951. }
  29952. }
  29953. },
  29954. },
  29955. {
  29956. region: 'center',
  29957. xtype: 'tabpanel',
  29958. reference: reference + '_tab',
  29959. tabPosition: 'bottom',
  29960. listeners: {
  29961. afterrender: function (sender) {
  29962. var scope = lookupScope(me);
  29963. var value = scope.viewModel.get(me.config.bindValue);
  29964. // sql 转换为 grid
  29965. try {
  29966. var list_1 = parseParamToGrid(value);
  29967. _$2.defer(function () {
  29968. var grid = me.down('yvgrid');
  29969. grid.setData(list_1);
  29970. });
  29971. }
  29972. catch (e) {
  29973. console.error(e);
  29974. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29975. var tabSql = sender.down('sqleditor');
  29976. sender.setActiveTab(tabSql);
  29977. }
  29978. },
  29979. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29980. var scope = lookupScope(me);
  29981. var value = scope.viewModel.get(me.config.bindValue);
  29982. if (newCard.key === 'grid') {
  29983. // sql 转换为 grid
  29984. try {
  29985. var list_2 = parseParamToGrid(value);
  29986. _$2.defer(function () {
  29987. var grid = me.down('yvgrid');
  29988. grid.setData(list_2);
  29989. });
  29990. return true;
  29991. }
  29992. catch (e) {
  29993. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29994. console.error(e);
  29995. return false;
  29996. }
  29997. }
  29998. else if (newCard.key === 'sql') {
  29999. // grid 转换为 sql
  30000. _$2.defer(function () {
  30001. var editor = me.down('sqleditor');
  30002. editor.setValue(value);
  30003. });
  30004. return true;
  30005. }
  30006. }
  30007. },
  30008. items: [
  30009. {
  30010. title: '表格模式',
  30011. key: 'grid',
  30012. xtype: 'yvgrid',
  30013. _mode: 'select',
  30014. reference: reference + '_grid',
  30015. hideFootbar: true,
  30016. pagination: false,
  30017. tbar: [
  30018. {
  30019. xtype: 'button',
  30020. text: '删除',
  30021. iconCls: 'x-fa fa-minus-circle',
  30022. cls: 'ext-btn-danger',
  30023. bind: {
  30024. disabled: '{!' + reference + '_grid.selection}',
  30025. },
  30026. listeners: {
  30027. click: function (sender) {
  30028. var grid = sender.up('yvgrid');
  30029. removeGridRow(grid);
  30030. gridChanged(me, grid);
  30031. }
  30032. },
  30033. },
  30034. ],
  30035. store: {},
  30036. listeners: {
  30037. editfinish: function (sender) {
  30038. gridChanged(me, sender);
  30039. },
  30040. },
  30041. columns: [
  30042. {
  30043. dataIndex: 'field',
  30044. header: '字段', sortable: false, menuDisabled: true,
  30045. width: 190,
  30046. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  30047. var column = context.column;
  30048. var propertyConfig = me.config.propertyConfig;
  30049. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30050. var field = record.get('field');
  30051. if (field) {
  30052. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30053. if (idx >= 0) {
  30054. var meta = propertyConfig[idx];
  30055. return meta.text;
  30056. }
  30057. }
  30058. return value;
  30059. }
  30060. },
  30061. {
  30062. dataIndex: 'value',
  30063. header: '值', sortable: false, menuDisabled: true,
  30064. flex: 1,
  30065. getEditor: function (record) {
  30066. var column = this;
  30067. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  30068. var propertyConfig = me.config.propertyConfig;
  30069. var field = record.get('field');
  30070. if (!field) {
  30071. // 没有填 propertyName
  30072. return;
  30073. }
  30074. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30075. if (idx < 0) {
  30076. console.error('没有找到 field=' + field + ". propertyConfig");
  30077. return;
  30078. }
  30079. var meta = propertyConfig[idx];
  30080. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  30081. return new Ext.grid.CellEditor({
  30082. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  30083. });
  30084. }
  30085. return new Ext.grid.CellEditor({
  30086. field: __assign({ dict: meta.dict }, meta.editor)
  30087. });
  30088. },
  30089. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  30090. var column = context.column;
  30091. var grid = _$2.get(view, 'ownerGrid');
  30092. var propertyConfig = me.config.propertyConfig;
  30093. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30094. var field = record.get('field');
  30095. if (field) {
  30096. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  30097. if (idx >= 0) {
  30098. var meta = propertyConfig[idx];
  30099. var dictName = _$2.get(meta, 'dict');
  30100. if (dictName && window['DICT_CACHE'][dictName]) {
  30101. var dict_1 = window['DICT_CACHE'][dictName];
  30102. var valueText_1 = [];
  30103. _$2.forEach(_$2.split(valueList, ','), function (value) {
  30104. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  30105. if (idxKv >= 0) {
  30106. valueText_1.push(dict_1[idxKv].text);
  30107. }
  30108. else {
  30109. valueText_1.push(value);
  30110. }
  30111. });
  30112. return valueText_1.join(',');
  30113. }
  30114. }
  30115. }
  30116. return valueList;
  30117. },
  30118. },
  30119. ]
  30120. },
  30121. {
  30122. title: '文本模式',
  30123. key: 'sql',
  30124. xtype: 'sqleditor',
  30125. reference: reference + '_sql',
  30126. listeners: {
  30127. change: function (sender) {
  30128. var scope = lookupScope(me);
  30129. // 保存 editor 写入的值
  30130. scope.viewModel.set(me.config.bindValue, sender.getValue());
  30131. }
  30132. }
  30133. },
  30134. ]
  30135. }
  30136. ] });
  30137. this.superclass.constructor.call(this, newConfig);
  30138. },
  30139. initComponent: function () {
  30140. // 货位条件树
  30141. var me = this;
  30142. me.superclass.initComponent.apply(this, arguments);
  30143. var tree = this.down('yvtree');
  30144. var config = me.config;
  30145. tree.setRootNode(buildConfigTree(config.propertyConfig));
  30146. },
  30147. });
  30148. function gridChanged(me, grid) {
  30149. var data = grid.getDataRows();
  30150. var propertyConfig = me.config.propertyConfig;
  30151. var bindValue = me.config.bindValue;
  30152. var scope = lookupScope(me);
  30153. var sql = parseGridToParam(data);
  30154. scope.viewModel.set(bindValue, sql);
  30155. }
  30156. /**
  30157. * 用于从 propertyConfig 解析出树形结构
  30158. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  30159. * ->
  30160. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  30161. */
  30162. function buildConfigTree(propertyConfig) {
  30163. var root = {
  30164. expanded: true,
  30165. leaf: false,
  30166. children: []
  30167. };
  30168. var categoryObj = {};
  30169. var cfgList = propertyConfig;
  30170. _$2.forEach(cfgList, function (cfg) {
  30171. var cateNode = categoryObj[cfg.category];
  30172. if (!cateNode) {
  30173. cateNode = {
  30174. text: cfg.category, expanded: true, leaf: false,
  30175. children: []
  30176. };
  30177. categoryObj[cfg.category] = cateNode;
  30178. root.children.push(cateNode);
  30179. }
  30180. cateNode.children.push({
  30181. text: cfg.text,
  30182. field: cfg.field,
  30183. operator: cfg.operator,
  30184. defaultValue: cfg.defaultValue,
  30185. leaf: true,
  30186. });
  30187. });
  30188. return root;
  30189. }
  30190. /**
  30191. * 将表格变成参数语句 [
  30192. * {field: 'f1', value: 1}
  30193. * {field: 'f2', value: 2}
  30194. * {field: 'f3', value: '3'}
  30195. * {field: 'f4', value: 4}
  30196. * ]
  30197. * ->
  30198. * f1=v1, f2=v2
  30199. */
  30200. function parseGridToParam(list) {
  30201. var sqls = [];
  30202. _$2.forEach(list, function (i) {
  30203. sqls.push(i.field + '=' + (i.value));
  30204. });
  30205. return sqls.join('; ');
  30206. }
  30207. /**
  30208. * 将 分号分割的的参数设置 变成表格
  30209. * @param param a=1; b=2; c='3'
  30210. * @return [
  30211. {field: 'a', value: 1}
  30212. {field: 'b', value: 2}
  30213. {field: 'c', value: '3'}
  30214. ]
  30215. */
  30216. function parseParamToGrid(param) {
  30217. if (!param || !_$2.trim(param)) {
  30218. return [];
  30219. }
  30220. var ret = [];
  30221. var sp = _$2.split(param, ';');
  30222. _$2.forEach(sp, function (v) {
  30223. var vi = _$2.indexOf(v, '=');
  30224. var field = _$2.trim(v.substr(0, vi));
  30225. var value = eval(v.substr(vi + 1));
  30226. ret.push({ field: field, value: value });
  30227. });
  30228. return ret;
  30229. }
  30230. }
  30231. //# sourceMappingURL=ParamComplex.js.map
  30232. function initSqlEditor$1 () {
  30233. Ext.define('com.yvan.studio.SqlEditor', {
  30234. extend: 'Ext.panel.Panel',
  30235. alias: 'widget.sqleditor',
  30236. xtype: 'sqleditor',
  30237. layout: 'fit',
  30238. border: false,
  30239. html: "<div class=\"editor\"/>",
  30240. config: {
  30241. value: ''
  30242. },
  30243. codeChange: undefined,
  30244. isChangeFromOuter: false,
  30245. setCode: function (value) {
  30246. var _this = this;
  30247. this.code = value;
  30248. this.value = value;
  30249. _$2.defer(function () {
  30250. _this.isChangeFromOuter = true;
  30251. if (_this.editor) {
  30252. _this.editor.setValue(value);
  30253. }
  30254. });
  30255. },
  30256. getCode: function () {
  30257. return this.getValue();
  30258. },
  30259. updateOptions: function (options) {
  30260. if (this.editor && options) {
  30261. this.editor.updateOptions(options);
  30262. }
  30263. },
  30264. getValue: function () {
  30265. if (!this.editor) {
  30266. return this.code;
  30267. }
  30268. return this.editor.getValue();
  30269. },
  30270. applyPosition: function () {
  30271. var _this = this;
  30272. if (this.autoFocusMethod) {
  30273. if (this.editor) {
  30274. _$2.defer(function () {
  30275. if (_this.autoFocusStartLine) {
  30276. _this.editor.setPosition({
  30277. lineNumber: _this.autoFocusStartLine,
  30278. column: _this.autoFocusStartColumn
  30279. });
  30280. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30281. }
  30282. _this.editor.focus();
  30283. });
  30284. delete this.autoFocusMethod;
  30285. }
  30286. }
  30287. this.editor.layout();
  30288. },
  30289. insertText: function (text) {
  30290. var editor = this.editor;
  30291. var position = editor.getPosition();
  30292. editor.executeEdits('', [
  30293. {
  30294. range: {
  30295. startLineNumber: position.lineNumber,
  30296. startColumn: position.column,
  30297. endLineNumber: position.lineNumber,
  30298. endColumn: position.column
  30299. },
  30300. text: text
  30301. }
  30302. ]);
  30303. },
  30304. setValue: function (value, fromEditor) {
  30305. this.setCode(value);
  30306. var me = this;
  30307. if (me.value === value) {
  30308. // 值相等,不需要变化
  30309. return;
  30310. }
  30311. if (fromEditor !== true && me.editor) {
  30312. // 不是来源于编辑器的变化,才设置编辑器的值
  30313. me.editor.setValue(value);
  30314. }
  30315. // 通知mixins setValue
  30316. me.value = value;
  30317. me.fireEvent('change', value);
  30318. },
  30319. initComponent: function () {
  30320. var that = this;
  30321. this.superclass.initComponent.call(this);
  30322. that.on({
  30323. resize: function () {
  30324. if (that.editor) {
  30325. that.editor.layout();
  30326. }
  30327. },
  30328. destory: function () {
  30329. if (that.editor) {
  30330. that.editor.dispose();
  30331. delete that.editor;
  30332. }
  30333. },
  30334. afterrender: function (sender) {
  30335. var $dom = $(that.el.dom).find('.editor');
  30336. attach_2($dom[0], {
  30337. value: that.code
  30338. }).then(function (editor) {
  30339. that.editor = editor;
  30340. that.applyPosition();
  30341. that.editor.onDidChangeModelContent(function (e) {
  30342. that.fireEvent('change', that.editor, e);
  30343. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30344. that.codeChange(that.editor.getValue(), that.name, e);
  30345. }
  30346. that.isChangeFromOuter = false;
  30347. });
  30348. });
  30349. }
  30350. });
  30351. }
  30352. });
  30353. function attach_2(element, opts) {
  30354. if (!window['monaco']) {
  30355. return;
  30356. }
  30357. var monaco = window['monaco'];
  30358. return new Promise(function (resolve) {
  30359. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  30360. enabled: false
  30361. } }));
  30362. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  30363. // const sql = editor.getValue()
  30364. // if (_.trim(sql).length > 0) {
  30365. // editor.setValue(format(sql, {
  30366. // indent: ' ',
  30367. // uppercase: true,
  30368. // }))
  30369. // }
  30370. // })
  30371. editor.onKeyUp(function (e) {
  30372. // console.log(e)
  30373. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30374. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30375. }
  30376. });
  30377. resolve(editor);
  30378. });
  30379. }
  30380. }
  30381. //# sourceMappingURL=SqlEditor.js.map
  30382. function initJsonEditor$1 () {
  30383. Ext.define('com.yvan.studio.JsonEditor', {
  30384. extend: 'Ext.panel.Panel',
  30385. alias: 'widget.jsoneditor',
  30386. xtype: 'jsoneditor',
  30387. layout: 'fit',
  30388. border: false,
  30389. html: "<div class=\"editor\"/>",
  30390. autoFocusMethod: true,
  30391. autoFocusStartLine: 0,
  30392. autoFocusStartColumn: 0,
  30393. codeChange: undefined,
  30394. funcArr: [],
  30395. modulePage: null,
  30396. isChangeFromOuter: false,
  30397. name: "",
  30398. /**
  30399. * 设置代码
  30400. */
  30401. setCode: function (value) {
  30402. var _this = this;
  30403. this.code = value;
  30404. _$2.defer(function () {
  30405. _this.isChangeFromOuter = true;
  30406. if (_this.editor) {
  30407. _this.editor.setValue(value);
  30408. }
  30409. });
  30410. },
  30411. updateOptions: function (options) {
  30412. if (this.editor && options) {
  30413. this.editor.updateOptions(options);
  30414. }
  30415. },
  30416. setLanguage: function (lang) {
  30417. if (!window['monaco']) {
  30418. return;
  30419. }
  30420. var monaco = window['monaco'];
  30421. if (this.editor && lang) {
  30422. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  30423. }
  30424. },
  30425. getCode: function () {
  30426. var _a;
  30427. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30428. },
  30429. applyPosition: function () {
  30430. var _this = this;
  30431. if (this.autoFocusMethod) {
  30432. if (this.editor) {
  30433. _$2.defer(function () {
  30434. if (_this.autoFocusStartLine) {
  30435. _this.editor.setPosition({
  30436. lineNumber: _this.autoFocusStartLine,
  30437. column: _this.autoFocusStartColumn
  30438. });
  30439. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30440. }
  30441. _this.editor.focus();
  30442. });
  30443. delete this.autoFocusMethod;
  30444. }
  30445. }
  30446. this.editor.layout();
  30447. },
  30448. initComponent: function () {
  30449. var that = this;
  30450. this.superclass.initComponent.apply(this, arguments);
  30451. this.on({
  30452. resize: function (sender, width, height) {
  30453. if (that.editor) {
  30454. that.editor.layout();
  30455. }
  30456. },
  30457. destory: function () {
  30458. if (that.editor) {
  30459. that.editor.dispose();
  30460. delete that.editor;
  30461. }
  30462. },
  30463. afterrender: function (sender) {
  30464. var $dom = $(that.el.dom).find('.editor');
  30465. attach_116($dom[0], {
  30466. value: that.code
  30467. }).then(function (editor) {
  30468. that.editor = editor;
  30469. that.applyPosition();
  30470. that.editor.onDidChangeModelContent(function (e) {
  30471. that.fireEvent('change', that.editor, e);
  30472. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30473. that.codeChange(that.editor.getValue(), that.name, e);
  30474. }
  30475. that.isChangeFromOuter = false;
  30476. });
  30477. });
  30478. }
  30479. });
  30480. },
  30481. });
  30482. function attach_116(element, opts) {
  30483. if (!window['monaco']) {
  30484. return;
  30485. }
  30486. var monaco = window['monaco'];
  30487. return new Promise(function (resolve) {
  30488. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  30489. enabled: false
  30490. } }));
  30491. editor.onKeyUp(function (e) {
  30492. // console.log(e)
  30493. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30494. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30495. }
  30496. });
  30497. resolve(editor);
  30498. });
  30499. }
  30500. }
  30501. //# sourceMappingURL=JsonEditor.js.map
  30502. function initJsEditor$1 () {
  30503. Ext.define('com.yvan.studio.JsEditor', {
  30504. extend: 'Ext.panel.Panel',
  30505. alias: 'widget.jseditor',
  30506. xtype: 'jseditor',
  30507. layout: 'fit',
  30508. border: false,
  30509. html: "<div class=\"editor\"/>",
  30510. autoFocusMethod: true,
  30511. autoFocusStartLine: 0,
  30512. autoFocusStartColumn: 0,
  30513. codeChange: undefined,
  30514. funcArr: [],
  30515. modulePage: null,
  30516. isChangeFromOuter: false,
  30517. name: "",
  30518. /**
  30519. * 设置代码
  30520. */
  30521. setCode: function (value) {
  30522. var _this = this;
  30523. this.code = value;
  30524. _$2.defer(function () {
  30525. _this.isChangeFromOuter = true;
  30526. if (_this.editor) {
  30527. _this.editor.setValue(value);
  30528. if (_this.name === "controllerEditor") {
  30529. _this.funcArr = _this.getAllFunction();
  30530. }
  30531. }
  30532. });
  30533. },
  30534. getCode: function () {
  30535. var _a;
  30536. if (!this.editor) {
  30537. return this.code;
  30538. }
  30539. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30540. },
  30541. applyPosition: function () {
  30542. var _this = this;
  30543. if (this.autoFocusMethod) {
  30544. if (this.editor) {
  30545. _$2.defer(function () {
  30546. if (_this.autoFocusStartLine) {
  30547. _this.editor.setPosition({
  30548. lineNumber: _this.autoFocusStartLine,
  30549. column: _this.autoFocusStartColumn
  30550. });
  30551. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30552. }
  30553. _this.editor.focus();
  30554. });
  30555. delete this.autoFocusMethod;
  30556. }
  30557. }
  30558. this.editor.layout();
  30559. },
  30560. initComponent: function () {
  30561. var that = this;
  30562. this.superclass.initComponent.apply(this, arguments);
  30563. this.on({
  30564. resize: function (sender, width, height) {
  30565. if (that.editor) {
  30566. that.editor.layout();
  30567. }
  30568. },
  30569. destory: function () {
  30570. if (that.editor) {
  30571. that.editor.dispose();
  30572. delete that.editor;
  30573. }
  30574. },
  30575. afterrender: function () {
  30576. var $dom = $(that.el.dom).find('.editor');
  30577. attach_1($dom[0], {
  30578. value: that.code
  30579. }).then(function (editor) {
  30580. that.editor = editor;
  30581. that.applyPosition();
  30582. that.editor.onDidChangeModelContent(function (e) {
  30583. that.fireEvent('change', that.editor, e);
  30584. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30585. that.codeChange(that.editor.getValue(), that.name, e);
  30586. }
  30587. that.isChangeFromOuter = false;
  30588. });
  30589. });
  30590. }
  30591. });
  30592. },
  30593. getAllFunction: function () {
  30594. var funcArr = [];
  30595. var ast = window['YvanUI'].recast.parse(this.code);
  30596. if (ast && ast.program && ast.program.body) {
  30597. if (Array.isArray(ast.program.body)) {
  30598. for (var i = 0; i < ast.program.body.length; i++) {
  30599. var m = ast.program.body[i];
  30600. if (m.type === "ExportDefaultDeclaration") {
  30601. if (m.declaration.type === "ClassDeclaration") {
  30602. if (m.declaration.body.type === "ClassBody") {
  30603. if (Array.isArray(m.declaration.body.body)) {
  30604. for (var j = 0; j < m.declaration.body.body.length; j++) {
  30605. var ob = m.declaration.body.body[j];
  30606. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  30607. var funcItem = { name: ob.key.name, args: [] };
  30608. if (Array.isArray(ob.value.params)) {
  30609. for (var k = 0; k < ob.value.params.length; k++) {
  30610. var p = ob.value.params[k];
  30611. funcItem.args.push(p.name);
  30612. }
  30613. }
  30614. funcArr.push(funcItem);
  30615. }
  30616. }
  30617. }
  30618. }
  30619. }
  30620. }
  30621. }
  30622. }
  30623. }
  30624. return funcArr;
  30625. }
  30626. });
  30627. var isInited = false;
  30628. function attach_1(element, opts) {
  30629. if (!window['monaco']) {
  30630. return;
  30631. }
  30632. var monaco = window['monaco'];
  30633. return new Promise(function (resolve) {
  30634. if (!isInited) {
  30635. isInited = true;
  30636. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  30637. noSemanticValidation: true,
  30638. noSyntaxValidation: false
  30639. });
  30640. // compiler options
  30641. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  30642. target: monaco.languages.typescript.ScriptTarget.ES2016,
  30643. allowNonTsExtensions: true,
  30644. });
  30645. // extra libraries
  30646. var libSource = [
  30647. 'declare class Facts {',
  30648. ' /**',
  30649. ' * Returns the next fact',
  30650. ' */',
  30651. ' static next():string',
  30652. ' static next222():string',
  30653. '}',
  30654. "\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 ",
  30655. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  30656. ].join('\n');
  30657. var libUri = 'file:///index.d.ts';
  30658. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  30659. // When resolving definitions and references, the editor will try to use created models.
  30660. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  30661. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  30662. }
  30663. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  30664. resolve(editor);
  30665. });
  30666. }
  30667. }
  30668. //# sourceMappingURL=JsEditor.js.map
  30669. function initClipboard () {
  30670. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  30671. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  30672. Ext.grid.plugin.Clipboard.override({
  30673. getCellData: function (format, erase) {
  30674. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  30675. if (selection) {
  30676. selection.eachCell(function (cellContext) {
  30677. column = cellContext.column;
  30678. view = cellContext.column.getView();
  30679. record = cellContext.record;
  30680. // Do not copy the check column or row numberer column
  30681. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  30682. return;
  30683. }
  30684. if (lastRecord !== record) {
  30685. lastRecord = record;
  30686. ret.push(row = []);
  30687. }
  30688. dataIndex = column.dataIndex;
  30689. // 记录原始数据
  30690. var rData = record.data[dataIndex];
  30691. if (isRaw) {
  30692. data = record.data[dataIndex];
  30693. }
  30694. else {
  30695. // Try to access the view node.
  30696. viewNode = view.all.item(cellContext.rowIdx);
  30697. // If we could not, it's because it's outside of the rendered block -
  30698. // recreate it.
  30699. if (!viewNode) {
  30700. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  30701. }
  30702. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  30703. data = cell.innerHTML;
  30704. if (isText) {
  30705. data = Ext.util.Format.stripTags(data);
  30706. }
  30707. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  30708. data = data || rData;
  30709. }
  30710. row.push(data);
  30711. if (erase && dataIndex) {
  30712. record.set(dataIndex, null);
  30713. }
  30714. });
  30715. }
  30716. // See decode() comment below
  30717. return Ext.util.TSV.encode(ret, undefined, null);
  30718. },
  30719. getCells: function (format, erase) {
  30720. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  30721. if (selection) {
  30722. selection.eachCell(function (cellContext) {
  30723. record = cellContext.record;
  30724. if (lastRecord !== record) {
  30725. lastRecord = record;
  30726. ret.push(row = {
  30727. model: record.self,
  30728. fields: []
  30729. });
  30730. }
  30731. dataIndex = cellContext.column.dataIndex;
  30732. row.fields.push({
  30733. name: dataIndex,
  30734. value: record.data[dataIndex]
  30735. });
  30736. if (erase && dataIndex) {
  30737. record.set(dataIndex, null);
  30738. }
  30739. });
  30740. }
  30741. return ret;
  30742. },
  30743. getTextData: function (format, erase) {
  30744. return this.getCellData(format, erase);
  30745. },
  30746. putCellData: function (data, format) {
  30747. var _a;
  30748. 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 = {};
  30749. // If the view is not focused, use the first cell of the selection as the destination.
  30750. if (!destination && selected) {
  30751. selected.eachCell(function (c) {
  30752. destination = c;
  30753. return false;
  30754. });
  30755. }
  30756. if (destination) {
  30757. // Create a new Context based upon the outermost View.
  30758. // NavigationModel works on local views.
  30759. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  30760. // At that point, we can use navModel.getPosition()
  30761. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  30762. }
  30763. else {
  30764. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  30765. }
  30766. destinationStartColumn = destination.colIdx;
  30767. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  30768. row = values[sourceRowIdx];
  30769. // Collect new values in dataObject
  30770. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  30771. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  30772. continue;
  30773. }
  30774. dataIndex = destination.column.dataIndex;
  30775. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  30776. if (dataIndex) {
  30777. switch (format) {
  30778. // Raw field values
  30779. case 'raw':
  30780. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30781. break;
  30782. // Textual data with HTML tags stripped
  30783. case 'text':
  30784. {
  30785. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  30786. // 获取字典原始的value
  30787. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  30788. }
  30789. else {
  30790. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30791. }
  30792. break;
  30793. }
  30794. }
  30795. }
  30796. // If we are at the end of the destination row, break the column loop.
  30797. if (destination.colIdx === maxColIdx) {
  30798. break;
  30799. }
  30800. destination.setColumn(destination.colIdx + 1);
  30801. }
  30802. // Update the record in one go.
  30803. destination.record.set(dataObject);
  30804. // If we are at the end of the destination store, break the row loop.
  30805. if (destination.rowIdx === maxRowIdx) {
  30806. break;
  30807. }
  30808. // Jump to next row in destination
  30809. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  30810. }
  30811. },
  30812. putTextData: function (data, format) {
  30813. var _a, _b, _c;
  30814. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  30815. // 根据复制的行数自动添加新的行
  30816. 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;
  30817. if (selected.startCell.rowIdx + values.length >= dataLength) {
  30818. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  30819. this.cmp.getStore().add({});
  30820. }
  30821. }
  30822. this.putCellData(data, format);
  30823. },
  30824. });
  30825. }
  30826. //# sourceMappingURL=clipboard.js.map
  30827. function initDict$1 () {
  30828. var DICT_CACHE = window['DICT_CACHE'];
  30829. if (!DICT_CACHE) {
  30830. DICT_CACHE = {};
  30831. window['DICT_CACHE'] = DICT_CACHE;
  30832. }
  30833. DICT_CACHE.XTYPE = [
  30834. { id: 'datefield', text: '日期' },
  30835. { id: 'datetimefield', text: '日期时间' },
  30836. { id: 'textfield', text: '文本' },
  30837. { id: 'numberfield', text: '数字' },
  30838. { id: 'combo', text: '下拉框' },
  30839. ];
  30840. DICT_CACHE.operator = [
  30841. { id: '=', text: '=' },
  30842. { id: '>', text: '>' },
  30843. { id: '<', text: '<' },
  30844. { id: '>=', text: '>=' },
  30845. { id: '<=', text: '<=' },
  30846. { id: 'in', text: 'in' },
  30847. { id: 'notIn', text: 'notIn' },
  30848. ];
  30849. DICT_CACHE.GRID_MODE = [
  30850. { id: 'edit1', text: '单机编辑模式' },
  30851. { id: 'edit2', text: '双击编辑模式' },
  30852. { id: 'checkbox', text: '勾选' },
  30853. { id: 'checkonly', text: '只勾选' },
  30854. { id: 'select', text: '行选择模式' },
  30855. ];
  30856. DICT_CACHE.BOTH_SELECT = [
  30857. { id: 'N/A', text: '<无>' },
  30858. { id: 'textfield', text: '文本' },
  30859. { id: 'numberfield', text: '数字框' },
  30860. { id: 'datefield', text: '日期' },
  30861. { id: 'datetimefield', text: '日期时间' },
  30862. { id: 'combo', text: '下拉框' },
  30863. { id: 'combogrid', text: '下拉表' },
  30864. { id: 'checkbox', text: '勾选' },
  30865. ];
  30866. DICT_CACHE.ROW_LAYOUT = [
  30867. { id: 'flex', text: '按权重摆放' },
  30868. { id: 'hbox', text: '按宽度摆放' },
  30869. ];
  30870. DICT_CACHE.GRID_XTYPE = [
  30871. { id: 'N/A', text: '<无>' },
  30872. { id: 'textfield', text: '文本-textfield' },
  30873. { id: 'numberfield', text: '数字框-numberfield' },
  30874. { id: 'datefield', text: '日期-datefield' },
  30875. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30876. { id: 'combo', text: '下拉框-combo' },
  30877. { id: 'combogrid', text: '下拉表-combogrid' },
  30878. { id: 'checkbox', text: '勾选-checkbox' },
  30879. ];
  30880. DICT_CACHE.FORM_XTYPE = [
  30881. { id: 'N/A', text: '<无>' },
  30882. { id: 'textfield', text: '文本-textfield' },
  30883. { id: 'numberfield', text: '数字框-numberfield' },
  30884. { id: 'datefield', text: '日期-datefield' },
  30885. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30886. { id: 'combo', text: '下拉框-combo' },
  30887. { id: 'combogrid', text: '下拉表-combogrid' },
  30888. { id: 'checkbox', text: '勾选-checkbox' },
  30889. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  30890. ];
  30891. DICT_CACHE.GRID_FORMATTER = [
  30892. { id: 'N/A', text: '默认' },
  30893. { id: 'rownum', text: '序号-rownum' },
  30894. { id: 'button', text: '按钮-button' },
  30895. { id: 'checkbox', text: '勾选-checkbox' },
  30896. { id: 'progres', text: '进度条-progres' },
  30897. ];
  30898. }
  30899. //# sourceMappingURL=dict.js.map
  30900. function initDesigner () {
  30901. Ext.define('com.yvan.studio.designer', {
  30902. extend: 'Ext.panel.Panel',
  30903. alias: 'widget.designer',
  30904. xtype: 'designer',
  30905. layout: 'fit',
  30906. items: [],
  30907. constructor: function (config) {
  30908. var self = this;
  30909. var newConfig = _$2.defaultsDeep({
  30910. // 强制性属性
  30911. }, config);
  30912. this.superclass.constructor.call(self, newConfig);
  30913. },
  30914. initComponent: function () {
  30915. var me = this;
  30916. me.on({
  30917. afterrender: function () {
  30918. }
  30919. });
  30920. this.superclass.initComponent.call(me);
  30921. }
  30922. });
  30923. }
  30924. //# sourceMappingURL=designer.js.map
  30925. var FixClass = /** @class */ (function () {
  30926. function FixClass() {
  30927. }
  30928. FixClass.prototype.fix = function (me, config) {
  30929. var _this = this;
  30930. if (isDesignMode(me, config)) {
  30931. return;
  30932. }
  30933. if (!config) {
  30934. return;
  30935. }
  30936. var fix = config.fix;
  30937. if (!fix) {
  30938. return;
  30939. }
  30940. delete config.fix;
  30941. // 这里有个 bug
  30942. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  30943. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  30944. var scope;
  30945. if (config.$initParent) {
  30946. // 在面板上的组件
  30947. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30948. }
  30949. else if (config.column) {
  30950. // 在列上的组件
  30951. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30952. }
  30953. if (_$2.isArray(fix)) {
  30954. _$2.each(fix, function (f) {
  30955. var fn = lookupFn(scope, f);
  30956. fn.call(_this, me, config);
  30957. });
  30958. }
  30959. else if (_$2.isString(fix)) {
  30960. var fn = lookupFn(scope, fix);
  30961. fn.call(this, me, config);
  30962. }
  30963. };
  30964. __decorate([
  30965. baseConfigProcess(),
  30966. __metadata("design:type", Function),
  30967. __metadata("design:paramtypes", [Object, Object]),
  30968. __metadata("design:returntype", void 0)
  30969. ], FixClass.prototype, "fix", null);
  30970. return FixClass;
  30971. }());
  30972. //# sourceMappingURL=fix.js.map
  30973. function init$2() {
  30974. // 引入 filters 过滤插件
  30975. Ext.require([
  30976. 'Ext.grid.filters.Filters'
  30977. ]);
  30978. // 启用 tooltip 快捷提示
  30979. Ext.QuickTips.init();
  30980. // 定义日期格式化方法
  30981. if (Ext.util && Ext.util.Format) {
  30982. Ext.apply(Ext.util.Format, {
  30983. dateFormat: 'Y-m-d'
  30984. });
  30985. }
  30986. Ext.form.field.Display.override({
  30987. cls: 'yvan-display-field',
  30988. labelAlign: 'right'
  30989. });
  30990. Ext.define("Ext.locale.zh_CN.picker.Date", {
  30991. override: "Ext.picker.Date",
  30992. format: "Y-m-d",
  30993. });
  30994. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  30995. override: "Ext.form.field.Date",
  30996. format: "Y-m-d",
  30997. });
  30998. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  30999. override: "Ext.grid.PropertyColumnModel",
  31000. format: "Y-m-d",
  31001. });
  31002. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  31003. override: "Ext.view.AbstractView",
  31004. loadingText: "读取中..."
  31005. });
  31006. Ext.LoadMask.prototype.msg = '请稍后...';
  31007. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  31008. override: "Ext.grid.header.Container",
  31009. sortClearText: '不排序',
  31010. sortAscText: "正序",
  31011. sortDescText: "倒序",
  31012. lockText: "锁定列",
  31013. unlockText: "解除锁定",
  31014. columnsText: "字段隐藏"
  31015. });
  31016. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  31017. override: "Ext.grid.filters.filter.Date",
  31018. fields: {
  31019. lt: { text: '之前' },
  31020. gt: { text: '之后' },
  31021. eq: { text: '相等' },
  31022. },
  31023. // Defaults to Ext.Date.defaultFormat
  31024. dateFormat: null
  31025. });
  31026. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  31027. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  31028. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  31029. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  31030. override: "Ext.grid.locking.Lockable",
  31031. lockText: "锁定",
  31032. unlockText: '解锁',
  31033. });
  31034. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  31035. override: "Ext.grid.filters.Filters",
  31036. menuFilterText: "过滤"
  31037. });
  31038. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  31039. override: "Ext.grid.filters.filter.Boolean",
  31040. yesText: "已钩选",
  31041. noText: "未勾选"
  31042. });
  31043. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  31044. override: "Ext.grid.filters.filter.String",
  31045. emptyText: "输入过滤文本..."
  31046. });
  31047. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  31048. override: "Ext.grid.filters.filter.Number",
  31049. emptyText: "输入数字..."
  31050. });
  31051. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  31052. override: "Ext.PagingToolbar",
  31053. beforePageText: "第",
  31054. // update
  31055. afterPageText: "/ {0} 页",
  31056. // update
  31057. firstText: "第一页",
  31058. prevText: "上一页",
  31059. // update
  31060. nextText: "下一页",
  31061. lastText: "最后页",
  31062. refreshText: "刷新",
  31063. displayMsg: "总共 {2} 条",
  31064. // update
  31065. emptyMsg: '没有数据'
  31066. });
  31067. /**
  31068. * 改变事件的获取方式.
  31069. * 具体见: ext-all-debug.js:23216 addListener
  31070. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  31071. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  31072. */
  31073. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  31074. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  31075. if (typeof fn === 'string' &&
  31076. (_$2.startsWith(fn, 'scope.') ||
  31077. _$2.startsWith(fn, 'system.') ||
  31078. _$2.startsWith(fn, 'format.'))) {
  31079. scope = lookupScope(this);
  31080. if (isDesignMode(scope, undefined)) {
  31081. fn = Ext.emptyFn;
  31082. }
  31083. else {
  31084. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  31085. // const vm = this.lookupViewModel()
  31086. // if (vm && vm.yvanScope) {
  31087. // scope = vm.yvanScope
  31088. // fn = scope[fn.substr('scope.'.length)]
  31089. // }
  31090. fn = lookupFn(scope, fn, this);
  31091. }
  31092. }
  31093. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  31094. };
  31095. // 将 SystemLib 扩展到 window.system 下
  31096. if (!window['system']) {
  31097. window['system'] = {};
  31098. }
  31099. _$2.extend(window['system'], SystemLib);
  31100. _$2.extend(window['system'], {
  31101. showGridRowDetail: showGridRowDetail
  31102. });
  31103. Ext.apply(Ext.util.Format, {
  31104. // 百分比
  31105. percentRenderer: function (v, rd, model) {
  31106. if (!v) {
  31107. v = 0;
  31108. }
  31109. if (typeof v === 'string') {
  31110. v = parseInt(v);
  31111. }
  31112. var valueString = v.toFixed(2);
  31113. var valueFixed = v > 100 ? 100 : v;
  31114. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  31115. var cls = '';
  31116. if (v < 90) {
  31117. cls = 'danger';
  31118. }
  31119. else if (v < 100) {
  31120. cls = 'warning';
  31121. }
  31122. else {
  31123. cls = 'success';
  31124. }
  31125. return Ext.String
  31126. .format(
  31127. // '<div>'
  31128. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  31129. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  31130. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  31131. // + '</div></div>', valueString, valueFixed, cls);
  31132. '<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(
  31133. // '<div>'
  31134. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  31135. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  31136. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  31137. // + '</div></div>', v, valueFixed, valueString);
  31138. },
  31139. //button
  31140. button: function (v, rd, model) {
  31141. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  31142. }
  31143. });
  31144. initComponent();
  31145. initPanel();
  31146. initGridColumn();
  31147. initTree();
  31148. initGrid();
  31149. initMainTab();
  31150. initTextfield();
  31151. initCombo();
  31152. initTag();
  31153. initContainer();
  31154. initRows();
  31155. initCols();
  31156. initForm();
  31157. initToolbar();
  31158. initSplitter();
  31159. initButton();
  31160. initStores();
  31161. initSearch();
  31162. initMultipleSearch();
  31163. initDate();
  31164. initDateTimePicker();
  31165. initDateTime();
  31166. initNumber();
  31167. initCheckbox();
  31168. initCheckboxGroup();
  31169. initRadio();
  31170. initRadioGroup();
  31171. initFieldset();
  31172. initCombotree();
  31173. initPickerPlus();
  31174. initCombogrid();
  31175. initComboGridMulti();
  31176. initIframe();
  31177. initBpmn();
  31178. initSqlEditor$1();
  31179. initJsonEditor$1();
  31180. initJsEditor$1();
  31181. initClipboard();
  31182. initSqlComplex();
  31183. initParamComplex();
  31184. initDict$1();
  31185. initDesigner();
  31186. }
  31187. //# sourceMappingURL=init.js.map
  31188. /**
  31189. * 创建一个 Ajax 客户端
  31190. */
  31191. function createAjax(createOption) {
  31192. if (createOption.baseUrl) {
  31193. axios__default.defaults.baseURL = createOption.baseUrl;
  31194. axios__default.defaults.timeout = createOption.timeout;
  31195. storeAjax.timeout = createOption.timeout;
  31196. axios__default.defaults.timeoutErrorMessage = '网络超时';
  31197. }
  31198. return function (option) {
  31199. //@ts-ignore
  31200. option.method = (option.method || 'get').toLocaleLowerCase();
  31201. //@ts-ignore
  31202. var ax = __assign({}, option);
  31203. switch (option.method) {
  31204. case 'get':
  31205. ax.method = 'GET';
  31206. ax.params = option.param;
  31207. ax.headers = __assign({}, option.headers);
  31208. break;
  31209. case 'post':
  31210. ax.method = 'POST';
  31211. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  31212. ax.params = option.param;
  31213. ax.data = Qs.stringify(option.data);
  31214. break;
  31215. case 'put':
  31216. case 'patch':
  31217. case 'delete':
  31218. ax.method = option.method;
  31219. ax.headers = option.headers;
  31220. ax.params = option.param;
  31221. ax.data = Qs.stringify(option.data);
  31222. break;
  31223. case 'download':
  31224. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  31225. return new Promise(function (resolver, reject) {
  31226. });
  31227. case "invoke":
  31228. ax.url = serverInvokeUrlTransform(option.url, option);
  31229. ax.method = 'POST';
  31230. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31231. if (typeof option.args === 'object') {
  31232. ax.data = JSON.stringify({
  31233. args: option.args,
  31234. });
  31235. }
  31236. else {
  31237. ax.data = JSON.stringify({
  31238. args: [
  31239. __assign(__assign({}, option.data), option.param)
  31240. ],
  31241. filterModel: option.filterModel,
  31242. sortModel: option.sortModel
  31243. });
  31244. }
  31245. break;
  31246. case 'post-json':
  31247. ax.method = 'POST';
  31248. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31249. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  31250. break;
  31251. case 'post-file':
  31252. //TODO 刘壮. 上传文件
  31253. var forms = new FormData();
  31254. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  31255. _$2.forOwn(option.data, function (value, key) {
  31256. if (key === 'files') {
  31257. var i_1 = 0;
  31258. _$2.each(value, function (f) {
  31259. // @ts-ignore
  31260. forms.append('file' + (++i_1), f);
  31261. });
  31262. }
  31263. else {
  31264. forms.append(key, value);
  31265. }
  31266. });
  31267. ax.data = forms;
  31268. ax.method = 'POST';
  31269. break;
  31270. case "sql":
  31271. ax.url = sqlUrlTransform(option.url);
  31272. ax.method = 'POST';
  31273. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31274. ax.data = JSON.stringify({
  31275. args: [option.data],
  31276. db: option.db,
  31277. filterModel: option.filterModel,
  31278. sortModel: option.sortModel
  31279. });
  31280. break;
  31281. default:
  31282. throw new Error('not implements');
  31283. }
  31284. return new Promise(function (resolver, reject) {
  31285. axios__default(ax).then(function (resolverRaw) {
  31286. var apiResult = {
  31287. rawData: resolverRaw.data,
  31288. status: resolverRaw.status,
  31289. success: (resolverRaw.data && resolverRaw.data.success),
  31290. data: resolverRaw.data.data,
  31291. pagination: resolverRaw.data.pagination,
  31292. msg: (resolverRaw.data.msg),
  31293. errors: resolverRaw.data.errors,
  31294. headers: resolverRaw.headers
  31295. };
  31296. if (typeof window['apiTranslate'] === 'function') {
  31297. window['apiTranslate'](apiResult.rawData, option.url);
  31298. }
  31299. resolver(apiResult);
  31300. }).catch(function (reason) {
  31301. reject(reason);
  31302. });
  31303. });
  31304. };
  31305. }
  31306. function downLoad(downLoadUrl, filename, data, header, isJson) {
  31307. if (isJson === void 0) { isJson = false; }
  31308. var YvanUI = _$2.get(window, 'YvanUI');
  31309. YvanUI.loading();
  31310. var createObjectURL = function (object) {
  31311. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  31312. };
  31313. // const formData = new FormData();
  31314. // _.forOwn(data, (v, k) => {
  31315. // formData.append(k, v);
  31316. // });
  31317. var formData = '';
  31318. var xhr = new XMLHttpRequest();
  31319. xhr.open('POST', downLoadUrl);
  31320. xhr.responseType = 'blob';
  31321. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  31322. if (isJson) {
  31323. formData = data ? JSON.stringify(data) : '';
  31324. xhr.setRequestHeader('Content-Type', 'application/json');
  31325. }
  31326. else {
  31327. formData = data ? Qs.stringify(data) : '';
  31328. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  31329. }
  31330. //
  31331. if (header) {
  31332. _$2.forOwn(header, function (v, k) {
  31333. xhr.setRequestHeader(k, v);
  31334. });
  31335. }
  31336. xhr.onload = function (e) {
  31337. if (this.status === 200) {
  31338. var blob = this.response;
  31339. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  31340. navigator.msSaveBlob(blob, filename);
  31341. YvanUI.clearLoading();
  31342. }
  31343. else {
  31344. var a = document.createElement('a');
  31345. var url = createObjectURL(blob);
  31346. a.href = url;
  31347. a.download = filename;
  31348. document.append(a);
  31349. a.click();
  31350. a.remove();
  31351. window.URL.revokeObjectURL(url);
  31352. YvanUI.clearLoading();
  31353. }
  31354. }
  31355. };
  31356. xhr.send(formData);
  31357. }
  31358. //# sourceMappingURL=ajax.js.map
  31359. function readExcel(file) {
  31360. return new Promise(function (resolve, reject) {
  31361. if (!file) {
  31362. reject("文件读取失败!!!");
  31363. return;
  31364. }
  31365. var reader = new FileReader();
  31366. reader.onload = function (e) {
  31367. if (e.target) {
  31368. var data = e.target.result;
  31369. var workbook = XLSX.read(data, { type: 'binary' });
  31370. resolve(workbook);
  31371. }
  31372. else {
  31373. reject("文件读取失败!!!");
  31374. }
  31375. };
  31376. try {
  31377. reader.readAsBinaryString(file);
  31378. }
  31379. catch (e) {
  31380. reject(e);
  31381. }
  31382. });
  31383. }
  31384. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  31385. if (dataStartRow === void 0) { dataStartRow = 2; }
  31386. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  31387. if (rowValidate === void 0) { rowValidate = undefined; }
  31388. if (otherValidate === void 0) { otherValidate = undefined; }
  31389. if (fieldValidate === void 0) { fieldValidate = undefined; }
  31390. return new Promise(function (resolve, reject) {
  31391. var promiseArr = [];
  31392. for (var i = 0; i < columnsSet.length; i++) {
  31393. var fix = columnsSet[i].fix;
  31394. if (_$2.isArray(fix) && fix.length > 0) {
  31395. var ss = fix[0].toLowerCase();
  31396. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31397. columnsSet[i].importFormatter = function (vdata) {
  31398. // @ts-ignore
  31399. return window.moment(vdata.ov) - 0;
  31400. };
  31401. }
  31402. else {
  31403. var fn = lookupFn(topScope, fix[0]);
  31404. promiseArr.push(fn(null, columnsSet[i]));
  31405. delete columnsSet[i].fix;
  31406. }
  31407. }
  31408. else if (_$2.isString(fix)) {
  31409. var ss = fix.toLowerCase();
  31410. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31411. columnsSet[i].importFormatter = function (vdata) {
  31412. // @ts-ignore
  31413. return window.moment(vdata.ov) - 0;
  31414. };
  31415. }
  31416. else {
  31417. var fn = lookupFn(topScope, fix);
  31418. promiseArr.push(fn(null, columnsSet[i]));
  31419. delete columnsSet[i].fix;
  31420. }
  31421. }
  31422. }
  31423. var read = function () {
  31424. readExcel(file).then(function (workbook) {
  31425. var sheetNames = workbook.SheetNames; // 工作表名称集合
  31426. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  31427. var titleRowValue = [];
  31428. var titleRowKey = [];
  31429. var needLoop = false; // 是否需要迭代
  31430. var columns = [];
  31431. if (worksheet && worksheet["!ref"]) {
  31432. var t = worksheet["!ref"];
  31433. var tempArr = t.split(':');
  31434. if (tempArr.length >= 2) {
  31435. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  31436. // 选取title的行,删除之前的行
  31437. if (titleRowNumber > firstRowNumber) {
  31438. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  31439. for (var key in worksheet) {
  31440. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  31441. delete worksheet[key];
  31442. }
  31443. }
  31444. }
  31445. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  31446. firstRowNumber = titleRowNumber + '';
  31447. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  31448. }
  31449. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  31450. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  31451. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  31452. for (var key in worksheet) {
  31453. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  31454. titleRowKey.push(key);
  31455. titleRowValue.push(worksheet[key].v);
  31456. }
  31457. }
  31458. if (columnsSet && columnsSet.length > 0) {
  31459. var length = columnsSet.length;
  31460. length = length <= titleRowKey.length ? length : titleRowKey.length;
  31461. for (var i = 0; i < length; i++) {
  31462. var vk = titleRowKey[i];
  31463. var item = columnsSet[i];
  31464. var column = {};
  31465. if (typeof item === 'string') {
  31466. column.dataIndex = item;
  31467. column.header = worksheet[vk].v;
  31468. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  31469. }
  31470. else if (typeof item.dataIndex === "string") {
  31471. column.dataIndex = item.dataIndex;
  31472. column.header = worksheet[vk].v;
  31473. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  31474. if (typeof item.validate === "function") {
  31475. column.validate = item.validate;
  31476. needLoop = true;
  31477. }
  31478. if (typeof item.importFormatter === "function") {
  31479. column.importFormatter = item.importFormatter;
  31480. needLoop = true;
  31481. }
  31482. if ((item.data instanceof Array && item.data.length > 0)
  31483. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  31484. column.data = item.data;
  31485. needLoop = true;
  31486. }
  31487. }
  31488. columns.push(column);
  31489. }
  31490. }
  31491. }
  31492. }
  31493. if (fieldValidate && typeof fieldValidate === "function") {
  31494. if (fieldValidate(columns, titleRowValue) !== true) {
  31495. reject("fields validate error");
  31496. return;
  31497. }
  31498. }
  31499. var allData = XLSX.utils.sheet_to_json(worksheet);
  31500. var okData = [], errorData = [], errorMsgData = [];
  31501. var needItemLoop = needLoop;
  31502. if (rowValidate && typeof rowValidate === "function") {
  31503. needLoop = true;
  31504. }
  31505. if (needLoop === true) {
  31506. for (var index = 0; index < allData.length; index++) {
  31507. var row = allData[index];
  31508. var rowNumber = dataStartRow + index;
  31509. row.__importID__ = rowNumber;
  31510. var isRowOk = true;
  31511. if (needItemLoop) {
  31512. var _loop_1 = function (num) {
  31513. var column = columns[num];
  31514. var ov = row[column.dataIndex];
  31515. var nv = ov;
  31516. var hasError = false;
  31517. var rowNumber_1 = dataStartRow + index;
  31518. var ei = {
  31519. errorId: rowNumber_1 + '_' + column.dataIndex,
  31520. importID: rowNumber_1,
  31521. dataIndex: column.dataIndex,
  31522. header: column.header,
  31523. value: ov,
  31524. errormessage: ""
  31525. };
  31526. // 格式化
  31527. if (column.data instanceof Array) {
  31528. nv = undefined;
  31529. ei.errormessage = "字典匹配失败";
  31530. _$2.forEach(column.data, function (v, index) {
  31531. if (v.text === ov) {
  31532. nv = v.id;
  31533. return;
  31534. }
  31535. });
  31536. }
  31537. else if (_$2.isPlainObject(column.data)) {
  31538. nv = undefined;
  31539. ei.errormessage = "字典匹配失败";
  31540. _$2.forEach(column.data, function (value, key) {
  31541. if (value === ov) {
  31542. nv = key;
  31543. return;
  31544. }
  31545. });
  31546. }
  31547. if (typeof column.importFormatter === 'function') {
  31548. var vdata = {
  31549. column: column,
  31550. ov: ov,
  31551. nv: nv,
  31552. rowIndex: index,
  31553. data: row,
  31554. rowDatas: allData
  31555. };
  31556. nv = undefined;
  31557. ei.errormessage = "格式化失败";
  31558. nv = column.importFormatter(vdata);
  31559. }
  31560. if (!nv && nv != 0) {
  31561. hasError = true;
  31562. }
  31563. else {
  31564. row[column.dataIndex] = nv;
  31565. ei.errormessage = "";
  31566. }
  31567. // 校验
  31568. if (typeof column.validate === 'function') {
  31569. var vdata = {
  31570. column: column,
  31571. ov: ov,
  31572. nv: nv,
  31573. rowIndex: index,
  31574. data: row,
  31575. rowDatas: allData
  31576. };
  31577. var errormessage = column.validate(vdata);
  31578. if (errormessage === true) ;
  31579. else {
  31580. hasError = true;
  31581. ei.errormessage = ei.errormessage + "/" + errormessage;
  31582. }
  31583. }
  31584. if (hasError === true) {
  31585. isRowOk = false;
  31586. errorMsgData.push(ei);
  31587. }
  31588. };
  31589. for (var num = 0; num < columns.length; num++) {
  31590. _loop_1(num);
  31591. }
  31592. }
  31593. if (rowValidate && typeof rowValidate === "function") {
  31594. var errormessage = rowValidate({
  31595. columns: columns,
  31596. data: row,
  31597. rowIndex: index,
  31598. rowDatas: allData
  31599. });
  31600. if (errormessage === true) ;
  31601. else {
  31602. isRowOk = false;
  31603. var ei = {
  31604. errorId: rowNumber + '',
  31605. dataIndex: "row",
  31606. header: "数据行",
  31607. value: "当前行的数据",
  31608. importID: rowNumber,
  31609. errormessage: errormessage
  31610. };
  31611. errorMsgData.push(ei);
  31612. }
  31613. }
  31614. row.__hasError__ = !isRowOk;
  31615. if (isRowOk === true) {
  31616. okData.push(row);
  31617. }
  31618. else {
  31619. errorData.push(row);
  31620. }
  31621. }
  31622. }
  31623. else {
  31624. // 添加数据的唯一标识
  31625. for (var index = 0; index < allData.length; index++) {
  31626. var row = allData[index];
  31627. var rowNumber = dataStartRow + index;
  31628. row.__importID__ = rowNumber;
  31629. row.__hasError__ = false;
  31630. }
  31631. okData = allData;
  31632. }
  31633. if (otherValidate && typeof otherValidate === "function") {
  31634. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  31635. }
  31636. else {
  31637. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  31638. }
  31639. // clearLoading()
  31640. }).catch(function (e) {
  31641. reject(e);
  31642. });
  31643. };
  31644. if (promiseArr.length > 0) {
  31645. Promise.all(promiseArr).then(function (resArr) {
  31646. for (var i = 0; i < resArr.length; i++) {
  31647. var tmp = resArr[i];
  31648. tmp.config.data = [];
  31649. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  31650. if (tmp.r.field.length > 1) {
  31651. var keyKey = tmp.r.field[0];
  31652. var valueKey = tmp.r.field[1];
  31653. for (var j = 0; j < tmp.r.data.length; j++) {
  31654. var it = tmp.r.data[j];
  31655. var newIt = {};
  31656. newIt.id = it[keyKey];
  31657. newIt.text = it[valueKey];
  31658. tmp.config.data.push(newIt);
  31659. }
  31660. }
  31661. }
  31662. }
  31663. read();
  31664. });
  31665. }
  31666. else {
  31667. setTimeout(read, 50);
  31668. }
  31669. });
  31670. }
  31671. //# sourceMappingURL=xlsx.js.map
  31672. var ExcelImportDialog = /** @class */ (function (_super) {
  31673. __extends(ExcelImportDialog, _super);
  31674. function ExcelImportDialog(option) {
  31675. var _this = this;
  31676. var vjson = vjsonFunc(option);
  31677. _this = _super.call(this, { model: model$p, vjson: vjson }) || this;
  31678. _this.importExcelOption = option;
  31679. return _this;
  31680. }
  31681. ExcelImportDialog.prototype.onLoad = function () {
  31682. _super.prototype.onLoad.call(this);
  31683. };
  31684. ExcelImportDialog.prototype.fileChange = function (sender) {
  31685. var _this = this;
  31686. var file = sender.fileInputEl.dom.files[0];
  31687. // const senderScope = lookupScope(sender)
  31688. var topScope = this.topScope;
  31689. var rowValidate = this.importExcelOption.rowValidate;
  31690. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  31691. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  31692. }
  31693. var afterClientValidate = this.importExcelOption.afterClientValidate;
  31694. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  31695. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  31696. }
  31697. var fieldValidate = this.importExcelOption.fieldValidate;
  31698. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  31699. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  31700. }
  31701. this.setLoading(true);
  31702. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  31703. _this.importData = res;
  31704. _this.refs.dataGrid.setData(res.allData);
  31705. _this.viewModel.set("dataCount", res.allData.length);
  31706. _this.refs.errGrid.setData(res.errorMsgData);
  31707. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  31708. }).catch(function (e) {
  31709. _this.importData = null;
  31710. _this.refs.dataGrid.setData();
  31711. _this.refs.errGrid.setData();
  31712. msg(e.toString());
  31713. }).finally(function () {
  31714. _this.setLoading(false);
  31715. });
  31716. };
  31717. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  31718. if (record.get('__hasError__')) {
  31719. return "x-grid-record-bg-red";
  31720. }
  31721. };
  31722. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  31723. return "x-grid-record-bg-red";
  31724. };
  31725. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  31726. var _a;
  31727. var id = record.data.__importID__;
  31728. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  31729. var selectRecord = null;
  31730. var dataIndex = -1;
  31731. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31732. for (var i = 0; i < rows.length; i++) {
  31733. if (rows[i].importID === id) {
  31734. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31735. dataIndex = i;
  31736. }
  31737. if (rows[i].errorId === id + "_" + subId) {
  31738. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31739. dataIndex = i;
  31740. break;
  31741. }
  31742. }
  31743. if (selectRecord) {
  31744. this.refs.errGrid.ensureVisible(selectRecord);
  31745. this.refs.errGrid.selModel.select(dataIndex);
  31746. // this.refs.errGrid.reload()
  31747. }
  31748. };
  31749. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  31750. var _a;
  31751. var id = record.data.importID;
  31752. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31753. var selectRecord = null;
  31754. var dataIndex = -1;
  31755. for (var i = 0; i < rows.length; i++) {
  31756. if (rows[i].__importID__ === id) {
  31757. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  31758. dataIndex = i;
  31759. break;
  31760. }
  31761. }
  31762. if (selectRecord) {
  31763. this.refs.dataGrid.ensureVisible(selectRecord);
  31764. this.refs.dataGrid.selModel.select(dataIndex);
  31765. // this.refs.dataGrid.reload()
  31766. }
  31767. };
  31768. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  31769. this.viewModel.set("dataType", newValue);
  31770. if (this.importData) {
  31771. this.refs.dataGrid.setData(this.importData[newValue]);
  31772. this.viewModel.set("dataCount", this.importData[newValue].length);
  31773. }
  31774. };
  31775. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  31776. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  31777. window.location.href = this.importExcelOption.dowLoadUrl;
  31778. return;
  31779. }
  31780. var xt = [];
  31781. _$2.forEach(this.importExcelOption.columns, function (v) {
  31782. xt.push(v.header);
  31783. });
  31784. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  31785. if (filename.endsWith(".xlsx")) {
  31786. filename = filename.split(".xlsx")[0];
  31787. }
  31788. filename = filename + ".xlsx";
  31789. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  31790. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  31791. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  31792. XLSX.writeFile(wb, filename); //导出Excel
  31793. };
  31794. ExcelImportDialog.prototype.getData = function (sender) {
  31795. _$2.each(this.importData.okData, function (item) {
  31796. delete item.id;
  31797. delete item.__hasError__;
  31798. delete item.__importID__;
  31799. delete item._origin;
  31800. });
  31801. _$2.each(this.importData.allData, function (item) {
  31802. delete item.id;
  31803. delete item.__hasError__;
  31804. delete item.__importID__;
  31805. delete item._origin;
  31806. });
  31807. _$2.each(this.importData.errorData, function (item) {
  31808. delete item.id;
  31809. delete item.__hasError__;
  31810. delete item.__importID__;
  31811. delete item._origin;
  31812. });
  31813. this.dialogSuccess(this.importData);
  31814. };
  31815. return ExcelImportDialog;
  31816. }(Scope));
  31817. var model$p = {
  31818. data: {
  31819. dataType: "all",
  31820. errMsgCount: 0,
  31821. dataCount: 0
  31822. }
  31823. };
  31824. var vjsonFunc = function (option) {
  31825. return {
  31826. title: option.title || 'excel导入',
  31827. layout: 'fit',
  31828. items: [
  31829. {
  31830. layout: 'border',
  31831. tbar: {
  31832. xtype: "form",
  31833. items: [
  31834. {
  31835. xtype: "cols",
  31836. items: [
  31837. {
  31838. xtype: "filefield",
  31839. fieldLabel: 'excel文件',
  31840. buttonText: '请选择excel文件',
  31841. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  31842. flex: 3,
  31843. listeners: {
  31844. change: "scope.fileChange"
  31845. }
  31846. }, {
  31847. xtype: "button",
  31848. iconCls: "x-fa fa-download",
  31849. text: "下载模版",
  31850. listeners: {
  31851. click: "scope.downloadTemplate"
  31852. }
  31853. }, {
  31854. xtype: 'container',
  31855. border: false,
  31856. layout: 'hbox',
  31857. }, {
  31858. xtype: "button",
  31859. iconCls: "x-fa fa-upload",
  31860. text: option.tQButtonText || "提取数据",
  31861. listeners: {
  31862. click: "scope.getData"
  31863. }
  31864. }
  31865. ]
  31866. },
  31867. ]
  31868. },
  31869. items: [
  31870. {
  31871. tbar: {
  31872. xtype: "toolbar",
  31873. title: "导入的数据",
  31874. items: [{
  31875. xtype: 'label',
  31876. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  31877. }, {
  31878. xtype: 'radiogroup',
  31879. items: [
  31880. {
  31881. boxLabel: '所有数据',
  31882. checked: true,
  31883. inputValue: 'allData',
  31884. }, {
  31885. boxLabel: '正确数据',
  31886. inputValue: 'okData',
  31887. }, {
  31888. boxLabel: '错误数据',
  31889. inputValue: 'errorData',
  31890. }
  31891. ],
  31892. listeners: {
  31893. change: 'scope.filterData',
  31894. },
  31895. }, {
  31896. xtype: "textfield",
  31897. readOnly: true,
  31898. fieldLabel: "条目数",
  31899. bind: "{dataCount}"
  31900. }]
  31901. },
  31902. xtype: 'yvgrid',
  31903. reference: 'dataGrid',
  31904. layout: 'fit',
  31905. pagination: false,
  31906. // pageSize: 50,
  31907. getRowClass: 'scope.getDataGridRowRecord',
  31908. columns: option.columns,
  31909. region: 'center',
  31910. split: true,
  31911. listeners: {
  31912. cellclick: "scope.dataGridClick",
  31913. },
  31914. selModel: {
  31915. // type: 'rowmodel',
  31916. mode: 'SINGLE',
  31917. },
  31918. }, {
  31919. tbar: {
  31920. xtype: "toolbar", items: [
  31921. {
  31922. xtype: 'label',
  31923. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  31924. }, {
  31925. xtype: "textfield",
  31926. readOnly: true,
  31927. fieldLabel: "条目数",
  31928. bind: "{errMsgCount}"
  31929. }
  31930. ]
  31931. },
  31932. xtype: 'yvgrid',
  31933. reference: 'errGrid',
  31934. layout: 'fit',
  31935. pagination: false,
  31936. getRowClass: 'scope.getErrGridRowRecord',
  31937. height: "40%",
  31938. columns: [
  31939. { dataIndex: "errorId", header: "ID", hidden: true },
  31940. { dataIndex: "importID", header: "行号", width: 80 },
  31941. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  31942. { dataIndex: "value", header: "值", width: 120 },
  31943. { dataIndex: "header", header: "字段名", width: 120 },
  31944. { dataIndex: "dataIndex", header: "字段", width: 120 }
  31945. ],
  31946. region: 'south',
  31947. split: true,
  31948. listeners: {
  31949. itemclick: "scope.errGridClick"
  31950. },
  31951. selModel: {
  31952. // type: 'rowmodel',
  31953. mode: 'SINGLE',
  31954. },
  31955. },
  31956. ],
  31957. },
  31958. ],
  31959. referenceHolder: true,
  31960. };
  31961. };
  31962. //# sourceMappingURL=ExcelImportDialog.js.map
  31963. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  31964. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  31965. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  31966. ret.report_id = reportId;
  31967. ret.report = report;
  31968. return ret;
  31969. }
  31970. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  31971. var e_1, _a, e_2, _b;
  31972. var model = {
  31973. data: {
  31974. report_name: config.report_name,
  31975. query: {},
  31976. sum: {},
  31977. }
  31978. };
  31979. var json5 = window['YvanUI'].json5;
  31980. var report = config.report ? json5.parse(config.report) : {};
  31981. var conditionRows = [];
  31982. var sumRows = [];
  31983. model.data.has_sum = _$2.size(report.summary) > 0;
  31984. // query 查询条件
  31985. var newRow = false;
  31986. var currentRow = { xtype: 'cols', items: [], };
  31987. conditionRows.push(currentRow);
  31988. _$2.forEach(report.query, function (item) {
  31989. if (newRow) {
  31990. currentRow = { xtype: 'cols', items: [], };
  31991. conditionRows.push(currentRow);
  31992. }
  31993. var vj = json5.parse(item.conditionFieldExtend);
  31994. if (item.conditionFieldXtype) {
  31995. vj.xtype = item.conditionFieldXtype;
  31996. if (item.conditionFieldXtype === 'combo') {
  31997. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  31998. }
  31999. if (item.conditionFieldXtype === 'datetimefield') {
  32000. //@ts-ignore
  32001. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  32002. }
  32003. else if (item.conditionFieldXtype === 'datefield') {
  32004. //@ts-ignore
  32005. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  32006. }
  32007. else {
  32008. model.data.query[item.conditionFieldBind] = '';
  32009. }
  32010. }
  32011. else {
  32012. // 没有组件类型,是个空占位符
  32013. vj.border = false;
  32014. }
  32015. if (item.conditionFieldBind) {
  32016. vj.bind = {
  32017. value: '{query.' + item.conditionFieldBind + '}'
  32018. };
  32019. }
  32020. if (item.conditionFieldFlex) {
  32021. vj.flex = item.conditionFieldFlex;
  32022. }
  32023. if (item.conditionFieldXtype) {
  32024. vj.fieldLabel = item.conditionFieldLabel;
  32025. }
  32026. if (item.fieldLabel) {
  32027. vj.fieldLabel = item.fieldLabel;
  32028. }
  32029. newRow = item.conditionFieldWrap || false;
  32030. currentRow.items.push(vj);
  32031. });
  32032. if (currentRow) {
  32033. currentRow.margin = '10 0 10 0';
  32034. }
  32035. // sum 汇总条件
  32036. newRow = true;
  32037. try {
  32038. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  32039. var item = _d.value;
  32040. if (newRow) {
  32041. currentRow = {
  32042. xtype: 'cols',
  32043. defaultType: 'displayfield',
  32044. defaults: {
  32045. labelWidth: 70,
  32046. },
  32047. items: []
  32048. };
  32049. sumRows.push(currentRow);
  32050. }
  32051. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  32052. if (item.sumFieldBind) {
  32053. vj.bind = '{sum.' + item.sumFieldBind + '}';
  32054. model.data.sum[item.sumFieldBind] = '';
  32055. }
  32056. else {
  32057. // 没有组件类型,是个空占位符
  32058. vj.border = false;
  32059. }
  32060. if (item.sumFieldFlex) {
  32061. vj.flex = item.sumFieldFlex;
  32062. }
  32063. if (item.sumFieldLabel) {
  32064. vj.fieldLabel = item.sumFieldLabel;
  32065. }
  32066. // sumFieldBind: "zs"
  32067. // sumFieldExtend: "{}"
  32068. // sumFieldFlex: 1
  32069. // sumFieldLabel: "总数"
  32070. // sumFieldWrap: false
  32071. newRow = item.sumFieldWrap || false;
  32072. currentRow.items.push(vj);
  32073. }
  32074. }
  32075. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  32076. finally {
  32077. try {
  32078. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  32079. }
  32080. finally { if (e_1) throw e_1.error; }
  32081. }
  32082. if (currentRow) {
  32083. currentRow.margin = '10 0 10 0';
  32084. }
  32085. // column 结果字段
  32086. var columns = [];
  32087. try {
  32088. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  32089. var item = _f.value;
  32090. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  32091. if (item.xtype) {
  32092. if (item.xtype == 'checkbox') {
  32093. vj.xtype = 'checkcolumn';
  32094. vj.disabled = true;
  32095. }
  32096. else {
  32097. vj.xtype = item.xtype;
  32098. }
  32099. }
  32100. if (item.dataType) {
  32101. vj.dataType = item.dataType;
  32102. }
  32103. if (item.align) {
  32104. vj.align = item.align;
  32105. }
  32106. if (item.width) {
  32107. vj.width = item.width;
  32108. }
  32109. if (item.dict) {
  32110. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  32111. }
  32112. columns.push(vj);
  32113. }
  32114. }
  32115. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  32116. finally {
  32117. try {
  32118. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  32119. }
  32120. finally { if (e_2) throw e_2.error; }
  32121. }
  32122. var vjson = {
  32123. bind: {
  32124. title: '{report_name}',
  32125. },
  32126. layout: 'fit',
  32127. referenceHolder: true,
  32128. items: [
  32129. {
  32130. layout: 'border',
  32131. border: false,
  32132. items: [
  32133. {
  32134. region: 'north',
  32135. border: false,
  32136. tbar: {
  32137. xtype: 'toolbar',
  32138. border: false,
  32139. items: [
  32140. {
  32141. xtype: 'button',
  32142. text: '查询',
  32143. reference: 'btnSearch',
  32144. iconCls: 'x-fa fa-search',
  32145. listeners: {
  32146. click: 'scope.reload',
  32147. },
  32148. },
  32149. {
  32150. xtype: 'button',
  32151. text: '关闭',
  32152. iconCls: 'x-fa fa-times',
  32153. listeners: {
  32154. click: 'system.closeMe()',
  32155. },
  32156. },
  32157. ],
  32158. },
  32159. defaults: {
  32160. margin: '8 0 0 0'
  32161. },
  32162. items: __spread(conditionRows, sumRows),
  32163. fix: ['system.enterToClick("btnSearch")'],
  32164. },
  32165. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  32166. method: 'invoke',
  32167. url: '/report/Report@execute',
  32168. params: {
  32169. dataSource: report.dataSource,
  32170. pagination: report.grid.pagination || true,
  32171. report_id: config.report_id,
  32172. query: '{query}',
  32173. },
  32174. }, columns: columns }, report.grid),
  32175. ],
  32176. },
  32177. ],
  32178. };
  32179. return { model: model, vjson: vjson, report: report };
  32180. }
  32181. var ReportScope = /** @class */ (function (_super) {
  32182. __extends(ReportScope, _super);
  32183. function ReportScope(_a, invokeServerFn) {
  32184. var model = _a.model, vjson = _a.vjson;
  32185. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  32186. _this.invokeServerFn = invokeServerFn;
  32187. return _this;
  32188. }
  32189. ReportScope.prototype.onLoad = function () {
  32190. // this.reload()
  32191. };
  32192. ReportScope.prototype.reload = function () {
  32193. var _this = this;
  32194. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  32195. if (this.viewModel.get('has_sum')) {
  32196. this.invokeServerFn('/report/Report@executeSum', {
  32197. dataSource: this.report.dataSource,
  32198. report_id: this.report_id,
  32199. query: this.viewModel.get('query'),
  32200. }).then(function (res) {
  32201. if (!res.success) {
  32202. showErrorDialog$1(res.msg);
  32203. }
  32204. else {
  32205. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  32206. }
  32207. });
  32208. }
  32209. this.refs.grid1.reload();
  32210. };
  32211. return ReportScope;
  32212. }(Scope));
  32213. //# sourceMappingURL=Report.js.map
  32214. var studio = {
  32215. init: init$1,
  32216. handles: handles$1,
  32217. Workbench: Workbench
  32218. };
  32219. //# sourceMappingURL=index.js.map
  32220. exports.axios = axios;
  32221. exports.qs = Qs;
  32222. exports.lodash = _$2;
  32223. exports.jquery = $$2;
  32224. exports.moment = moment$1;
  32225. exports.recast = recast;
  32226. exports.XLSX = XLSX;
  32227. exports.Defaults = Defaults;
  32228. exports.ExcelImportDialog = ExcelImportDialog;
  32229. exports.Lib = Lib;
  32230. exports.LibParam = LibParam;
  32231. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32232. exports.ReportScope = ReportScope;
  32233. exports.SIMPLE_RE = SIMPLE_RE;
  32234. exports.Scope = Scope;
  32235. exports.ScopeEngine = ScopeEngine;
  32236. exports.SystemEventFu = SystemEventFu;
  32237. exports.ajax = ajax;
  32238. exports.baseConfigProcess = baseConfigProcess;
  32239. exports.baseConfigProcessList = baseConfigProcessList;
  32240. exports.buildPlus = buildPlus;
  32241. exports.buildReportScope = buildReportScope;
  32242. exports.calcExpress = calcExpress;
  32243. exports.calcObject = calcObject;
  32244. exports.calcObjectFlat = calcObjectFlat;
  32245. exports.clearViewModel = clearViewModel;
  32246. exports.clearViewModelByLookup = clearViewModelByLookup;
  32247. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32248. exports.clearViewModelValues = clearViewModelValues;
  32249. exports.commitMe = commitMe;
  32250. exports.confirm = confirm;
  32251. exports.createAjax = createAjax;
  32252. exports.createUUID = createUUID;
  32253. exports.deepTravJson = deepTravJson;
  32254. exports.downLoad = downLoad;
  32255. exports.evalFunction = evalFunction;
  32256. exports.extend = extend;
  32257. exports.flatRow = flatRow;
  32258. exports.getApiConvert = getApiConvert;
  32259. exports.getGridEditRows = getGridEditRows;
  32260. exports.getParentGrid = getParentGrid;
  32261. exports.getPinyin = getPinyin;
  32262. exports.getRegList = getRegList;
  32263. exports.getRegParamList = getRegParamList;
  32264. exports.getScopeOnCreate = getScopeOnCreate;
  32265. exports.init = init$2;
  32266. exports.insertGridRow = insertGridRow;
  32267. exports.invokeServer = invokeServer$1;
  32268. exports.isDesignMode = isDesignMode;
  32269. exports.isEmpty = isEmpty;
  32270. exports.json5 = dist;
  32271. exports.keywordFilter = keywordFilter;
  32272. exports.lookupFn = lookupFn;
  32273. exports.lookupScope = lookupScope;
  32274. exports.mergeViewModel = mergeViewModel;
  32275. exports.moveDownGridRow = moveDownGridRow;
  32276. exports.moveUpGridRow = moveUpGridRow;
  32277. exports.msg = msg$1;
  32278. exports.msgError = msgError;
  32279. exports.normId = normId;
  32280. exports.pinyinMatch = pinyinMatch;
  32281. exports.prompt = prompt$2;
  32282. exports.raiseClick = raiseClick;
  32283. exports.reloadGrid = reloadGrid;
  32284. exports.removeGridRow = removeGridRow;
  32285. exports.replaceNA = replaceNA;
  32286. exports.saveGridRow = saveGridRow;
  32287. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32288. exports.setComboStore = setComboStore;
  32289. exports.showErrorDialog = showErrorDialog$1;
  32290. exports.showInfoDialog = showInfoDialog;
  32291. exports.showWidget = showWidget;
  32292. exports.sqlUrlTransform = sqlUrlTransform;
  32293. exports.stopEvent = stopEvent;
  32294. exports.studio = studio;
  32295. exports.toPlainObject = toPlainObject;
  32296. exports.toString = toString;
  32297. exports.tryEnable = tryEnable;
  32298. exports.tryVarSimple = tryVarSimple;
  32299. exports.tryWriteByExpress = tryWriteByExpress;
  32300. exports.tryWriteObject = tryWriteObject;
  32301. exports.watch = watch;
  32302. Object.defineProperty(exports, '__esModule', { value: true });
  32303. });
  32304. //# sourceMappingURL=yvan-ext.js.map