yvan-ext.js 1.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'modeler', 'bpmn-js-properties-panel', 'lay-excel', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, BpmnModeler, bpmnJsPropertiesPanel, LAY_EXCEL, handlebars, xterm, xtermAddonFit, sqlFormat) { 'use strict';
  2. var axios__default = 'default' in axios ? axios['default'] : axios;
  3. Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
  4. _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2;
  5. $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2;
  6. moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1;
  7. XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX;
  8. localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage;
  9. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  10. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  11. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  12. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. };
  50. var comboGrid = {
  51. selectOnTab: true,
  52. pickerHeight: 500,
  53. pickerWidth: 850,
  54. editEnable: null,
  55. };
  56. var comboGridPicker = {
  57. xtype: 'yvgrid',
  58. layout: 'fit',
  59. selModel: {
  60. selType: 'rowmodel',
  61. mode: 'SINGLE'
  62. },
  63. };
  64. var comboGridMulti = {
  65. selectOnTab: true,
  66. pickerHeight: 500,
  67. pickerWidth: 850,
  68. editEnable: null,
  69. splitChar: ',',
  70. displayField: 'text',
  71. valueField: 'id',
  72. autoLoad: true,
  73. };
  74. var comboGridMultiPicker = {
  75. selType: 'checkboxmodel',
  76. selModel: {
  77. type: 'checkboxmodel',
  78. checkOnly: false
  79. },
  80. };
  81. var numberfield = {
  82. labelAlign: 'right',
  83. decimalPrecision: 6,
  84. labelWidth: labelWidth,
  85. };
  86. var checkbox = {
  87. labelAlign: 'right',
  88. labelWidth: labelWidth,
  89. checkedValue: true,
  90. uncheckedValue: false,
  91. };
  92. var checkboxgroup = {
  93. labelAlign: 'right',
  94. labelWidth: labelWidth,
  95. };
  96. var radio = {
  97. labelAlign: 'right',
  98. labelWidth: labelWidth,
  99. };
  100. var radiogroup = {
  101. labelAlign: 'right',
  102. labelWidth: labelWidth,
  103. simpleValue: true,
  104. layout: 'hbox',
  105. defaults: {
  106. xtype: 'radio',
  107. name: 'type',
  108. margin: '0 15 0 0'
  109. },
  110. };
  111. var form = {
  112. margin: '5 5 0 0',
  113. border: false,
  114. defaults: {
  115. margin: '0 0 5 0',
  116. border: false,
  117. },
  118. };
  119. var column = {
  120. filter: { type: 'string' },
  121. };
  122. var grid = {
  123. border: true,
  124. columnLines: true,
  125. rowLines: true,
  126. plugins: {
  127. cellediting: {
  128. clicksToEdit: 1,
  129. },
  130. gridfilters: true
  131. },
  132. multiColumnSort: true,
  133. viewConfig: {
  134. enableTextSelection: true,
  135. sortOnClick: false,
  136. emptyText: '没有数据'
  137. },
  138. selModel: {
  139. type: 'checkboxmodel',
  140. checkOnly: false
  141. },
  142. pagination: true,
  143. pageSize: 50,
  144. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  145. hideFootbar: false,
  146. hideRefresh: false,
  147. hideExport: false,
  148. hideAutoSize: false,
  149. hideClearFilter: false,
  150. hideSaveGridUIConfig: false,
  151. hideClearGridUIConfig: false,
  152. autoLoad: true,
  153. remoteSort: false,
  154. remoteFilter: false,
  155. enableLocking: true,
  156. syncRowHeight: false,
  157. enableColumnMove: true,
  158. enableColumnHide: true,
  159. enableColumnResize: true,
  160. hidden: false,
  161. disabled: false,
  162. exportExcelPageSize: 100,
  163. exportExcelCurrentPage: 1,
  164. exportExcelTotal: 0,
  165. cellTip: false,
  166. };
  167. var fieldContainer = {
  168. labelAlign: 'right',
  169. labelWidth: labelWidth,
  170. layout: 'hbox',
  171. defaults: {
  172. flex: 1,
  173. }
  174. };
  175. var tree = {
  176. autoLoad: true,
  177. hideFilter: false,
  178. hideToolbar: false,
  179. hideRefresh: false,
  180. hideExpand: false,
  181. hideCollapse: false,
  182. root: [],
  183. rootVisible: false,
  184. };
  185. var search = {
  186. labelAlign: 'right',
  187. labelWidth: labelWidth,
  188. };
  189. var text = {
  190. labelAlign: 'right',
  191. labelWidth: labelWidth,
  192. msgTarget: 'qtip',
  193. };
  194. var toolbar = {
  195. overflowHandler: 'menu',
  196. };
  197. var tbfill = {};
  198. var tbseparator = {};
  199. var button = {};
  200. var fieldSet = {
  201. margin: '5 5 0 0',
  202. border: false,
  203. defaults: {
  204. margin: '0 0 5 0',
  205. border: false,
  206. },
  207. };
  208. var storeAjax = {
  209. timeout: 60000
  210. };
  211. var panel = {};
  212. var splitter = {};
  213. var maintab = {};
  214. var rows = {};
  215. var cols = {
  216. defaults: {
  217. flex: 1
  218. },
  219. };
  220. var bpmn = {
  221. hideRefresh: false,
  222. autoLoad: true,
  223. dataSource: '',
  224. bpmnConfig: {}
  225. };
  226. //# sourceMappingURL=Defaults.js.map
  227. var Defaults = /*#__PURE__*/Object.freeze({
  228. __proto__: null,
  229. windows: windows,
  230. date: date,
  231. tagfield: tagfield,
  232. combo: combo,
  233. comboGrid: comboGrid,
  234. comboGridPicker: comboGridPicker,
  235. comboGridMulti: comboGridMulti,
  236. comboGridMultiPicker: comboGridMultiPicker,
  237. numberfield: numberfield,
  238. checkbox: checkbox,
  239. checkboxgroup: checkboxgroup,
  240. radio: radio,
  241. radiogroup: radiogroup,
  242. form: form,
  243. column: column,
  244. grid: grid,
  245. fieldContainer: fieldContainer,
  246. tree: tree,
  247. search: search,
  248. text: text,
  249. toolbar: toolbar,
  250. tbfill: tbfill,
  251. tbseparator: tbseparator,
  252. button: button,
  253. fieldSet: fieldSet,
  254. storeAjax: storeAjax,
  255. panel: panel,
  256. splitter: splitter,
  257. maintab: maintab,
  258. rows: rows,
  259. cols: cols,
  260. bpmn: bpmn
  261. });
  262. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  263. function createCommonjsModule(fn, module) {
  264. return module = { exports: {} }, fn(module, module.exports), module.exports;
  265. }
  266. var dist = createCommonjsModule(function (module, exports) {
  267. (function (global, factory) {
  268. module.exports = factory() ;
  269. }(commonjsGlobal, (function () {
  270. function createCommonjsModule(fn, module) {
  271. return module = { exports: {} }, fn(module, module.exports), module.exports;
  272. }
  273. var _global = createCommonjsModule(function (module) {
  274. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  275. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  276. ? window : typeof self != 'undefined' && self.Math == Math ? self
  277. // eslint-disable-next-line no-new-func
  278. : Function('return this')();
  279. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  280. });
  281. var _core = createCommonjsModule(function (module) {
  282. var core = module.exports = { version: '2.6.5' };
  283. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  284. });
  285. var _core_1 = _core.version;
  286. var _isObject = function (it) {
  287. return typeof it === 'object' ? it !== null : typeof it === 'function';
  288. };
  289. var _anObject = function (it) {
  290. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  291. return it;
  292. };
  293. var _fails = function (exec) {
  294. try {
  295. return !!exec();
  296. } catch (e) {
  297. return true;
  298. }
  299. };
  300. // Thank's IE8 for his funny defineProperty
  301. var _descriptors = !_fails(function () {
  302. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  303. });
  304. var document = _global.document;
  305. // typeof document.createElement is 'object' in old IE
  306. var is = _isObject(document) && _isObject(document.createElement);
  307. var _domCreate = function (it) {
  308. return is ? document.createElement(it) : {};
  309. };
  310. var _ie8DomDefine = !_descriptors && !_fails(function () {
  311. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  312. });
  313. // 7.1.1 ToPrimitive(input [, PreferredType])
  314. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  315. // and the second argument - flag - preferred type is a string
  316. var _toPrimitive = function (it, S) {
  317. if (!_isObject(it)) { return it; }
  318. var fn, val;
  319. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  320. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  321. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. throw TypeError("Can't convert object to primitive value");
  323. };
  324. var dP = Object.defineProperty;
  325. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  326. _anObject(O);
  327. P = _toPrimitive(P, true);
  328. _anObject(Attributes);
  329. if (_ie8DomDefine) { try {
  330. return dP(O, P, Attributes);
  331. } catch (e) { /* empty */ } }
  332. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  333. if ('value' in Attributes) { O[P] = Attributes.value; }
  334. return O;
  335. };
  336. var _objectDp = {
  337. f: f
  338. };
  339. var _propertyDesc = function (bitmap, value) {
  340. return {
  341. enumerable: !(bitmap & 1),
  342. configurable: !(bitmap & 2),
  343. writable: !(bitmap & 4),
  344. value: value
  345. };
  346. };
  347. var _hide = _descriptors ? function (object, key, value) {
  348. return _objectDp.f(object, key, _propertyDesc(1, value));
  349. } : function (object, key, value) {
  350. object[key] = value;
  351. return object;
  352. };
  353. var hasOwnProperty = {}.hasOwnProperty;
  354. var _has = function (it, key) {
  355. return hasOwnProperty.call(it, key);
  356. };
  357. var id = 0;
  358. var px = Math.random();
  359. var _uid = function (key) {
  360. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  361. };
  362. var _shared = createCommonjsModule(function (module) {
  363. var SHARED = '__core-js_shared__';
  364. var store = _global[SHARED] || (_global[SHARED] = {});
  365. (module.exports = function (key, value) {
  366. return store[key] || (store[key] = value !== undefined ? value : {});
  367. })('versions', []).push({
  368. version: _core.version,
  369. mode: 'global',
  370. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  371. });
  372. });
  373. var _functionToString = _shared('native-function-to-string', Function.toString);
  374. var _redefine = createCommonjsModule(function (module) {
  375. var SRC = _uid('src');
  376. var TO_STRING = 'toString';
  377. var TPL = ('' + _functionToString).split(TO_STRING);
  378. _core.inspectSource = function (it) {
  379. return _functionToString.call(it);
  380. };
  381. (module.exports = function (O, key, val, safe) {
  382. var isFunction = typeof val == 'function';
  383. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  384. if (O[key] === val) { return; }
  385. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  386. if (O === _global) {
  387. O[key] = val;
  388. } else if (!safe) {
  389. delete O[key];
  390. _hide(O, key, val);
  391. } else if (O[key]) {
  392. O[key] = val;
  393. } else {
  394. _hide(O, key, val);
  395. }
  396. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  397. })(Function.prototype, TO_STRING, function toString() {
  398. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  399. });
  400. });
  401. var _aFunction = function (it) {
  402. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  403. return it;
  404. };
  405. // optional / simple context binding
  406. var _ctx = function (fn, that, length) {
  407. _aFunction(fn);
  408. if (that === undefined) { return fn; }
  409. switch (length) {
  410. case 1: return function (a) {
  411. return fn.call(that, a);
  412. };
  413. case 2: return function (a, b) {
  414. return fn.call(that, a, b);
  415. };
  416. case 3: return function (a, b, c) {
  417. return fn.call(that, a, b, c);
  418. };
  419. }
  420. return function (/* ...args */) {
  421. return fn.apply(that, arguments);
  422. };
  423. };
  424. var PROTOTYPE = 'prototype';
  425. var $export = function (type, name, source) {
  426. var IS_FORCED = type & $export.F;
  427. var IS_GLOBAL = type & $export.G;
  428. var IS_STATIC = type & $export.S;
  429. var IS_PROTO = type & $export.P;
  430. var IS_BIND = type & $export.B;
  431. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  432. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  433. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  434. var key, own, out, exp;
  435. if (IS_GLOBAL) { source = name; }
  436. for (key in source) {
  437. // contains in native
  438. own = !IS_FORCED && target && target[key] !== undefined;
  439. // export native or passed
  440. out = (own ? target : source)[key];
  441. // bind timers to global for call from export context
  442. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  443. // extend global
  444. if (target) { _redefine(target, key, out, type & $export.U); }
  445. // export
  446. if (exports[key] != out) { _hide(exports, key, exp); }
  447. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  448. }
  449. };
  450. _global.core = _core;
  451. // type bitmap
  452. $export.F = 1; // forced
  453. $export.G = 2; // global
  454. $export.S = 4; // static
  455. $export.P = 8; // proto
  456. $export.B = 16; // bind
  457. $export.W = 32; // wrap
  458. $export.U = 64; // safe
  459. $export.R = 128; // real proto method for `library`
  460. var _export = $export;
  461. // 7.1.4 ToInteger
  462. var ceil = Math.ceil;
  463. var floor = Math.floor;
  464. var _toInteger = function (it) {
  465. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  466. };
  467. // 7.2.1 RequireObjectCoercible(argument)
  468. var _defined = function (it) {
  469. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  470. return it;
  471. };
  472. // true -> String#at
  473. // false -> String#codePointAt
  474. var _stringAt = function (TO_STRING) {
  475. return function (that, pos) {
  476. var s = String(_defined(that));
  477. var i = _toInteger(pos);
  478. var l = s.length;
  479. var a, b;
  480. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  481. a = s.charCodeAt(i);
  482. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  483. ? TO_STRING ? s.charAt(i) : a
  484. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  485. };
  486. };
  487. var $at = _stringAt(false);
  488. _export(_export.P, 'String', {
  489. // 21.1.3.3 String.prototype.codePointAt(pos)
  490. codePointAt: function codePointAt(pos) {
  491. return $at(this, pos);
  492. }
  493. });
  494. var codePointAt = _core.String.codePointAt;
  495. var max = Math.max;
  496. var min = Math.min;
  497. var _toAbsoluteIndex = function (index, length) {
  498. index = _toInteger(index);
  499. return index < 0 ? max(index + length, 0) : min(index, length);
  500. };
  501. var fromCharCode = String.fromCharCode;
  502. var $fromCodePoint = String.fromCodePoint;
  503. // length should be 1, old FF problem
  504. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  505. // 21.1.2.2 String.fromCodePoint(...codePoints)
  506. fromCodePoint: function fromCodePoint(x) {
  507. var arguments$1 = arguments;
  508. // eslint-disable-line no-unused-vars
  509. var res = [];
  510. var aLen = arguments.length;
  511. var i = 0;
  512. var code;
  513. while (aLen > i) {
  514. code = +arguments$1[i++];
  515. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  516. res.push(code < 0x10000
  517. ? fromCharCode(code)
  518. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  519. );
  520. } return res.join('');
  521. }
  522. });
  523. var fromCodePoint = _core.String.fromCodePoint;
  524. // This is a generated file. Do not edit.
  525. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  526. var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
  527. var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
  528. var unicode = {
  529. Space_Separator: Space_Separator,
  530. ID_Start: ID_Start,
  531. ID_Continue: ID_Continue
  532. };
  533. var util = {
  534. isSpaceSeparator: function isSpaceSeparator (c) {
  535. return typeof c === 'string' && unicode.Space_Separator.test(c)
  536. },
  537. isIdStartChar: function isIdStartChar (c) {
  538. return typeof c === 'string' && (
  539. (c >= 'a' && c <= 'z') ||
  540. (c >= 'A' && c <= 'Z') ||
  541. (c === '$') || (c === '_') ||
  542. unicode.ID_Start.test(c)
  543. )
  544. },
  545. isIdContinueChar: function isIdContinueChar (c) {
  546. return typeof c === 'string' && (
  547. (c >= 'a' && c <= 'z') ||
  548. (c >= 'A' && c <= 'Z') ||
  549. (c >= '0' && c <= '9') ||
  550. (c === '$') || (c === '_') ||
  551. (c === '\u200C') || (c === '\u200D') ||
  552. unicode.ID_Continue.test(c)
  553. )
  554. },
  555. isDigit: function isDigit (c) {
  556. return typeof c === 'string' && /[0-9]/.test(c)
  557. },
  558. isHexDigit: function isHexDigit (c) {
  559. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  560. },
  561. };
  562. var source;
  563. var parseState;
  564. var stack;
  565. var pos;
  566. var line;
  567. var column;
  568. var token;
  569. var key;
  570. var root;
  571. var parse = function parse (text, reviver) {
  572. source = String(text);
  573. parseState = 'start';
  574. stack = [];
  575. pos = 0;
  576. line = 1;
  577. column = 0;
  578. token = undefined;
  579. key = undefined;
  580. root = undefined;
  581. do {
  582. token = lex();
  583. // This code is unreachable.
  584. // if (!parseStates[parseState]) {
  585. // throw invalidParseState()
  586. // }
  587. parseStates[parseState]();
  588. } while (token.type !== 'eof')
  589. if (typeof reviver === 'function') {
  590. return internalize({'': root}, '', reviver)
  591. }
  592. return root
  593. };
  594. function internalize (holder, name, reviver) {
  595. var value = holder[name];
  596. if (value != null && typeof value === 'object') {
  597. for (var key in value) {
  598. var replacement = internalize(value, key, reviver);
  599. if (replacement === undefined) {
  600. delete value[key];
  601. } else {
  602. value[key] = replacement;
  603. }
  604. }
  605. }
  606. return reviver.call(holder, name, value)
  607. }
  608. var lexState;
  609. var buffer;
  610. var doubleQuote;
  611. var sign;
  612. var c;
  613. function lex () {
  614. lexState = 'default';
  615. buffer = '';
  616. doubleQuote = false;
  617. sign = 1;
  618. for (;;) {
  619. c = peek();
  620. // This code is unreachable.
  621. // if (!lexStates[lexState]) {
  622. // throw invalidLexState(lexState)
  623. // }
  624. var token = lexStates[lexState]();
  625. if (token) {
  626. return token
  627. }
  628. }
  629. }
  630. function peek () {
  631. if (source[pos]) {
  632. return String.fromCodePoint(source.codePointAt(pos))
  633. }
  634. }
  635. function read () {
  636. var c = peek();
  637. if (c === '\n') {
  638. line++;
  639. column = 0;
  640. } else if (c) {
  641. column += c.length;
  642. } else {
  643. column++;
  644. }
  645. if (c) {
  646. pos += c.length;
  647. }
  648. return c
  649. }
  650. var lexStates = {
  651. default: function default$1 () {
  652. switch (c) {
  653. case '\t':
  654. case '\v':
  655. case '\f':
  656. case ' ':
  657. case '\u00A0':
  658. case '\uFEFF':
  659. case '\n':
  660. case '\r':
  661. case '\u2028':
  662. case '\u2029':
  663. read();
  664. return
  665. case '/':
  666. read();
  667. lexState = 'comment';
  668. return
  669. case undefined:
  670. read();
  671. return newToken('eof')
  672. }
  673. if (util.isSpaceSeparator(c)) {
  674. read();
  675. return
  676. }
  677. // This code is unreachable.
  678. // if (!lexStates[parseState]) {
  679. // throw invalidLexState(parseState)
  680. // }
  681. return lexStates[parseState]()
  682. },
  683. comment: function comment () {
  684. switch (c) {
  685. case '*':
  686. read();
  687. lexState = 'multiLineComment';
  688. return
  689. case '/':
  690. read();
  691. lexState = 'singleLineComment';
  692. return
  693. }
  694. throw invalidChar(read())
  695. },
  696. multiLineComment: function multiLineComment () {
  697. switch (c) {
  698. case '*':
  699. read();
  700. lexState = 'multiLineCommentAsterisk';
  701. return
  702. case undefined:
  703. throw invalidChar(read())
  704. }
  705. read();
  706. },
  707. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  708. switch (c) {
  709. case '*':
  710. read();
  711. return
  712. case '/':
  713. read();
  714. lexState = 'default';
  715. return
  716. case undefined:
  717. throw invalidChar(read())
  718. }
  719. read();
  720. lexState = 'multiLineComment';
  721. },
  722. singleLineComment: function singleLineComment () {
  723. switch (c) {
  724. case '\n':
  725. case '\r':
  726. case '\u2028':
  727. case '\u2029':
  728. read();
  729. lexState = 'default';
  730. return
  731. case undefined:
  732. read();
  733. return newToken('eof')
  734. }
  735. read();
  736. },
  737. value: function value () {
  738. switch (c) {
  739. case '{':
  740. case '[':
  741. return newToken('punctuator', read())
  742. case 'n':
  743. read();
  744. literal('ull');
  745. return newToken('null', null)
  746. case 't':
  747. read();
  748. literal('rue');
  749. return newToken('boolean', true)
  750. case 'f':
  751. read();
  752. literal('alse');
  753. return newToken('boolean', false)
  754. case '-':
  755. case '+':
  756. if (read() === '-') {
  757. sign = -1;
  758. }
  759. lexState = 'sign';
  760. return
  761. case '.':
  762. buffer = read();
  763. lexState = 'decimalPointLeading';
  764. return
  765. case '0':
  766. buffer = read();
  767. lexState = 'zero';
  768. return
  769. case '1':
  770. case '2':
  771. case '3':
  772. case '4':
  773. case '5':
  774. case '6':
  775. case '7':
  776. case '8':
  777. case '9':
  778. buffer = read();
  779. lexState = 'decimalInteger';
  780. return
  781. case 'I':
  782. read();
  783. literal('nfinity');
  784. return newToken('numeric', Infinity)
  785. case 'N':
  786. read();
  787. literal('aN');
  788. return newToken('numeric', NaN)
  789. case '"':
  790. case "'":
  791. doubleQuote = (read() === '"');
  792. buffer = '';
  793. lexState = 'string';
  794. return
  795. }
  796. throw invalidChar(read())
  797. },
  798. identifierNameStartEscape: function identifierNameStartEscape () {
  799. if (c !== 'u') {
  800. throw invalidChar(read())
  801. }
  802. read();
  803. var u = unicodeEscape();
  804. switch (u) {
  805. case '$':
  806. case '_':
  807. break
  808. default:
  809. if (!util.isIdStartChar(u)) {
  810. throw invalidIdentifier()
  811. }
  812. break
  813. }
  814. buffer += u;
  815. lexState = 'identifierName';
  816. },
  817. identifierName: function identifierName () {
  818. switch (c) {
  819. case '$':
  820. case '_':
  821. case '\u200C':
  822. case '\u200D':
  823. buffer += read();
  824. return
  825. case '\\':
  826. read();
  827. lexState = 'identifierNameEscape';
  828. return
  829. }
  830. if (util.isIdContinueChar(c)) {
  831. buffer += read();
  832. return
  833. }
  834. return newToken('identifier', buffer)
  835. },
  836. identifierNameEscape: function identifierNameEscape () {
  837. if (c !== 'u') {
  838. throw invalidChar(read())
  839. }
  840. read();
  841. var u = unicodeEscape();
  842. switch (u) {
  843. case '$':
  844. case '_':
  845. case '\u200C':
  846. case '\u200D':
  847. break
  848. default:
  849. if (!util.isIdContinueChar(u)) {
  850. throw invalidIdentifier()
  851. }
  852. break
  853. }
  854. buffer += u;
  855. lexState = 'identifierName';
  856. },
  857. sign: function sign$1 () {
  858. switch (c) {
  859. case '.':
  860. buffer = read();
  861. lexState = 'decimalPointLeading';
  862. return
  863. case '0':
  864. buffer = read();
  865. lexState = 'zero';
  866. return
  867. case '1':
  868. case '2':
  869. case '3':
  870. case '4':
  871. case '5':
  872. case '6':
  873. case '7':
  874. case '8':
  875. case '9':
  876. buffer = read();
  877. lexState = 'decimalInteger';
  878. return
  879. case 'I':
  880. read();
  881. literal('nfinity');
  882. return newToken('numeric', sign * Infinity)
  883. case 'N':
  884. read();
  885. literal('aN');
  886. return newToken('numeric', NaN)
  887. }
  888. throw invalidChar(read())
  889. },
  890. zero: function zero () {
  891. switch (c) {
  892. case '.':
  893. buffer += read();
  894. lexState = 'decimalPoint';
  895. return
  896. case 'e':
  897. case 'E':
  898. buffer += read();
  899. lexState = 'decimalExponent';
  900. return
  901. case 'x':
  902. case 'X':
  903. buffer += read();
  904. lexState = 'hexadecimal';
  905. return
  906. }
  907. return newToken('numeric', sign * 0)
  908. },
  909. decimalInteger: function decimalInteger () {
  910. switch (c) {
  911. case '.':
  912. buffer += read();
  913. lexState = 'decimalPoint';
  914. return
  915. case 'e':
  916. case 'E':
  917. buffer += read();
  918. lexState = 'decimalExponent';
  919. return
  920. }
  921. if (util.isDigit(c)) {
  922. buffer += read();
  923. return
  924. }
  925. return newToken('numeric', sign * Number(buffer))
  926. },
  927. decimalPointLeading: function decimalPointLeading () {
  928. if (util.isDigit(c)) {
  929. buffer += read();
  930. lexState = 'decimalFraction';
  931. return
  932. }
  933. throw invalidChar(read())
  934. },
  935. decimalPoint: function decimalPoint () {
  936. switch (c) {
  937. case 'e':
  938. case 'E':
  939. buffer += read();
  940. lexState = 'decimalExponent';
  941. return
  942. }
  943. if (util.isDigit(c)) {
  944. buffer += read();
  945. lexState = 'decimalFraction';
  946. return
  947. }
  948. return newToken('numeric', sign * Number(buffer))
  949. },
  950. decimalFraction: function decimalFraction () {
  951. switch (c) {
  952. case 'e':
  953. case 'E':
  954. buffer += read();
  955. lexState = 'decimalExponent';
  956. return
  957. }
  958. if (util.isDigit(c)) {
  959. buffer += read();
  960. return
  961. }
  962. return newToken('numeric', sign * Number(buffer))
  963. },
  964. decimalExponent: function decimalExponent () {
  965. switch (c) {
  966. case '+':
  967. case '-':
  968. buffer += read();
  969. lexState = 'decimalExponentSign';
  970. return
  971. }
  972. if (util.isDigit(c)) {
  973. buffer += read();
  974. lexState = 'decimalExponentInteger';
  975. return
  976. }
  977. throw invalidChar(read())
  978. },
  979. decimalExponentSign: function decimalExponentSign () {
  980. if (util.isDigit(c)) {
  981. buffer += read();
  982. lexState = 'decimalExponentInteger';
  983. return
  984. }
  985. throw invalidChar(read())
  986. },
  987. decimalExponentInteger: function decimalExponentInteger () {
  988. if (util.isDigit(c)) {
  989. buffer += read();
  990. return
  991. }
  992. return newToken('numeric', sign * Number(buffer))
  993. },
  994. hexadecimal: function hexadecimal () {
  995. if (util.isHexDigit(c)) {
  996. buffer += read();
  997. lexState = 'hexadecimalInteger';
  998. return
  999. }
  1000. throw invalidChar(read())
  1001. },
  1002. hexadecimalInteger: function hexadecimalInteger () {
  1003. if (util.isHexDigit(c)) {
  1004. buffer += read();
  1005. return
  1006. }
  1007. return newToken('numeric', sign * Number(buffer))
  1008. },
  1009. string: function string () {
  1010. switch (c) {
  1011. case '\\':
  1012. read();
  1013. buffer += escape();
  1014. return
  1015. case '"':
  1016. if (doubleQuote) {
  1017. read();
  1018. return newToken('string', buffer)
  1019. }
  1020. buffer += read();
  1021. return
  1022. case "'":
  1023. if (!doubleQuote) {
  1024. read();
  1025. return newToken('string', buffer)
  1026. }
  1027. buffer += read();
  1028. return
  1029. case '\n':
  1030. case '\r':
  1031. throw invalidChar(read())
  1032. case '\u2028':
  1033. case '\u2029':
  1034. separatorChar(c);
  1035. break
  1036. case undefined:
  1037. throw invalidChar(read())
  1038. }
  1039. buffer += read();
  1040. },
  1041. start: function start () {
  1042. switch (c) {
  1043. case '{':
  1044. case '[':
  1045. return newToken('punctuator', read())
  1046. // This code is unreachable since the default lexState handles eof.
  1047. // case undefined:
  1048. // return newToken('eof')
  1049. }
  1050. lexState = 'value';
  1051. },
  1052. beforePropertyName: function beforePropertyName () {
  1053. switch (c) {
  1054. case '$':
  1055. case '_':
  1056. buffer = read();
  1057. lexState = 'identifierName';
  1058. return
  1059. case '\\':
  1060. read();
  1061. lexState = 'identifierNameStartEscape';
  1062. return
  1063. case '}':
  1064. return newToken('punctuator', read())
  1065. case '"':
  1066. case "'":
  1067. doubleQuote = (read() === '"');
  1068. lexState = 'string';
  1069. return
  1070. }
  1071. if (util.isIdStartChar(c)) {
  1072. buffer += read();
  1073. lexState = 'identifierName';
  1074. return
  1075. }
  1076. throw invalidChar(read())
  1077. },
  1078. afterPropertyName: function afterPropertyName () {
  1079. if (c === ':') {
  1080. return newToken('punctuator', read())
  1081. }
  1082. throw invalidChar(read())
  1083. },
  1084. beforePropertyValue: function beforePropertyValue () {
  1085. lexState = 'value';
  1086. },
  1087. afterPropertyValue: function afterPropertyValue () {
  1088. switch (c) {
  1089. case ',':
  1090. case '}':
  1091. return newToken('punctuator', read())
  1092. }
  1093. throw invalidChar(read())
  1094. },
  1095. beforeArrayValue: function beforeArrayValue () {
  1096. if (c === ']') {
  1097. return newToken('punctuator', read())
  1098. }
  1099. lexState = 'value';
  1100. },
  1101. afterArrayValue: function afterArrayValue () {
  1102. switch (c) {
  1103. case ',':
  1104. case ']':
  1105. return newToken('punctuator', read())
  1106. }
  1107. throw invalidChar(read())
  1108. },
  1109. end: function end () {
  1110. // This code is unreachable since it's handled by the default lexState.
  1111. // if (c === undefined) {
  1112. // read()
  1113. // return newToken('eof')
  1114. // }
  1115. throw invalidChar(read())
  1116. },
  1117. };
  1118. function newToken (type, value) {
  1119. return {
  1120. type: type,
  1121. value: value,
  1122. line: line,
  1123. column: column,
  1124. }
  1125. }
  1126. function literal (s) {
  1127. for (var i = 0, list = s; i < list.length; i += 1) {
  1128. var c = list[i];
  1129. var p = peek();
  1130. if (p !== c) {
  1131. throw invalidChar(read())
  1132. }
  1133. read();
  1134. }
  1135. }
  1136. function escape () {
  1137. var c = peek();
  1138. switch (c) {
  1139. case 'b':
  1140. read();
  1141. return '\b'
  1142. case 'f':
  1143. read();
  1144. return '\f'
  1145. case 'n':
  1146. read();
  1147. return '\n'
  1148. case 'r':
  1149. read();
  1150. return '\r'
  1151. case 't':
  1152. read();
  1153. return '\t'
  1154. case 'v':
  1155. read();
  1156. return '\v'
  1157. case '0':
  1158. read();
  1159. if (util.isDigit(peek())) {
  1160. throw invalidChar(read())
  1161. }
  1162. return '\0'
  1163. case 'x':
  1164. read();
  1165. return hexEscape()
  1166. case 'u':
  1167. read();
  1168. return unicodeEscape()
  1169. case '\n':
  1170. case '\u2028':
  1171. case '\u2029':
  1172. read();
  1173. return ''
  1174. case '\r':
  1175. read();
  1176. if (peek() === '\n') {
  1177. read();
  1178. }
  1179. return ''
  1180. case '1':
  1181. case '2':
  1182. case '3':
  1183. case '4':
  1184. case '5':
  1185. case '6':
  1186. case '7':
  1187. case '8':
  1188. case '9':
  1189. throw invalidChar(read())
  1190. case undefined:
  1191. throw invalidChar(read())
  1192. }
  1193. return read()
  1194. }
  1195. function hexEscape () {
  1196. var buffer = '';
  1197. var c = peek();
  1198. if (!util.isHexDigit(c)) {
  1199. throw invalidChar(read())
  1200. }
  1201. buffer += read();
  1202. c = peek();
  1203. if (!util.isHexDigit(c)) {
  1204. throw invalidChar(read())
  1205. }
  1206. buffer += read();
  1207. return String.fromCodePoint(parseInt(buffer, 16))
  1208. }
  1209. function unicodeEscape () {
  1210. var buffer = '';
  1211. var count = 4;
  1212. while (count-- > 0) {
  1213. var c = peek();
  1214. if (!util.isHexDigit(c)) {
  1215. throw invalidChar(read())
  1216. }
  1217. buffer += read();
  1218. }
  1219. return String.fromCodePoint(parseInt(buffer, 16))
  1220. }
  1221. var parseStates = {
  1222. start: function start () {
  1223. if (token.type === 'eof') {
  1224. throw invalidEOF()
  1225. }
  1226. push();
  1227. },
  1228. beforePropertyName: function beforePropertyName () {
  1229. switch (token.type) {
  1230. case 'identifier':
  1231. case 'string':
  1232. key = token.value;
  1233. parseState = 'afterPropertyName';
  1234. return
  1235. case 'punctuator':
  1236. // This code is unreachable since it's handled by the lexState.
  1237. // if (token.value !== '}') {
  1238. // throw invalidToken()
  1239. // }
  1240. pop();
  1241. return
  1242. case 'eof':
  1243. throw invalidEOF()
  1244. }
  1245. // This code is unreachable since it's handled by the lexState.
  1246. // throw invalidToken()
  1247. },
  1248. afterPropertyName: function afterPropertyName () {
  1249. // This code is unreachable since it's handled by the lexState.
  1250. // if (token.type !== 'punctuator' || token.value !== ':') {
  1251. // throw invalidToken()
  1252. // }
  1253. if (token.type === 'eof') {
  1254. throw invalidEOF()
  1255. }
  1256. parseState = 'beforePropertyValue';
  1257. },
  1258. beforePropertyValue: function beforePropertyValue () {
  1259. if (token.type === 'eof') {
  1260. throw invalidEOF()
  1261. }
  1262. push();
  1263. },
  1264. beforeArrayValue: function beforeArrayValue () {
  1265. if (token.type === 'eof') {
  1266. throw invalidEOF()
  1267. }
  1268. if (token.type === 'punctuator' && token.value === ']') {
  1269. pop();
  1270. return
  1271. }
  1272. push();
  1273. },
  1274. afterPropertyValue: function afterPropertyValue () {
  1275. // This code is unreachable since it's handled by the lexState.
  1276. // if (token.type !== 'punctuator') {
  1277. // throw invalidToken()
  1278. // }
  1279. if (token.type === 'eof') {
  1280. throw invalidEOF()
  1281. }
  1282. switch (token.value) {
  1283. case ',':
  1284. parseState = 'beforePropertyName';
  1285. return
  1286. case '}':
  1287. pop();
  1288. }
  1289. // This code is unreachable since it's handled by the lexState.
  1290. // throw invalidToken()
  1291. },
  1292. afterArrayValue: function afterArrayValue () {
  1293. // This code is unreachable since it's handled by the lexState.
  1294. // if (token.type !== 'punctuator') {
  1295. // throw invalidToken()
  1296. // }
  1297. if (token.type === 'eof') {
  1298. throw invalidEOF()
  1299. }
  1300. switch (token.value) {
  1301. case ',':
  1302. parseState = 'beforeArrayValue';
  1303. return
  1304. case ']':
  1305. pop();
  1306. }
  1307. // This code is unreachable since it's handled by the lexState.
  1308. // throw invalidToken()
  1309. },
  1310. end: function end () {
  1311. // This code is unreachable since it's handled by the lexState.
  1312. // if (token.type !== 'eof') {
  1313. // throw invalidToken()
  1314. // }
  1315. },
  1316. };
  1317. function push () {
  1318. var value;
  1319. switch (token.type) {
  1320. case 'punctuator':
  1321. switch (token.value) {
  1322. case '{':
  1323. value = {};
  1324. break
  1325. case '[':
  1326. value = [];
  1327. break
  1328. }
  1329. break
  1330. case 'null':
  1331. case 'boolean':
  1332. case 'numeric':
  1333. case 'string':
  1334. value = token.value;
  1335. break
  1336. // This code is unreachable.
  1337. // default:
  1338. // throw invalidToken()
  1339. }
  1340. if (root === undefined) {
  1341. root = value;
  1342. } else {
  1343. var parent = stack[stack.length - 1];
  1344. if (Array.isArray(parent)) {
  1345. parent.push(value);
  1346. } else {
  1347. parent[key] = value;
  1348. }
  1349. }
  1350. if (value !== null && typeof value === 'object') {
  1351. stack.push(value);
  1352. if (Array.isArray(value)) {
  1353. parseState = 'beforeArrayValue';
  1354. } else {
  1355. parseState = 'beforePropertyName';
  1356. }
  1357. } else {
  1358. var current = stack[stack.length - 1];
  1359. if (current == null) {
  1360. parseState = 'end';
  1361. } else if (Array.isArray(current)) {
  1362. parseState = 'afterArrayValue';
  1363. } else {
  1364. parseState = 'afterPropertyValue';
  1365. }
  1366. }
  1367. }
  1368. function pop () {
  1369. stack.pop();
  1370. var current = stack[stack.length - 1];
  1371. if (current == null) {
  1372. parseState = 'end';
  1373. } else if (Array.isArray(current)) {
  1374. parseState = 'afterArrayValue';
  1375. } else {
  1376. parseState = 'afterPropertyValue';
  1377. }
  1378. }
  1379. // This code is unreachable.
  1380. // function invalidParseState () {
  1381. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1382. // }
  1383. // This code is unreachable.
  1384. // function invalidLexState (state) {
  1385. // return new Error(`JSON5: invalid lex state '${state}'`)
  1386. // }
  1387. function invalidChar (c) {
  1388. if (c === undefined) {
  1389. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1390. }
  1391. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1392. }
  1393. function invalidEOF () {
  1394. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1395. }
  1396. // This code is unreachable.
  1397. // function invalidToken () {
  1398. // if (token.type === 'eof') {
  1399. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1400. // }
  1401. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1402. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1403. // }
  1404. function invalidIdentifier () {
  1405. column -= 5;
  1406. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1407. }
  1408. function separatorChar (c) {
  1409. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1410. }
  1411. function formatChar (c) {
  1412. var replacements = {
  1413. "'": "\\'",
  1414. '"': '\\"',
  1415. '\\': '\\\\',
  1416. '\b': '\\b',
  1417. '\f': '\\f',
  1418. '\n': '\\n',
  1419. '\r': '\\r',
  1420. '\t': '\\t',
  1421. '\v': '\\v',
  1422. '\0': '\\0',
  1423. '\u2028': '\\u2028',
  1424. '\u2029': '\\u2029',
  1425. };
  1426. if (replacements[c]) {
  1427. return replacements[c]
  1428. }
  1429. if (c < ' ') {
  1430. var hexString = c.charCodeAt(0).toString(16);
  1431. return '\\x' + ('00' + hexString).substring(hexString.length)
  1432. }
  1433. return c
  1434. }
  1435. function syntaxError (message) {
  1436. var err = new SyntaxError(message);
  1437. err.lineNumber = line;
  1438. err.columnNumber = column;
  1439. return err
  1440. }
  1441. var stringify = function stringify (value, replacer, space) {
  1442. var stack = [];
  1443. var indent = '';
  1444. var propertyList;
  1445. var replacerFunc;
  1446. var gap = '';
  1447. var quote;
  1448. if (
  1449. replacer != null &&
  1450. typeof replacer === 'object' &&
  1451. !Array.isArray(replacer)
  1452. ) {
  1453. space = replacer.space;
  1454. quote = replacer.quote;
  1455. replacer = replacer.replacer;
  1456. }
  1457. if (typeof replacer === 'function') {
  1458. replacerFunc = replacer;
  1459. } else if (Array.isArray(replacer)) {
  1460. propertyList = [];
  1461. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1462. var v = list[i];
  1463. var item = (void 0);
  1464. if (typeof v === 'string') {
  1465. item = v;
  1466. } else if (
  1467. typeof v === 'number' ||
  1468. v instanceof String ||
  1469. v instanceof Number
  1470. ) {
  1471. item = String(v);
  1472. }
  1473. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1474. propertyList.push(item);
  1475. }
  1476. }
  1477. }
  1478. if (space instanceof Number) {
  1479. space = Number(space);
  1480. } else if (space instanceof String) {
  1481. space = String(space);
  1482. }
  1483. if (typeof space === 'number') {
  1484. if (space > 0) {
  1485. space = Math.min(10, Math.floor(space));
  1486. gap = ' '.substr(0, space);
  1487. }
  1488. } else if (typeof space === 'string') {
  1489. gap = space.substr(0, 10);
  1490. }
  1491. return serializeProperty('', {'': value})
  1492. function serializeProperty (key, holder) {
  1493. var value = holder[key];
  1494. if (value != null) {
  1495. if (typeof value.toJSON5 === 'function') {
  1496. value = value.toJSON5(key);
  1497. } else if (typeof value.toJSON === 'function') {
  1498. value = value.toJSON(key);
  1499. }
  1500. }
  1501. if (replacerFunc) {
  1502. value = replacerFunc.call(holder, key, value);
  1503. }
  1504. if (value instanceof Number) {
  1505. value = Number(value);
  1506. } else if (value instanceof String) {
  1507. value = String(value);
  1508. } else if (value instanceof Boolean) {
  1509. value = value.valueOf();
  1510. }
  1511. switch (value) {
  1512. case null: return 'null'
  1513. case true: return 'true'
  1514. case false: return 'false'
  1515. }
  1516. if (typeof value === 'string') {
  1517. return quoteString(value)
  1518. }
  1519. if (typeof value === 'number') {
  1520. return String(value)
  1521. }
  1522. if (typeof value === 'object') {
  1523. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1524. }
  1525. return undefined
  1526. }
  1527. function quoteString (value) {
  1528. var quotes = {
  1529. "'": 0.1,
  1530. '"': 0.2,
  1531. };
  1532. var replacements = {
  1533. "'": "\\'",
  1534. '"': '\\"',
  1535. '\\': '\\\\',
  1536. '\b': '\\b',
  1537. '\f': '\\f',
  1538. '\n': '\\n',
  1539. '\r': '\\r',
  1540. '\t': '\\t',
  1541. '\v': '\\v',
  1542. '\0': '\\0',
  1543. '\u2028': '\\u2028',
  1544. '\u2029': '\\u2029',
  1545. };
  1546. var product = '';
  1547. for (var i = 0; i < value.length; i++) {
  1548. var c = value[i];
  1549. switch (c) {
  1550. case "'":
  1551. case '"':
  1552. quotes[c]++;
  1553. product += c;
  1554. continue
  1555. case '\0':
  1556. if (util.isDigit(value[i + 1])) {
  1557. product += '\\x00';
  1558. continue
  1559. }
  1560. }
  1561. if (replacements[c]) {
  1562. product += replacements[c];
  1563. continue
  1564. }
  1565. if (c < ' ') {
  1566. var hexString = c.charCodeAt(0).toString(16);
  1567. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1568. continue
  1569. }
  1570. product += c;
  1571. }
  1572. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1573. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1574. return quoteChar + product + quoteChar
  1575. }
  1576. function serializeObject (value) {
  1577. if (stack.indexOf(value) >= 0) {
  1578. throw TypeError('Converting circular structure to JSON5')
  1579. }
  1580. stack.push(value);
  1581. var stepback = indent;
  1582. indent = indent + gap;
  1583. var keys = propertyList || Object.keys(value);
  1584. var partial = [];
  1585. for (var i = 0, list = keys; i < list.length; i += 1) {
  1586. var key = list[i];
  1587. var propertyString = serializeProperty(key, value);
  1588. if (propertyString !== undefined) {
  1589. var member = serializeKey(key) + ':';
  1590. if (gap !== '') {
  1591. member += ' ';
  1592. }
  1593. member += propertyString;
  1594. partial.push(member);
  1595. }
  1596. }
  1597. var final;
  1598. if (partial.length === 0) {
  1599. final = '{}';
  1600. } else {
  1601. var properties;
  1602. if (gap === '') {
  1603. properties = partial.join(',');
  1604. final = '{' + properties + '}';
  1605. } else {
  1606. var separator = ',\n' + indent;
  1607. properties = partial.join(separator);
  1608. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1609. }
  1610. }
  1611. stack.pop();
  1612. indent = stepback;
  1613. return final
  1614. }
  1615. function serializeKey (key) {
  1616. if (key.length === 0) {
  1617. return quoteString(key)
  1618. }
  1619. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1620. if (!util.isIdStartChar(firstChar)) {
  1621. return quoteString(key)
  1622. }
  1623. for (var i = firstChar.length; i < key.length; i++) {
  1624. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1625. return quoteString(key)
  1626. }
  1627. }
  1628. return key
  1629. }
  1630. function serializeArray (value) {
  1631. if (stack.indexOf(value) >= 0) {
  1632. throw TypeError('Converting circular structure to JSON5')
  1633. }
  1634. stack.push(value);
  1635. var stepback = indent;
  1636. indent = indent + gap;
  1637. var partial = [];
  1638. for (var i = 0; i < value.length; i++) {
  1639. var propertyString = serializeProperty(String(i), value);
  1640. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1641. }
  1642. var final;
  1643. if (partial.length === 0) {
  1644. final = '[]';
  1645. } else {
  1646. if (gap === '') {
  1647. var properties = partial.join(',');
  1648. final = '[' + properties + ']';
  1649. } else {
  1650. var separator = ',\n' + indent;
  1651. var properties$1 = partial.join(separator);
  1652. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1653. }
  1654. }
  1655. stack.pop();
  1656. indent = stepback;
  1657. return final
  1658. }
  1659. };
  1660. var JSON5 = {
  1661. parse: parse,
  1662. stringify: stringify,
  1663. };
  1664. var lib = JSON5;
  1665. var es5 = lib;
  1666. return es5;
  1667. })));
  1668. });
  1669. /*! *****************************************************************************
  1670. Copyright (c) Microsoft Corporation.
  1671. Permission to use, copy, modify, and/or distribute this software for any
  1672. purpose with or without fee is hereby granted.
  1673. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1674. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1675. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1676. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1677. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1678. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1679. PERFORMANCE OF THIS SOFTWARE.
  1680. ***************************************************************************** */
  1681. /* global Reflect, Promise */
  1682. var extendStatics = function(d, b) {
  1683. extendStatics = Object.setPrototypeOf ||
  1684. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1685. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1686. return extendStatics(d, b);
  1687. };
  1688. function __extends(d, b) {
  1689. extendStatics(d, b);
  1690. function __() { this.constructor = d; }
  1691. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1692. }
  1693. var __assign = function() {
  1694. __assign = Object.assign || function __assign(t) {
  1695. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1696. s = arguments[i];
  1697. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1698. }
  1699. return t;
  1700. };
  1701. return __assign.apply(this, arguments);
  1702. };
  1703. function __decorate(decorators, target, key, desc) {
  1704. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1705. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1706. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  1707. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1708. }
  1709. function __param(paramIndex, decorator) {
  1710. return function (target, key) { decorator(target, key, paramIndex); }
  1711. }
  1712. function __metadata(metadataKey, metadataValue) {
  1713. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1714. }
  1715. function __values(o) {
  1716. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1717. if (m) return m.call(o);
  1718. if (o && typeof o.length === "number") return {
  1719. next: function () {
  1720. if (o && i >= o.length) o = void 0;
  1721. return { value: o && o[i++], done: !o };
  1722. }
  1723. };
  1724. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1725. }
  1726. function __read(o, n) {
  1727. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1728. if (!m) return o;
  1729. var i = m.call(o), r, ar = [], e;
  1730. try {
  1731. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1732. }
  1733. catch (error) { e = { error: error }; }
  1734. finally {
  1735. try {
  1736. if (r && !r.done && (m = i["return"])) m.call(i);
  1737. }
  1738. finally { if (e) throw e.error; }
  1739. }
  1740. return ar;
  1741. }
  1742. function __spread() {
  1743. for (var ar = [], i = 0; i < arguments.length; i++)
  1744. ar = ar.concat(__read(arguments[i]));
  1745. return ar;
  1746. }
  1747. var PropertyDescription = /** @class */ (function () {
  1748. function PropertyDescription() {
  1749. var _this = this;
  1750. var args = [];
  1751. for (var _i = 0; _i < arguments.length; _i++) {
  1752. args[_i] = arguments[_i];
  1753. }
  1754. this.propertyes = {
  1755. props: [],
  1756. events: []
  1757. };
  1758. _$2.each(args, function (arg) {
  1759. _this.merge(arg);
  1760. });
  1761. }
  1762. PropertyDescription.prototype.merge = function (pd) {
  1763. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1764. if (pd.events) {
  1765. if (this.propertyes.events) {
  1766. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1767. }
  1768. else {
  1769. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1770. }
  1771. }
  1772. };
  1773. /**
  1774. * 根据分组名 获取属性定义
  1775. */
  1776. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1777. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1778. };
  1779. /**
  1780. * 获取全部事件
  1781. */
  1782. PropertyDescription.prototype.getEvents = function () {
  1783. return this.propertyes.events;
  1784. };
  1785. return PropertyDescription;
  1786. }());
  1787. //# sourceMappingURL=PropertyDescription.js.map
  1788. var PropertyDescriptionTable = new Map();
  1789. var width = {
  1790. name: 'width',
  1791. default: '',
  1792. group: 'common',
  1793. desc: '宽',
  1794. type: 'string'
  1795. };
  1796. var height = {
  1797. name: 'height',
  1798. default: '',
  1799. group: 'common',
  1800. desc: '高',
  1801. type: 'string'
  1802. };
  1803. var fieldLabel = {
  1804. name: 'fieldLabel',
  1805. default: '',
  1806. group: 'common',
  1807. desc: '文本描述',
  1808. type: 'string',
  1809. expr: true,
  1810. };
  1811. var text$1 = {
  1812. name: 'text',
  1813. default: '',
  1814. group: 'common',
  1815. desc: '文本描述',
  1816. type: 'string',
  1817. expr: true,
  1818. };
  1819. var iconCls = {
  1820. name: 'iconCls',
  1821. default: '',
  1822. group: 'common',
  1823. desc: '图标',
  1824. type: 'string',
  1825. expr: true,
  1826. };
  1827. var disabled = {
  1828. name: 'disabled',
  1829. default: false,
  1830. group: 'common',
  1831. desc: '禁用',
  1832. type: 'boolean',
  1833. expr: true,
  1834. };
  1835. var value = {
  1836. name: 'value',
  1837. default: '',
  1838. group: 'common',
  1839. desc: '字段值',
  1840. type: 'string',
  1841. expr: true,
  1842. };
  1843. var template = {
  1844. name: 'template',
  1845. default: '',
  1846. group: 'common',
  1847. desc: 'HTML内容',
  1848. type: 'string',
  1849. expr: true,
  1850. };
  1851. var reference = {
  1852. name: 'reference',
  1853. default: '',
  1854. group: 'common',
  1855. desc: '组件句柄',
  1856. type: 'string',
  1857. expr: true,
  1858. };
  1859. var tooltip = {
  1860. name: 'tooltip',
  1861. default: '',
  1862. group: 'common',
  1863. desc: '悬停提示',
  1864. type: 'string'
  1865. };
  1866. // =============事件 ==============
  1867. var click = {
  1868. name: 'click',
  1869. default: '',
  1870. group: 'listeners',
  1871. desc: '点击事件',
  1872. eventParamter: [
  1873. 'sender',
  1874. 'e: any'
  1875. ],
  1876. type: 'listeners'
  1877. };
  1878. var change = {
  1879. name: 'change',
  1880. default: '',
  1881. group: 'listeners',
  1882. desc: 'value change事件',
  1883. eventParamter: [
  1884. 'sender',
  1885. 'e: any'
  1886. ],
  1887. type: 'listeners'
  1888. };
  1889. var keyup = {
  1890. name: 'keyup',
  1891. default: '',
  1892. group: 'listeners',
  1893. desc: '键盘按键抬起事件',
  1894. eventParamter: [
  1895. 'sender',
  1896. 'e'
  1897. ],
  1898. type: 'listeners'
  1899. };
  1900. var afterrender = {
  1901. name: 'afterrender',
  1902. default: '',
  1903. group: 'listeners',
  1904. desc: '控件渲染后触发',
  1905. eventParamter: [
  1906. 'sender',
  1907. 'e'
  1908. ],
  1909. type: 'listeners'
  1910. };
  1911. // =============特性 ==============
  1912. var fix = {
  1913. name: 'fix',
  1914. default: '',
  1915. group: 'fix',
  1916. desc: '特性',
  1917. type: 'fix',
  1918. expr: true,
  1919. };
  1920. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1921. props: [
  1922. height
  1923. ]
  1924. }));
  1925. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1926. props: [
  1927. {
  1928. name: 'borderless',
  1929. default: true,
  1930. group: 'css',
  1931. desc: '有无边框',
  1932. type: 'boolean'
  1933. },
  1934. {
  1935. name: 'type',
  1936. default: '',
  1937. group: 'css',
  1938. desc: '布局类型',
  1939. type: ['line', 'clean', 'wide', 'space', 'form']
  1940. },
  1941. {
  1942. name: '_designMode',
  1943. default: 'module',
  1944. group: 'common',
  1945. desc: '设计类型',
  1946. type: ['none', 'module', 'scroll-module']
  1947. }
  1948. ]
  1949. }));
  1950. var YvBase = {
  1951. props: [
  1952. width, height, reference, afterrender, fix
  1953. ],
  1954. events: [
  1955. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1956. ]
  1957. };
  1958. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1959. props: [
  1960. template
  1961. ]
  1962. }));
  1963. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  1964. props: [
  1965. {
  1966. name: 'label',
  1967. default: '',
  1968. group: 'common',
  1969. desc: '字段组标题',
  1970. type: 'string'
  1971. }
  1972. ]
  1973. }));
  1974. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  1975. props: [
  1976. {
  1977. name: 'src',
  1978. default: '',
  1979. group: 'common',
  1980. desc: '地址路径',
  1981. type: 'string'
  1982. }
  1983. ]
  1984. }));
  1985. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  1986. props: [
  1987. width, height,
  1988. {
  1989. name: 'value',
  1990. default: '上传',
  1991. group: 'common',
  1992. desc: '文本描述',
  1993. type: 'string'
  1994. },
  1995. {
  1996. name: 'upload',
  1997. default: '/upload',
  1998. group: 'common',
  1999. desc: '上传地址',
  2000. type: 'string'
  2001. },
  2002. ],
  2003. events: [
  2004. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2005. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2006. ]
  2007. }));
  2008. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2009. props: [
  2010. value,
  2011. {
  2012. name: 'imgWidth',
  2013. default: '',
  2014. group: 'common',
  2015. desc: '图片宽',
  2016. type: 'string'
  2017. },
  2018. {
  2019. name: 'imgHeight',
  2020. default: '',
  2021. group: 'common',
  2022. desc: '图片高',
  2023. type: 'string'
  2024. }
  2025. ]
  2026. }));
  2027. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2028. props: [
  2029. value,
  2030. {
  2031. name: 'imgWidth',
  2032. default: '',
  2033. group: 'common',
  2034. desc: '图片宽',
  2035. type: 'string'
  2036. },
  2037. {
  2038. name: 'imgHeight',
  2039. default: '',
  2040. group: 'common',
  2041. desc: '图片高',
  2042. type: 'string'
  2043. }
  2044. ]
  2045. }));
  2046. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2047. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2048. }));
  2049. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2050. props: [
  2051. fieldLabel, value, disabled,
  2052. tooltip, width, height
  2053. ],
  2054. }));
  2055. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2056. props: [
  2057. fieldLabel, value, disabled,
  2058. tooltip, width, height, keyup, afterrender, change
  2059. ],
  2060. }));
  2061. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2062. props: [
  2063. fieldLabel, value, disabled,
  2064. tooltip, width, height, keyup, afterrender, change
  2065. ],
  2066. }));
  2067. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2068. props: [
  2069. fieldLabel, value, disabled,
  2070. tooltip, width, height, keyup, afterrender, change
  2071. ],
  2072. }));
  2073. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2074. props: [
  2075. fieldLabel, value, disabled,
  2076. tooltip, width, height, keyup, afterrender, change
  2077. ],
  2078. }));
  2079. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2080. props: [
  2081. fieldLabel, value, disabled,
  2082. tooltip, width, height, keyup, afterrender, change
  2083. ],
  2084. }));
  2085. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2086. props: [
  2087. fieldLabel, value, disabled,
  2088. tooltip, width, height, keyup, afterrender, change
  2089. ],
  2090. }));
  2091. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2092. props: [
  2093. fieldLabel, value, disabled,
  2094. tooltip, width, height, keyup, afterrender, change
  2095. ],
  2096. }));
  2097. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2098. props: [
  2099. fieldLabel, value, disabled,
  2100. tooltip, width, height, keyup, afterrender, change
  2101. ],
  2102. }));
  2103. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2104. props: [
  2105. fieldLabel, value, disabled,
  2106. tooltip, width, height
  2107. ],
  2108. }));
  2109. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2110. props: [
  2111. fieldLabel, value, disabled,
  2112. tooltip, width, height, keyup, afterrender, change
  2113. ],
  2114. }));
  2115. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2116. props: [
  2117. fieldLabel, value, disabled,
  2118. tooltip, width, height, keyup, afterrender, change
  2119. ],
  2120. }));
  2121. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2122. props: [
  2123. fieldLabel, value, disabled,
  2124. tooltip, width, height, keyup, afterrender, change
  2125. ],
  2126. }));
  2127. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2128. props: [
  2129. fieldLabel, value, disabled,
  2130. tooltip, width, height, afterrender, change
  2131. ],
  2132. }));
  2133. //# sourceMappingURL=PropertyDescriptionTable.js.map
  2134. /**
  2135. * 弹出输入框,输入文字
  2136. * @param message 提示文字
  2137. * @param defaultValue 默认值
  2138. * @param multiLine 是否多行输入
  2139. */
  2140. function prompt$1(message, defaultValue, multiLine) {
  2141. if (defaultValue === void 0) { defaultValue = ""; }
  2142. if (multiLine === void 0) { multiLine = false; }
  2143. return new Promise(function (resolve) {
  2144. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2145. if (button === 'ok') {
  2146. resolve(value);
  2147. }
  2148. }, null, multiLine, defaultValue);
  2149. });
  2150. }
  2151. /**
  2152. * 显示错误异常信息
  2153. * @param msg 错误内容
  2154. * @param sender 发送者按钮(可以为空)
  2155. */
  2156. function showErrorDialog(msg, sender) {
  2157. console.error(msg);
  2158. Ext.MessageBox.show({
  2159. title: '错误',
  2160. msg: msg,
  2161. buttons: Ext.MessageBox.OK,
  2162. animateTarget: sender,
  2163. icon: 'error',
  2164. cls: 'show-icon-messagebox',
  2165. });
  2166. }
  2167. /**
  2168. * 显示错误异常信息
  2169. * @param msg 错误内容
  2170. * @param sender 发送者按钮(可以为空)
  2171. */
  2172. function showInfoDialogSimple(msg, sender) {
  2173. console.info(msg);
  2174. Ext.MessageBox.show({
  2175. title: '提示',
  2176. msg: msg,
  2177. buttons: Ext.MessageBox.OK,
  2178. animateTarget: sender,
  2179. icon: 'info',
  2180. cls: 'show-icon-messagebox',
  2181. });
  2182. }
  2183. function msgError(msg, sender) {
  2184. showErrorDialog(msg, sender);
  2185. }
  2186. /**
  2187. * 中间灰底白字提示
  2188. */
  2189. function msg(message) {
  2190. console.log(message);
  2191. var $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 invokeMethod(fn, sender, args) {
  2522. if (typeof fn === 'function') {
  2523. fn.apply.apply(fn, __spread([sender], args));
  2524. }
  2525. }
  2526. /**
  2527. * 判断事件是否为有效的输入字符
  2528. * @param e
  2529. */
  2530. function isChartEvent(e) {
  2531. if (e.key === 'Shift' ||
  2532. e.key === 'Control' ||
  2533. e.key === 'Alt' ||
  2534. e.key === 'Escape' ||
  2535. e.key === 'ArrowRight' ||
  2536. e.key === 'Tab' ||
  2537. e.key === 'ArrowLeft') {
  2538. return false;
  2539. }
  2540. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2541. // 0-9
  2542. return true;
  2543. }
  2544. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2545. // a-z
  2546. return true;
  2547. }
  2548. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2549. // 小键盘 0-9
  2550. return true;
  2551. }
  2552. return false;
  2553. }
  2554. if (!window["time_offset"]) {
  2555. window["time_offset"] = 0;
  2556. }
  2557. function syncDate(date) {
  2558. if (date && date.setTime && date.getTime) {
  2559. date.setTime(date.getTime() + window["time_offset"]);
  2560. }
  2561. return date;
  2562. }
  2563. //# sourceMappingURL=utils.js.map
  2564. function isDesignMode(control, config) {
  2565. var _a, _b;
  2566. if (window["IS_DESIGN_MODE"]) {
  2567. return true;
  2568. }
  2569. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2570. return true;
  2571. }
  2572. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2573. return true;
  2574. }
  2575. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2576. return true;
  2577. }
  2578. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2579. return true;
  2580. }
  2581. return false;
  2582. }
  2583. function toString(value) {
  2584. if (typeof value === 'undefined' || value === null) {
  2585. return "";
  2586. }
  2587. if (typeof value === 'number' && isNaN(value)) {
  2588. return "";
  2589. }
  2590. if (value == 'N/A') {
  2591. return "";
  2592. }
  2593. return ("" + value);
  2594. }
  2595. function isEmpty(value) {
  2596. if (typeof value === 'undefined' || value === null) {
  2597. return true;
  2598. }
  2599. if (typeof value === 'number' && isNaN(value)) {
  2600. return true;
  2601. }
  2602. if (value == 'N/A') {
  2603. return true;
  2604. }
  2605. return ("" + value).trim().length <= 0;
  2606. }
  2607. function createUUID() {
  2608. //@ts-ignore
  2609. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2610. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2611. });
  2612. }
  2613. function getRegList() {
  2614. var regList = _$2.get(window, 'yvanLib.regList');
  2615. if (!regList) {
  2616. regList = [];
  2617. _$2.set(window, 'yvanLib.regList', regList);
  2618. }
  2619. return regList;
  2620. }
  2621. function getRegParamList(methodName) {
  2622. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2623. if (!regParamList) {
  2624. regParamList = {};
  2625. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2626. }
  2627. if (!_$2.has(regParamList, methodName)) {
  2628. regParamList[methodName] = [];
  2629. }
  2630. return regParamList[methodName];
  2631. }
  2632. /**
  2633. * 模拟点击按钮
  2634. */
  2635. function raiseClick(buttonHandle) {
  2636. if (!buttonHandle) {
  2637. return false;
  2638. }
  2639. if (buttonHandle.disabled) {
  2640. // 按钮是禁止状态
  2641. return false;
  2642. }
  2643. if (buttonHandle.hidden) {
  2644. // 按钮是隐藏状态
  2645. return false;
  2646. }
  2647. // 按钮点击
  2648. buttonHandle.click();
  2649. return true;
  2650. }
  2651. /**
  2652. * 标注系统全局函数的参数
  2653. * @param title 函数名称
  2654. * @param type 函数类型
  2655. * @param allowEmpty 可否为空
  2656. */
  2657. function LibParam(title, type, allowEmpty) {
  2658. if (allowEmpty === void 0) { allowEmpty = false; }
  2659. return function (target, methodName, paramsIndex) {
  2660. var systemFnArgs = getRegParamList(methodName);
  2661. systemFnArgs[paramsIndex] = {
  2662. type: type,
  2663. title: title,
  2664. name: methodName,
  2665. allowEmpty: allowEmpty,
  2666. };
  2667. };
  2668. }
  2669. /**
  2670. * 标注函数变成"系统全局函数"
  2671. */
  2672. function Lib(registe) {
  2673. return function (target, propertyKey, descriptor) {
  2674. var libList = getRegList();
  2675. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2676. if (registe.type === 'system') {
  2677. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2678. }
  2679. else if (registe.type === 'format') {
  2680. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2681. }
  2682. return target;
  2683. };
  2684. }
  2685. /**
  2686. * 解析事件
  2687. * 'scope.私有方法名'
  2688. * 'system.系统函数名'
  2689. * 'format.格式化名'
  2690. */
  2691. function lookupFn(scope, event, errorWho) {
  2692. if (isDesignMode(scope, undefined)) {
  2693. return Ext.emptyFn;
  2694. }
  2695. if (!_$2.startsWith(event, 'scope.') &&
  2696. !_$2.startsWith(event, 'system.') &&
  2697. !_$2.startsWith(event, 'format.')) {
  2698. console.error('无法识别的事件响应类型', event);
  2699. throw new TypeError('无法识别的事件响应类型');
  2700. }
  2701. // 为 eval 准备环境
  2702. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2703. var data = scope.viewModel.data;
  2704. var keys = [];
  2705. var values = [];
  2706. _$2.forOwn(data, function (value, key) {
  2707. var idxKey = key.indexOf('//');
  2708. if (idxKey >= 0) {
  2709. keys.push(key.substr(0, idxKey));
  2710. }
  2711. else {
  2712. keys.push(key);
  2713. }
  2714. values.push(value);
  2715. });
  2716. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2717. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2718. if (typeof funcResult !== 'function') {
  2719. console.error('无法识别的事件响应类型', event, func, errorWho);
  2720. throw new TypeError('无法识别的事件响应类型');
  2721. }
  2722. return funcResult;
  2723. }
  2724. /**
  2725. * 从 ext.element 获取 scope 对象
  2726. */
  2727. function lookupScope(extHandle) {
  2728. if (!extHandle) {
  2729. // @ts-ignore
  2730. return;
  2731. }
  2732. if (extHandle.isScope) {
  2733. return extHandle;
  2734. }
  2735. if (extHandle.column) {
  2736. // 列上的组件
  2737. return extHandle.column.lookupReferenceHolder().yvanScope;
  2738. }
  2739. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2740. if (typeof extHandle.lookupViewModel === 'function') {
  2741. var vm = extHandle.lookupViewModel();
  2742. return vm.yvanScope;
  2743. }
  2744. return;
  2745. }
  2746. //# sourceMappingURL=lib.js.map
  2747. /**
  2748. * 全局 ajax 方法
  2749. */
  2750. var ajax = {};
  2751. /**
  2752. * 计算拼音的函数
  2753. */
  2754. var pinyinFunc = function (str) { return (str); };
  2755. exports.scopeOnLoad = null;
  2756. exports.apiConvert = undefined;
  2757. var baseConfigProcessList = [];
  2758. /**
  2759. * 在基类添加 Config 的处理方法
  2760. */
  2761. function baseConfigProcess(option) {
  2762. return function (target, propertyKey) {
  2763. baseConfigProcessList.push(target[propertyKey]);
  2764. };
  2765. }
  2766. // let designMode: boolean = false
  2767. //
  2768. // export function isDesignMode(): boolean {
  2769. // return designMode
  2770. // }
  2771. //
  2772. // export function setDesignMode(v: boolean) {
  2773. // designMode = v
  2774. // }
  2775. /**
  2776. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2777. */
  2778. function serverInvokeUrlTransform(url, option) {
  2779. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2780. }
  2781. /**
  2782. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2783. */
  2784. function sqlUrlTransform(url) {
  2785. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2786. }
  2787. /**
  2788. * YvanUI 全局扩展配置
  2789. */
  2790. function extend(option) {
  2791. if (option.ajax) {
  2792. ajax.func = option.ajax;
  2793. }
  2794. if (option.serverInvokeUrlTransform) {
  2795. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2796. }
  2797. if (option.sqlUrlTransform) {
  2798. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2799. }
  2800. if (option.pinyinFunction) {
  2801. pinyinFunc = option.pinyinFunction;
  2802. }
  2803. if (option.scopeOnLoad) {
  2804. exports.scopeOnLoad = option.scopeOnLoad;
  2805. }
  2806. if (option.scopeOnCreate) {
  2807. exports.scopeOnCreate = option.scopeOnCreate;
  2808. }
  2809. if (option.apiConvert) {
  2810. exports.apiConvert = option.apiConvert;
  2811. }
  2812. // if (typeof option.designMode !== 'undefined') {
  2813. // setDesignMode(option.designMode)
  2814. // }
  2815. }
  2816. function getApiConvert() {
  2817. return exports.apiConvert;
  2818. }
  2819. function getScopeOnCreate() {
  2820. return exports.scopeOnCreate;
  2821. }
  2822. function getPinyin(v) {
  2823. return pinyinFunc(v);
  2824. }
  2825. /**
  2826. * 适用于 Select / Tree 等,作筛选的通用方法.
  2827. * 1.首字母模糊匹配(不区分大小写)
  2828. * 2.标识的模糊匹配(不区分大小写)
  2829. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2830. */
  2831. function keywordFilter(keyword, label, value) {
  2832. if (!keyword) {
  2833. return true;
  2834. }
  2835. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2836. // const labelPy = _.toLower(getPinyin(label))
  2837. //@ts-ignore
  2838. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2839. value = _$2.toLower(_$2.trim(value));
  2840. var found = 0;
  2841. _$2.some(ws, function (word) {
  2842. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2843. found++;
  2844. return;
  2845. }
  2846. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2847. found++;
  2848. return;
  2849. }
  2850. });
  2851. return found >= ws.length;
  2852. }
  2853. //# sourceMappingURL=config.js.map
  2854. var Scope = /** @class */ (function () {
  2855. function Scope(_a) {
  2856. var model = _a.model, vjson = _a.vjson;
  2857. /**
  2858. * 业务模块的唯一编号
  2859. */
  2860. this.id = _$2.uniqueId('scope_');
  2861. this.IS_DESIGN_MODE = false;
  2862. /**
  2863. * onload 运行完成之后才会设置本标记为 true
  2864. */
  2865. this.isLoadFinish = false;
  2866. this._isLoading = false;
  2867. this.model = model;
  2868. if (typeof vjson.layout === 'undefined') {
  2869. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  2870. var ret = buildPlus({ model: model, vjson: vjson });
  2871. model = ret.model;
  2872. vjson = ret.vjson;
  2873. }
  2874. this.originalVjson = _$2.cloneDeep(vjson);
  2875. this.vjson = this.originalVjson; // this.buildVjson()
  2876. var extScope = getScopeOnCreate();
  2877. if (typeof extScope === 'function') {
  2878. extScope({ vjson: vjson, model: model }, this);
  2879. }
  2880. }
  2881. Scope.prototype._addWatch = function (tplExpress, fn) {
  2882. if (!this._watchList) {
  2883. this._watchList = [];
  2884. }
  2885. this._watchList.push({ watch: tplExpress, fn: fn });
  2886. };
  2887. Scope.prototype._applyWatchList = function () {
  2888. var _this = this;
  2889. _$2.forEach(this._watchList, function (item) {
  2890. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  2891. });
  2892. };
  2893. Object.defineProperty(Scope.prototype, "isScope", {
  2894. get: function () {
  2895. return true;
  2896. },
  2897. enumerable: true,
  2898. configurable: true
  2899. });
  2900. /**
  2901. * 产生一个当前模块有效的唯一id
  2902. * @param key 唯一编号
  2903. */
  2904. Scope.prototype.uid = function (key) {
  2905. return this.id + key;
  2906. };
  2907. /**
  2908. * 对话框"保存"成功.
  2909. * 关闭对话框,并响应 success 方法
  2910. * @param data 要傳回的數據(可以為空)
  2911. */
  2912. Scope.prototype.dialogSuccess = function (data) {
  2913. this._handle.fireEvent('success', this, data);
  2914. var sender = this._handle.config.animateTarget;
  2915. var scope = lookupScope(sender);
  2916. if (typeof this['success'] === 'function') {
  2917. this['success'].call(scope, sender, data);
  2918. }
  2919. this.close();
  2920. };
  2921. /**
  2922. * 设置等待状态
  2923. * @param value
  2924. * @param msg
  2925. */
  2926. Scope.prototype.setLoading = function (value) {
  2927. var _a;
  2928. var scope = this;
  2929. this._isLoading = value;
  2930. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  2931. };
  2932. Scope.prototype.getLoading = function () {
  2933. return this._isLoading;
  2934. };
  2935. /**
  2936. * 以对话框模式打开当前模块
  2937. * @param sender 发送者(按钮或Scope对象)
  2938. * @param vjsonOption 界面覆盖选项(可以为空)
  2939. * @param dataOption 数据覆盖选项(可以为空)
  2940. */
  2941. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  2942. var _a;
  2943. var that = this;
  2944. var vmodel = _$2.defaultsDeep({
  2945. //
  2946. }, dataOption, that.model);
  2947. this.viewModel = new Ext.app.ViewModel(vmodel);
  2948. this.viewModel.yvanScope = this;
  2949. this._applyWatchList();
  2950. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  2951. var config = _$2.defaultsDeep({
  2952. animateTarget: sender,
  2953. viewModel: this.viewModel,
  2954. yvanScope: this,
  2955. referenceHolder: true,
  2956. }, vjsonOption, that.vjson, windows);
  2957. if (config.height === 'unset') {
  2958. delete config.height;
  2959. }
  2960. if (config.width === 'unset') {
  2961. delete config.width;
  2962. }
  2963. // const holder = sender?.lookupReferenceHolder()
  2964. // delete config.constrain
  2965. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  2966. if (topScope) {
  2967. config.constrain = true;
  2968. this.topScope = topScope;
  2969. }
  2970. var win = new Ext.Window(config);
  2971. // if (holder) {
  2972. // holder.add(win)
  2973. // }
  2974. if (topScope) {
  2975. topScope._handle.add(win);
  2976. }
  2977. win.addListener('beforerender', function (sender) {
  2978. // 记录句柄
  2979. if (sender && !that._handle) {
  2980. that._handle = sender;
  2981. }
  2982. });
  2983. win.addListener('afterrender', function (sender) {
  2984. // 调用onLoad回调
  2985. try {
  2986. that._onLoad();
  2987. }
  2988. catch (e) {
  2989. console.error('errorAt onLoad', e);
  2990. }
  2991. window['cw'] = that;
  2992. });
  2993. win.addListener('destroy', this._destroy.bind(this));
  2994. win.show();
  2995. };
  2996. /**
  2997. * 以标签模式打开当前模块
  2998. * @param vjsonOption 界面覆盖选项(可以为空)
  2999. * @param dataOption 数据覆盖选项(可以为空)
  3000. */
  3001. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3002. var _this = this;
  3003. var that = this;
  3004. this._vjsonOption = vjsonOption;
  3005. this._dataOption = dataOption;
  3006. var vmodel = _$2.defaultsDeep({
  3007. data: {}
  3008. }, dataOption, that.model);
  3009. this.viewModel = new Ext.app.ViewModel(vmodel);
  3010. this.viewModel.yvanScope = this;
  3011. this._applyWatchList();
  3012. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3013. // 根级不能设置id
  3014. delete that.vjson.id;
  3015. var config = _$2.defaultsDeep({
  3016. viewModel: this.viewModel,
  3017. yvanScope: this,
  3018. referenceHolder: true,
  3019. }, vjsonOption, that.vjson);
  3020. var tt = Ext.getCmp('TT');
  3021. var handle = tt.addScope(this, config, function (handle) {
  3022. handle.addListener('added', function (sender) {
  3023. // 记录句柄
  3024. if (sender && !that._handle) {
  3025. that._handle = sender;
  3026. }
  3027. });
  3028. handle.addListener('afterrender', function (sender) {
  3029. // 调用onLoad回调
  3030. try {
  3031. that._onLoad();
  3032. }
  3033. catch (e) {
  3034. console.error('errorAt onLoad', e);
  3035. }
  3036. });
  3037. handle.addListener('destroy', _this._destroy.bind(_this));
  3038. });
  3039. return handle;
  3040. };
  3041. /**
  3042. * 直接渲染到元素
  3043. * @param element 渲染目标
  3044. * @param vjsonOption 界面覆盖选项(可以为空)
  3045. * @param dataOption 数据覆盖选项(可以为空)
  3046. */
  3047. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3048. var that = this;
  3049. this._vjsonOption = vjsonOption;
  3050. this._dataOption = dataOption;
  3051. var vmodel = _$2.defaultsDeep({
  3052. data: {}
  3053. }, that.model, dataOption);
  3054. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3055. this.viewModel = new Ext.app.ViewModel(vmodel);
  3056. this.viewModel.yvanScope = this;
  3057. this._applyWatchList();
  3058. var config = _$2.defaultsDeep({
  3059. viewModel: this.viewModel,
  3060. yvanScope: this,
  3061. referenceHolder: true,
  3062. renderTo: element,
  3063. listeners: {
  3064. afterrender: function (sender) {
  3065. var _a;
  3066. // 记录句柄
  3067. if (sender && !that._handle) {
  3068. that._handle = sender;
  3069. }
  3070. // 调用onLoad回调
  3071. that._onLoad();
  3072. // 如果vjson中配置了 afterrender ,需要恢复状态
  3073. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3074. },
  3075. },
  3076. }, vjsonOption, that.vjson);
  3077. new Ext.container.Viewport(config);
  3078. };
  3079. Scope.prototype.showDesigner = function (designer, option) {
  3080. var that = this;
  3081. var vmodel = _$2.defaultsDeep({
  3082. data: {
  3083. IS_DESIGN_MODE: true,
  3084. }
  3085. }, that.model);
  3086. this.IS_DESIGN_MODE = true;
  3087. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3088. this.viewModel = new Ext.app.ViewModel(vmodel);
  3089. this.viewModel.yvanScope = this;
  3090. this._applyWatchList();
  3091. var config = _$2.defaultsDeep({
  3092. viewModel: this.viewModel,
  3093. yvanScope: this,
  3094. referenceHolder: true,
  3095. listeners: {
  3096. afterrender: function (sender) {
  3097. var _a;
  3098. // 记录句柄
  3099. if (sender && !that._handle) {
  3100. that._handle = sender;
  3101. }
  3102. // 调用onLoad回调
  3103. that._onLoad();
  3104. // 如果vjson中配置了 afterrender ,需要恢复状态
  3105. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3106. },
  3107. },
  3108. }, that.vjson);
  3109. designer.removeAll(true);
  3110. designer.add(config);
  3111. };
  3112. /**
  3113. * 关闭对话框(或标签页)
  3114. */
  3115. Scope.prototype.close = function () {
  3116. this._handle.close();
  3117. };
  3118. Object.defineProperty(Scope.prototype, "data", {
  3119. /**
  3120. * 获取 viewModel 里包含的数据(只读)
  3121. */
  3122. get: function () {
  3123. return this.viewModel.getData();
  3124. },
  3125. enumerable: true,
  3126. configurable: true
  3127. });
  3128. /**
  3129. * 设置 viewModel 中的数据
  3130. * 可以是 key, value 模式
  3131. * 也可以是 {key:value} 模式
  3132. */
  3133. Scope.prototype.set = function (path, value) {
  3134. return this.viewModel.set(path, value);
  3135. };
  3136. /**
  3137. * 寻找模块内所有的 xtype 对应的对象
  3138. * @param xtypeKey
  3139. */
  3140. Scope.prototype.down = function (xtypeKey) {
  3141. return this._handle.down(xtypeKey);
  3142. };
  3143. Object.defineProperty(Scope.prototype, "refs", {
  3144. /**
  3145. * 获取所有设置过 Reference 名称的组件
  3146. */
  3147. get: function () {
  3148. var _a, _b;
  3149. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3150. },
  3151. enumerable: true,
  3152. configurable: true
  3153. });
  3154. Scope.prototype._destroy = function () {
  3155. var that = this;
  3156. that.onDestroy();
  3157. delete that._watchList;
  3158. delete that._handle;
  3159. this.isLoadFinish = false;
  3160. };
  3161. /**
  3162. * 私有渲染完成后的回调
  3163. */
  3164. Scope.prototype._onLoad = function () {
  3165. var _this = this;
  3166. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3167. exports.scopeOnLoad(this);
  3168. }
  3169. this.onLoad();
  3170. _$2.defer(function () {
  3171. _this.isLoadFinish = true;
  3172. });
  3173. };
  3174. /**
  3175. * 默认 渲染完成之后调用的函数
  3176. */
  3177. Scope.prototype.onLoad = function () {
  3178. };
  3179. /**
  3180. * 组件卸载之后的回调
  3181. */
  3182. Scope.prototype.onDestroy = function () {
  3183. };
  3184. return Scope;
  3185. }());
  3186. /**
  3187. * 观察装饰器,viewModel 属性更改时触发成员方法
  3188. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3189. */
  3190. function watch(tplExpress, deep) {
  3191. if (deep === void 0) { deep = false; }
  3192. return function (target, propertyKey, pd) {
  3193. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3194. return target[propertyKey];
  3195. };
  3196. }
  3197. // 获取vjson的hash值
  3198. function getVjsonHash(str) {
  3199. var hash = 3465217896, i, ch;
  3200. for (i = str.length - 1; i >= 0; i--) {
  3201. ch = str.charCodeAt(i);
  3202. hash ^= ((hash << 5) + ch + (hash >> 2));
  3203. }
  3204. return (hash & 0x7FFFFFFF) + "";
  3205. }
  3206. function buildPlus(_a) {
  3207. var model = _a.model, vjson = _a.vjson;
  3208. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3209. {
  3210. layout: 'border',
  3211. // tbar: vjson.action,
  3212. items: vjson.items,
  3213. },
  3214. ] });
  3215. if (_$2.isArray(vjson.action)) {
  3216. vjsonNew.items[0].tbar = vjson.action;
  3217. }
  3218. return { model: model, vjson: vjsonNew };
  3219. }
  3220. //# sourceMappingURL=Scope.js.map
  3221. var model = {
  3222. data: {
  3223. leftTabTitle: ''
  3224. }
  3225. };
  3226. //# sourceMappingURL=Workbench.model.js.map
  3227. var vjson = {
  3228. frame: false,
  3229. layout: 'border',
  3230. width: '100%',
  3231. height: '100%',
  3232. border: false,
  3233. defaults: {
  3234. border: false
  3235. },
  3236. items: [
  3237. {
  3238. region: 'north',
  3239. height: 60,
  3240. cls: 'main-header',
  3241. reference: 'mainTop',
  3242. layout: 'hbox',
  3243. items: [
  3244. {
  3245. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3246. flex: 1,
  3247. border: false
  3248. },
  3249. {
  3250. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3251. menu: [
  3252. {
  3253. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3254. reference: 'commonSetting'
  3255. },
  3256. {
  3257. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3258. listeners: {
  3259. // click: 'scope.ready_api_click'
  3260. }
  3261. },
  3262. ]
  3263. },
  3264. {
  3265. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3266. cls: 'header-menu',
  3267. menu: [
  3268. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3269. ]
  3270. },
  3271. ]
  3272. },
  3273. {
  3274. region: 'west',
  3275. bind: {
  3276. title: '{leftTabTitle}',
  3277. },
  3278. titleAlign: 'center',
  3279. border: true, split: true, width: 340, collapsible: true,
  3280. reference: 'leftTab',
  3281. xtype: 'tabpanel',
  3282. tabPosition: 'left',
  3283. tabRotation: 0,
  3284. tabBar: {
  3285. border: false
  3286. },
  3287. listeners: {
  3288. tabchange: 'scope.leftTabChange',
  3289. },
  3290. items: [
  3291. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3292. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3293. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3294. { tooltip: '表单转换', iconCls: 'x-fa fa-exchange', },
  3295. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3296. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3297. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3298. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3299. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3300. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3301. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3302. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3303. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3304. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3305. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3306. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3307. ]
  3308. },
  3309. {
  3310. region: 'east',
  3311. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3312. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3313. },
  3314. {
  3315. region: 'center',
  3316. split: true, border: true,
  3317. xtype: 'maintab', reference: 'tt', id: 'TT',
  3318. plain: true,
  3319. listeners: {
  3320. restorypage: 'scope.openScope',
  3321. tabchange: 'scope.tabchange'
  3322. },
  3323. items: []
  3324. },
  3325. ],
  3326. };
  3327. //# sourceMappingURL=Workbench.view.js.map
  3328. /**
  3329. * 获取当前打开的项目资料
  3330. */
  3331. function getCurrentProject() {
  3332. // const value = sessionStorage.getItem('CurrentProject');
  3333. // if (value) {
  3334. // project = JSON.parse(value)
  3335. // if (!project.url) {
  3336. // project = undefined
  3337. // }
  3338. // }
  3339. // return project
  3340. return {
  3341. uuid: '00000000',
  3342. name: '本服项目',
  3343. url: '',
  3344. };
  3345. }
  3346. /**
  3347. * 设置当前打开的项目资料(全局)
  3348. */
  3349. function setCurrentProject(value) {
  3350. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3351. }
  3352. //# sourceMappingURL=Project.js.map
  3353. // ------------------------------------------------------------------------------------------ types
  3354. /** 订阅消息key类型 */
  3355. var EventType;
  3356. (function (EventType) {
  3357. /** FileTree打开Module */
  3358. EventType["ModuleOpen"] = "ModuleOpen";
  3359. /** ModulePage 创建 */
  3360. EventType["ModulePageCreate"] = "ModulePageCreate";
  3361. /** ModuleItem内容变化 */
  3362. EventType["ModuleItemChange"] = "ModuleItemChange";
  3363. /** ModuleItem的 jsView 内容变化 */
  3364. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3365. /** 设置 vjson */
  3366. EventType["SetVjson"] = "SetVjson";
  3367. /** 更新 vjson */
  3368. EventType["UpdateVjson"] = "UpdateVjson";
  3369. /** 更新 组件vjson */
  3370. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3371. /** Component 选中内容变化 */
  3372. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3373. /** Component 选中内容变化 */
  3374. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3375. /** Component 删除事件 */
  3376. EventType["ComponentDelete"] = "ComponentDelete";
  3377. /** MainTab 选中改变事件 */
  3378. EventType["MainTabChange"] = "MainTabChange";
  3379. /** ModuleTab 选中改变事件 */
  3380. EventType["ModuleTabChange"] = "ModuleTabChange";
  3381. /** 保存事件 */
  3382. EventType["SaveCall"] = "SaveCall";
  3383. /** 撤销 */
  3384. EventType["Undo"] = "Undo";
  3385. /** 还原 */
  3386. EventType["Redo"] = "Redo";
  3387. /** 剪切 */
  3388. EventType["Cut"] = "Cut";
  3389. /** 复制 */
  3390. EventType["Copy"] = "Copy";
  3391. /** 粘贴 */
  3392. EventType["Paste"] = "Paste";
  3393. /** 全选 */
  3394. EventType["SelectAll"] = "SelectAll";
  3395. /** 读取剪切板 */
  3396. EventType["ClipboardRead"] = "ClipboardRead";
  3397. /** 检查模块更新 */
  3398. EventType["RunCheckModule"] = "RunCheckModule";
  3399. /** 停止检查模块更新 */
  3400. EventType["StopCheckModule"] = "StopCheckModule";
  3401. })(EventType || (EventType = {}));
  3402. // ------------------------------------------------------------------------------------------ impls
  3403. var EventBus = /** @class */ (function () {
  3404. function EventBus() {
  3405. /** 事件数据 */
  3406. this.store = {};
  3407. /** 事件订阅者注册表 */
  3408. this.observeStoreTable = {};
  3409. this.init();
  3410. }
  3411. EventBus.prototype.init = function () {
  3412. var _this = this;
  3413. // 更改store值就会自动publish消息 - 实现
  3414. this.store = new Proxy({}, {
  3415. get: function (target, key) {
  3416. return target[key];
  3417. },
  3418. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3419. set: function (target, key, data) {
  3420. if (noValue(key))
  3421. return false;
  3422. target[key] = data;
  3423. // 消息通知订阅者
  3424. var observerArr = _this.observeStoreTable[key];
  3425. if (noValue(observerArr) || observerArr.length <= 0)
  3426. return true;
  3427. observerArr.forEach(function (handler) {
  3428. //try {
  3429. handler(data, key);
  3430. // } catch (err) {
  3431. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3432. // }
  3433. });
  3434. return true;
  3435. },
  3436. });
  3437. };
  3438. /** 取消注册订阅者 */
  3439. EventBus.prototype.unregisterObserver = function (key, handler) {
  3440. var _this = this;
  3441. var observerArr = this.observeStoreTable[key];
  3442. if (noValue(observerArr) || observerArr.length <= 0)
  3443. return;
  3444. if (noValue(handler)) {
  3445. this.observeStoreTable[key] = [];
  3446. }
  3447. else {
  3448. observerArr.forEach(function (obsHandler, index) {
  3449. if (obsHandler !== handler)
  3450. return;
  3451. _this.observeStoreTable[key].splice(index, 1);
  3452. });
  3453. }
  3454. };
  3455. /** 注册订阅者 */
  3456. EventBus.prototype.registerObserver = function (key, handler) {
  3457. var observerArr = this.observeStoreTable[key];
  3458. if (noValue(observerArr) || observerArr.length <= 0) {
  3459. observerArr = [];
  3460. this.observeStoreTable[key] = observerArr;
  3461. }
  3462. observerArr.push(handler);
  3463. // if (noValue(key)) return;
  3464. // const sourceValue = this.store[key];
  3465. // if (noValue(sourceValue)) return;
  3466. // handler(sourceValue, key);
  3467. };
  3468. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3469. EventBus.prototype.getStore = function () {
  3470. return this.store;
  3471. };
  3472. /**
  3473. * 取消订阅
  3474. * @param key 订阅的消息key
  3475. * @param handler 指定取消的监听函数
  3476. */
  3477. EventBus.prototype.unsubscribe = function (key, handler) {
  3478. var _this = this;
  3479. if (key instanceof Array) {
  3480. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3481. }
  3482. else {
  3483. this.unregisterObserver(key, handler);
  3484. }
  3485. };
  3486. /**
  3487. * 消息订阅
  3488. * @param key 订阅的消息key
  3489. * @param handler 监听函数
  3490. */
  3491. EventBus.prototype.subscribe = function (key, handler) {
  3492. var _this = this;
  3493. var cancelSubscribe = {
  3494. key: key,
  3495. cancel: function () {
  3496. },
  3497. };
  3498. if (key instanceof Array) {
  3499. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3500. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3501. }
  3502. else {
  3503. this.registerObserver(key, handler);
  3504. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3505. }
  3506. return cancelSubscribe;
  3507. };
  3508. /**
  3509. * 消息订阅(只订阅一次)
  3510. * @param key 订阅的消息key
  3511. * @param handler 监听函数
  3512. */
  3513. EventBus.prototype.subscribeOnce = function (key, handler) {
  3514. var cancelSubscribe = this.subscribe(key, function (data) {
  3515. // try {
  3516. handler(data, key);
  3517. // } catch (err) {
  3518. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3519. // }
  3520. cancelSubscribe.cancel();
  3521. });
  3522. };
  3523. /**
  3524. * 发送消息(触发订阅监听函数)
  3525. * @param key 消息key
  3526. * @param eventData 消息值
  3527. */
  3528. EventBus.prototype.publish = function (key, eventData) {
  3529. var _this = this;
  3530. if (key instanceof Array) {
  3531. key.forEach(function (k) { return _this.store[k] = eventData; });
  3532. }
  3533. else {
  3534. this.store[key] = eventData;
  3535. }
  3536. };
  3537. return EventBus;
  3538. }());
  3539. // ------------------------------------------------------------------------------------------ use
  3540. var eventBus = new EventBus();
  3541. //# sourceMappingURL=EventBus.js.map
  3542. var model$1 = {
  3543. data: {
  3544. dataSync_isStart: false,
  3545. dataSync: {
  3546. skipError: false,
  3547. clearData: false,
  3548. tables: []
  3549. },
  3550. dataSyncResult: {
  3551. jobId: ''
  3552. },
  3553. dataSource1: '',
  3554. dataSource2: '',
  3555. schema1: '',
  3556. schema2: '',
  3557. hasDiff: false,
  3558. }
  3559. };
  3560. //# sourceMappingURL=DbSync.model.js.map
  3561. var vjson$1 = {
  3562. title: '数据库同步',
  3563. layout: 'fit',
  3564. items: [
  3565. {
  3566. reference: 'wizard1',
  3567. layout: 'card',
  3568. items: [
  3569. {
  3570. reference: 'first',
  3571. layout: 'fit',
  3572. bbar: [
  3573. '->',
  3574. {
  3575. xtype: 'button',
  3576. iconCls: 'x-fa fa-road',
  3577. text: '结构同步 &raquo;',
  3578. bind: {
  3579. disabled: '{!hasDiff}'
  3580. },
  3581. listeners: {
  3582. click: 'scope.structCopyTo',
  3583. }
  3584. },
  3585. {
  3586. xtype: 'button',
  3587. iconCls: 'x-fa fa-files-o',
  3588. text: '数据同步 &raquo;',
  3589. bind: {
  3590. disabled: '{!hasDiff}'
  3591. },
  3592. listeners: {
  3593. click: 'scope.dataCopyTo',
  3594. }
  3595. },
  3596. {
  3597. xtype: 'button',
  3598. iconCls: 'x-fa fa-sort-alpha-desc',
  3599. text: '索引同步 &raquo;',
  3600. bind: {
  3601. disabled: '{!hasDiff}'
  3602. },
  3603. listeners: {
  3604. click: 'scope.indexCopyTo',
  3605. }
  3606. },
  3607. {
  3608. xtype: 'button',
  3609. iconCls: 'x-fa fa-product-hunt',
  3610. text: '存储过程同步 &raquo;',
  3611. bind: {
  3612. disabled: '{!hasDiff}'
  3613. },
  3614. listeners: {
  3615. click: 'scope.procedureCopyTo',
  3616. }
  3617. },
  3618. ],
  3619. items: [
  3620. {
  3621. title: '数据库对比',
  3622. reference: 'grid1',
  3623. xtype: 'yvgrid',
  3624. pagination: false,
  3625. border: false,
  3626. cellTip: true,
  3627. selModel: {
  3628. type: 'checkboxmodel',
  3629. mode: 'MULTI',
  3630. },
  3631. tbar: {
  3632. xtype: 'toolbar',
  3633. items: [
  3634. {
  3635. xtype: 'combo',
  3636. fieldLabel: '源数据库',
  3637. bind: {
  3638. value: '{dataSource1}'
  3639. },
  3640. dataSource: 'scope.getDataBaseName'
  3641. },
  3642. {
  3643. xtype: 'combo',
  3644. fieldLabel: '目标数据库',
  3645. bind: {
  3646. value: '{dataSource2}'
  3647. },
  3648. dataSource: 'scope.getDataBaseName'
  3649. },
  3650. {
  3651. xtype: 'button',
  3652. iconCls: 'x-fa fa-flash',
  3653. text: '对比',
  3654. bind: {
  3655. disabled: '{!dataSource1 || !dataSource2}'
  3656. },
  3657. listeners: {
  3658. click: 'scope.diff',
  3659. }
  3660. },
  3661. {
  3662. xtype: 'button',
  3663. iconCls: 'x-fa fa-cloud-download',
  3664. text: '重新拉取结构(耗时!)',
  3665. bind: {
  3666. disabled: '{!dataSource1 || !dataSource2}'
  3667. },
  3668. listeners: {
  3669. click: 'scope.dbToMeta',
  3670. }
  3671. },
  3672. ]
  3673. },
  3674. columns: [
  3675. {
  3676. dataIndex: 'table_name1',
  3677. header: '源表',
  3678. width: 300,
  3679. },
  3680. {
  3681. dataIndex: 'table_name2',
  3682. header: '目标表',
  3683. width: 300,
  3684. },
  3685. {
  3686. dataIndex: 'diff',
  3687. header: '对比结果',
  3688. width: 100,
  3689. },
  3690. {
  3691. xtype: 'actioncolumn',
  3692. width: 30,
  3693. sortable: false,
  3694. menuDisabled: true,
  3695. items: [
  3696. {
  3697. iconCls: 'x-fa fa-bars',
  3698. text: '打开',
  3699. handler: 'scope.showDetail',
  3700. }
  3701. ]
  3702. },
  3703. {
  3704. dataIndex: 'remark',
  3705. header: '详情',
  3706. width: 200,
  3707. sortable: true,
  3708. },
  3709. ],
  3710. },
  3711. ]
  3712. },
  3713. {
  3714. reference: 'ddl',
  3715. layout: {
  3716. type: 'vbox',
  3717. pack: 'start',
  3718. align: 'stretch'
  3719. },
  3720. items: [
  3721. {
  3722. xtype: 'sqleditor',
  3723. reference: 'ddleditor',
  3724. flex: 1,
  3725. },
  3726. {
  3727. xtype: 'toolbar',
  3728. items: [
  3729. '->',
  3730. {
  3731. xtype: 'button',
  3732. text: '&laquo; 上一步',
  3733. listeners: {
  3734. click: 'scope.back'
  3735. }
  3736. },
  3737. {
  3738. xtype: 'button',
  3739. iconCls: 'x-fa fa-flash',
  3740. text: '执行',
  3741. listeners: {
  3742. click: 'scope.executeDDL'
  3743. }
  3744. },
  3745. ]
  3746. }
  3747. ]
  3748. },
  3749. {
  3750. reference: 'ddl_idx',
  3751. layout: {
  3752. type: 'vbox',
  3753. pack: 'start',
  3754. align: 'stretch'
  3755. },
  3756. items: [
  3757. {
  3758. xtype: 'sqleditor',
  3759. reference: 'ddleditor_idx',
  3760. flex: 1,
  3761. },
  3762. {
  3763. xtype: 'toolbar',
  3764. items: [
  3765. '->',
  3766. {
  3767. xtype: 'button',
  3768. text: '&laquo; 上一步',
  3769. listeners: {
  3770. click: 'scope.back'
  3771. }
  3772. },
  3773. {
  3774. xtype: 'button',
  3775. iconCls: 'x-fa fa-flash',
  3776. text: '执行',
  3777. listeners: {
  3778. click: 'scope.executeDDLIdx'
  3779. }
  3780. },
  3781. ]
  3782. }
  3783. ]
  3784. },
  3785. {
  3786. reference: 'ddl_procedure',
  3787. layout: {
  3788. type: 'vbox',
  3789. pack: 'start',
  3790. align: 'stretch'
  3791. },
  3792. items: [
  3793. {
  3794. xtype: 'sqleditor',
  3795. reference: 'ddleditor_procedure',
  3796. flex: 1,
  3797. },
  3798. {
  3799. xtype: 'toolbar',
  3800. items: [
  3801. '->',
  3802. {
  3803. xtype: 'button',
  3804. text: '&laquo; 上一步',
  3805. listeners: {
  3806. click: 'scope.back'
  3807. }
  3808. },
  3809. {
  3810. xtype: 'button',
  3811. iconCls: 'x-fa fa-flash',
  3812. text: '执行',
  3813. listeners: {
  3814. click: 'scope.executeProcedureSQL'
  3815. }
  3816. },
  3817. ]
  3818. }
  3819. ]
  3820. },
  3821. {
  3822. reference: 'datacopy',
  3823. xtype: 'yvgrid',
  3824. pagination: false,
  3825. tbar: {
  3826. xtype: 'toolbar',
  3827. items: [
  3828. {
  3829. xtype: 'checkbox',
  3830. fieldLabel: '忽略错误',
  3831. bind: {
  3832. value: '{dataSync.skipError}'
  3833. },
  3834. },
  3835. {
  3836. xtype: 'checkbox',
  3837. fieldLabel: '清空数据',
  3838. bind: {
  3839. value: '{dataSync.clearData}'
  3840. },
  3841. },
  3842. {
  3843. xtype: 'button',
  3844. iconCls: 'x-fa fa-play-circle',
  3845. text: '开始',
  3846. bind: {
  3847. disabled: '{dataSync_isStart}'
  3848. },
  3849. listeners: { click: 'scope.dataSync_start' }
  3850. },
  3851. {
  3852. xtype: 'button',
  3853. iconCls: 'x-fa fa-stop-circle',
  3854. text: '停止',
  3855. bind: {
  3856. disabled: '{!dataSync_isStart}'
  3857. },
  3858. listeners: { click: 'scope.dataSync_stop' }
  3859. },
  3860. ]
  3861. },
  3862. columns: [
  3863. {
  3864. dataIndex: 'tableName', header: '表名',
  3865. width: 300,
  3866. },
  3867. {
  3868. dataIndex: 'dataCount', header: '总记录数',
  3869. width: 150,
  3870. },
  3871. {
  3872. dataIndex: 'currentIdx', header: '当前记录数',
  3873. width: 150,
  3874. },
  3875. {
  3876. dataIndex: 'syncCount', header: '同步数',
  3877. width: 150,
  3878. },
  3879. {
  3880. dataIndex: 'deleteCount', header: '删除',
  3881. width: 150,
  3882. },
  3883. {
  3884. dataIndex: 'syncProgress', header: '进度',
  3885. width: 150, dataType: 'int', formatter: 'percentRenderer'
  3886. },
  3887. ]
  3888. }
  3889. ]
  3890. }
  3891. ]
  3892. };
  3893. //# sourceMappingURL=DbSync.view.js.map
  3894. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  3895. function createEmptyModule(path, filename) {
  3896. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  3897. }
  3898. function createFolder(parentPath, filename) {
  3899. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  3900. }
  3901. function getModuleFileContent(module) {
  3902. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  3903. }
  3904. function saveFile(fileFullPath, fileContent) {
  3905. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  3906. // @ts-ignore
  3907. system.msg("保存成功");
  3908. return res;
  3909. });
  3910. }
  3911. function getQueryDslInfo(tableName) {
  3912. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  3913. args: [
  3914. { tableName: tableName }
  3915. ]
  3916. }).catch(function (e) {
  3917. var _a, _b;
  3918. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  3919. showErrorDialog(msg);
  3920. console.error(msg, e);
  3921. });
  3922. }
  3923. function invokeServer(url, param) {
  3924. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  3925. return request.post(url, {
  3926. args: [
  3927. param
  3928. ]
  3929. }).catch(function (e) {
  3930. var _a, _b;
  3931. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  3932. showErrorDialog(msg);
  3933. console.error(msg, e);
  3934. });
  3935. }
  3936. function parseSqlApi(sql) {
  3937. return request.post(getBaseUrl() + "@parseSqlApi", {
  3938. args: [sql]
  3939. }).catch(function (e) {
  3940. var _a, _b;
  3941. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  3942. showErrorDialog(msg);
  3943. console.error(msg, e);
  3944. });
  3945. }
  3946. function saveModuleFiles(param) {
  3947. return request.post(getBaseUrl() + "@saveModuleFiles", {
  3948. args: [
  3949. param
  3950. ]
  3951. }).catch(function (e) {
  3952. var _a, _b;
  3953. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  3954. showErrorDialog(msg);
  3955. console.error(msg, e);
  3956. });
  3957. }
  3958. function createQueryDSLFile(_a) {
  3959. var schema_name = _a.schema_name, table_name = _a.table_name;
  3960. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  3961. args: [{ schema_name: schema_name, table_name: table_name }]
  3962. }).catch(function (e) {
  3963. var _a, _b;
  3964. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  3965. showErrorDialog(msg);
  3966. console.error(msg, e);
  3967. });
  3968. }
  3969. function dbToMeta(param) {
  3970. if (typeof param === 'undefined') {
  3971. param = { datasource: 'master' };
  3972. }
  3973. else if (typeof param.datasource === 'undefined') {
  3974. param.datasource = 'master';
  3975. }
  3976. return request.post(getBaseUrl() + "@dbToMeta", {
  3977. args: [
  3978. param
  3979. ]
  3980. }).catch(function (e) {
  3981. var _a, _b;
  3982. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  3983. showErrorDialog(msg);
  3984. console.error(msg, e);
  3985. });
  3986. }
  3987. function getColumnDomainApi(param) {
  3988. if (typeof param === 'undefined') {
  3989. param = { datasource: 'master' };
  3990. }
  3991. else if (typeof param.datasource === 'undefined') {
  3992. param.datasource = 'master';
  3993. }
  3994. return request.post(getBaseUrl() + "@getColumnDomain", {
  3995. args: [
  3996. param
  3997. ]
  3998. }).catch(function (e) {
  3999. var _a, _b;
  4000. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  4001. showErrorDialog(msg);
  4002. console.error(msg, e);
  4003. });
  4004. }
  4005. function getMateData(param) {
  4006. if (typeof param === 'undefined') {
  4007. param = { datasource: 'master' };
  4008. }
  4009. else if (typeof param.datasource === 'undefined') {
  4010. param.datasource = 'master';
  4011. }
  4012. return request.post(getBaseUrl() + "@getMateData", {
  4013. args: [
  4014. param
  4015. ]
  4016. }).catch(function (e) {
  4017. var _a, _b;
  4018. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4019. showErrorDialog(msg);
  4020. console.error(msg, e);
  4021. });
  4022. }
  4023. function getMateDataByTableName(param) {
  4024. if (typeof param === 'undefined') {
  4025. param = { datasource: 'master' };
  4026. }
  4027. else if (typeof param.datasource === 'undefined') {
  4028. param.datasource = 'master';
  4029. }
  4030. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4031. args: [
  4032. param
  4033. ]
  4034. }).catch(function (e) {
  4035. var _a, _b;
  4036. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4037. showErrorDialog(msg);
  4038. console.error(msg, e);
  4039. });
  4040. }
  4041. function saveMetaTableChanges(param) {
  4042. if (typeof param === 'undefined') {
  4043. param = { datasource: 'master' };
  4044. }
  4045. else if (typeof param.datasource === 'undefined') {
  4046. param.datasource = 'master';
  4047. }
  4048. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4049. args: [
  4050. param
  4051. ]
  4052. }).catch(function (e) {
  4053. var _a, _b;
  4054. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4055. showErrorDialog(msg);
  4056. console.error(msg, e);
  4057. });
  4058. }
  4059. function getModifyTableDDL(param) {
  4060. if (typeof param === 'undefined') {
  4061. param = { datasource: 'master' };
  4062. }
  4063. else if (typeof param.datasource === 'undefined') {
  4064. param.datasource = 'master';
  4065. }
  4066. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4067. args: [
  4068. param
  4069. ]
  4070. }).catch(function (e) {
  4071. var _a, _b;
  4072. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4073. showErrorDialog(msg);
  4074. console.error(msg, e);
  4075. });
  4076. }
  4077. function pushToDbCommitApi(param) {
  4078. if (typeof param === 'undefined') {
  4079. param = { datasource: 'master' };
  4080. }
  4081. else if (typeof param.datasource === 'undefined') {
  4082. param.datasource = 'master';
  4083. }
  4084. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4085. args: [
  4086. param
  4087. ]
  4088. }).catch(function (e) {
  4089. var _a, _b;
  4090. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4091. showErrorDialog(msg);
  4092. console.error(msg, e);
  4093. });
  4094. }
  4095. /**
  4096. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4097. */
  4098. function saveMetaExBuildDDL(param) {
  4099. if (typeof param === 'undefined') {
  4100. param = { datasource: 'master' };
  4101. }
  4102. else if (typeof param.datasource === 'undefined') {
  4103. param.datasource = 'master';
  4104. }
  4105. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4106. args: [
  4107. param
  4108. ]
  4109. }).catch(function (e) {
  4110. var _a, _b;
  4111. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4112. showErrorDialog(msg);
  4113. console.error(msg, e);
  4114. });
  4115. }
  4116. function registerResource(params) {
  4117. return request.post(getBaseUrl() + "@registerResource", {
  4118. args: [params]
  4119. }).catch(function (e) {
  4120. var _a, _b;
  4121. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4122. showErrorDialog(msg);
  4123. console.error(msg, e);
  4124. });
  4125. }
  4126. function getMenuTree(params) {
  4127. return request.post(getBaseUrl() + "@getMenuTree", {
  4128. args: [params]
  4129. }).catch(function (e) {
  4130. var _a, _b;
  4131. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4132. showErrorDialog(msg);
  4133. console.error(msg, e);
  4134. });
  4135. }
  4136. function moduleTree() {
  4137. return request.post(getBaseUrl() + "@moduleTree")
  4138. .catch(function (e) {
  4139. var _a, _b;
  4140. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4141. showErrorDialog(msg);
  4142. console.error(msg, e);
  4143. });
  4144. }
  4145. function dropTableDDL(schemaName, tableName) {
  4146. return request.post(getBaseUrl() + "@dropTableDDL", {
  4147. args: [
  4148. { schemaName: schemaName, tableName: tableName },
  4149. ]
  4150. }).catch(function (e) {
  4151. var _a, _b;
  4152. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4153. showErrorDialog(msg);
  4154. console.error(msg, e);
  4155. });
  4156. }
  4157. function renameTableDDL(schemaName, tableName, reTableName) {
  4158. return request.post(getBaseUrl() + "@renameTableDDL", {
  4159. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4160. }).catch(function (e) {
  4161. var _a, _b;
  4162. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4163. showErrorDialog(msg);
  4164. console.error(msg, e);
  4165. });
  4166. }
  4167. function executeModifyProcedureSQL(param) {
  4168. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4169. args: [
  4170. param,
  4171. ]
  4172. }).catch(function (e) {
  4173. var _a, _b;
  4174. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4175. showErrorDialog(msg);
  4176. console.error(msg, e);
  4177. });
  4178. }
  4179. function parseDynamicSqlApi(sql, dataSource) {
  4180. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4181. args: [
  4182. { sql: sql, dataSource: dataSource },
  4183. ]
  4184. }).catch(function (e) {
  4185. var _a, _b;
  4186. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4187. showErrorDialog(msg);
  4188. console.error(msg, e);
  4189. });
  4190. }
  4191. function exporerList() {
  4192. return request.post(getBaseUrl() + "@exporerList", {
  4193. args: [{}]
  4194. }).catch(function (e) {
  4195. var _a, _b;
  4196. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4197. showErrorDialog(msg);
  4198. console.error(msg, e);
  4199. });
  4200. }
  4201. function reportListApi() {
  4202. return request.post(getBaseUrl() + "@reportList", {
  4203. args: []
  4204. }).catch(function (e) {
  4205. var _a, _b;
  4206. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4207. showErrorDialog(msg);
  4208. console.error(msg, e);
  4209. });
  4210. }
  4211. function reportByIdApi(reportId) {
  4212. return request.post(getBaseUrl() + "@reportById", {
  4213. args: [
  4214. { reportId: reportId },
  4215. ]
  4216. }).catch(function (e) {
  4217. var _a, _b;
  4218. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4219. showErrorDialog(msg);
  4220. console.error(msg, e);
  4221. });
  4222. }
  4223. function createReportApi(reportName) {
  4224. return request.post(getBaseUrl() + "@createReport", {
  4225. args: [
  4226. { reportName: reportName },
  4227. ]
  4228. }).catch(function (e) {
  4229. var _a, _b;
  4230. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4231. showErrorDialog(msg);
  4232. console.error(msg, e);
  4233. });
  4234. }
  4235. function saveReportApi(param) {
  4236. return request.post(getBaseUrl() + "@saveReport", {
  4237. args: [
  4238. param,
  4239. ]
  4240. }).catch(function (e) {
  4241. var _a, _b;
  4242. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  4243. showErrorDialog(msg);
  4244. console.error(msg, e);
  4245. });
  4246. }
  4247. function delReportApi(report_id) {
  4248. return request.post(getBaseUrl() + "@delReport", {
  4249. args: [{ report_id: report_id },]
  4250. }).catch(function (e) {
  4251. var _a, _b;
  4252. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4253. showErrorDialog(msg);
  4254. console.error(msg, e);
  4255. });
  4256. }
  4257. function getDict(param) {
  4258. if (typeof param === 'undefined') {
  4259. param = { datasource: 'master' };
  4260. }
  4261. else if (typeof param.datasource === 'undefined') {
  4262. param.datasource = 'master';
  4263. }
  4264. return request.post(getBaseUrl() + "@getDict", {
  4265. args: [
  4266. param
  4267. ]
  4268. });
  4269. }
  4270. function saveDictApi(param) {
  4271. if (typeof param === 'undefined') {
  4272. param = { datasource: 'master' };
  4273. }
  4274. else if (typeof param.datasource === 'undefined') {
  4275. param.datasource = 'master';
  4276. }
  4277. return request.post(getBaseUrl() + "@saveDict", {
  4278. args: [
  4279. param
  4280. ]
  4281. }).catch(function (e) {
  4282. var _a, _b;
  4283. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4284. showErrorDialog(msg);
  4285. console.error(msg, e);
  4286. });
  4287. }
  4288. function saveDictItemsApi(param) {
  4289. if (typeof param === 'undefined') {
  4290. param = { datasource: 'master' };
  4291. }
  4292. else if (typeof param.datasource === 'undefined') {
  4293. param.datasource = 'master';
  4294. }
  4295. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4296. args: [
  4297. param
  4298. ]
  4299. }).catch(function (e) {
  4300. var _a, _b;
  4301. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4302. showErrorDialog(msg);
  4303. console.error(msg, e);
  4304. });
  4305. }
  4306. function createDictEnum(param) {
  4307. return request.post(getBaseUrl() + "@createDictEnum", {
  4308. args: [
  4309. param
  4310. ]
  4311. }).catch(function (e) {
  4312. var _a, _b;
  4313. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4314. showErrorDialog(msg);
  4315. console.error(msg, e);
  4316. });
  4317. }
  4318. function loadSqlContentApi(url) {
  4319. return request.post(getBaseUrl() + "@loadSqlContent", {
  4320. args: [
  4321. {
  4322. url: GLOBAL_NAMESPACE_PREFIX + url,
  4323. }
  4324. ]
  4325. }).catch(function (e) {
  4326. var _a, _b;
  4327. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  4328. showErrorDialog(msg);
  4329. console.error(msg, e);
  4330. });
  4331. }
  4332. function saveSqlContentApi(url, content) {
  4333. return request.post(getBaseUrl() + "@saveSqlContent", {
  4334. args: [
  4335. {
  4336. url: GLOBAL_NAMESPACE_PREFIX + url,
  4337. content: content,
  4338. }
  4339. ]
  4340. }).catch(function (e) {
  4341. var _a, _b;
  4342. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4343. showErrorDialog(msg);
  4344. console.error(msg, e);
  4345. });
  4346. }
  4347. function readBpmn(param) {
  4348. return request.post(getBaseUrl() + "@readBpmn", {
  4349. args: [param]
  4350. }).catch(function (e) {
  4351. var _a, _b;
  4352. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4353. showErrorDialog(msg);
  4354. console.error(msg, e);
  4355. });
  4356. }
  4357. function createBpmn(path, filename) {
  4358. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4359. var _a, _b;
  4360. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4361. showErrorDialog(msg);
  4362. console.error(msg, e);
  4363. });
  4364. }
  4365. function saveBpmn(fileFullPath, fileContent) {
  4366. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4367. // @ts-ignore
  4368. system.msg("保存成功");
  4369. return res;
  4370. });
  4371. }
  4372. function deleteBpmn(path, filename) {
  4373. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4374. var _a, _b;
  4375. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4376. showErrorDialog(msg);
  4377. console.error(msg, e);
  4378. });
  4379. }
  4380. function createDevForm(param) {
  4381. return request.post(getBaseUrl() + "@createDevForm", {
  4382. args: [param]
  4383. }).catch(function (e) {
  4384. var _a, _b;
  4385. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4386. showErrorDialog(msg);
  4387. console.error(msg, e);
  4388. });
  4389. }
  4390. function readDevForm(param) {
  4391. return request.post(getBaseUrl() + "@readDevForm", {
  4392. args: [param]
  4393. }).catch(function (e) {
  4394. var _a, _b;
  4395. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4396. showErrorDialog(msg);
  4397. console.error(msg, e);
  4398. });
  4399. }
  4400. function calcColumnForm(param) {
  4401. return request.post(getBaseUrl() + "@calcColumnForm", {
  4402. args: [param]
  4403. }).catch(function (e) {
  4404. var _a, _b;
  4405. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4406. showErrorDialog(msg);
  4407. console.error(msg, e);
  4408. });
  4409. }
  4410. function widgetListApi(param) {
  4411. return request.post(getBaseUrl() + "@widgetListApi", {
  4412. args: [param]
  4413. }).catch(function (e) {
  4414. var _a, _b;
  4415. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4416. showErrorDialog(msg);
  4417. console.error(msg, e);
  4418. });
  4419. }
  4420. function readWidget(param) {
  4421. return request.post(getBaseUrl() + "@readWidget", {
  4422. args: [param]
  4423. }).catch(function (e) {
  4424. var _a, _b;
  4425. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4426. showErrorDialog(msg);
  4427. console.error(msg, e);
  4428. });
  4429. }
  4430. function saveWidget(param) {
  4431. return request.post(getBaseUrl() + "@saveWidget", {
  4432. args: [param]
  4433. }).catch(function (e) {
  4434. var _a, _b;
  4435. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4436. showErrorDialog(msg);
  4437. console.error(msg, e);
  4438. });
  4439. }
  4440. function deleteWidget(param) {
  4441. return request.post(getBaseUrl() + "@deleteWidget", {
  4442. args: [param]
  4443. }).catch(function (e) {
  4444. var _a, _b;
  4445. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4446. showErrorDialog(msg);
  4447. console.error(msg, e);
  4448. });
  4449. }
  4450. function getDataBaseNameApi() {
  4451. return request.post(getBaseUrl() + "@getDataBaseName", {
  4452. args: []
  4453. }).catch(function (e) {
  4454. var _a, _b;
  4455. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4456. showErrorDialog(msg);
  4457. console.error(msg, e);
  4458. });
  4459. }
  4460. function getDiffDDLApi(param) {
  4461. return request.post(getBaseUrl() + "@getDiffDDL", {
  4462. args: [
  4463. param
  4464. ]
  4465. }).catch(function (e) {
  4466. var _a, _b;
  4467. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4468. showErrorDialog(msg);
  4469. console.error(msg, e);
  4470. });
  4471. }
  4472. function dataSyncApi(param) {
  4473. return request.post(getBaseUrl() + "@dataSync", {
  4474. args: [
  4475. param
  4476. ]
  4477. }).catch(function (e) {
  4478. var _a, _b;
  4479. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4480. showErrorDialog(msg);
  4481. console.error(msg, e);
  4482. });
  4483. }
  4484. function dataSyncInfoApi(param) {
  4485. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4486. args: [
  4487. param
  4488. ]
  4489. }).catch(function (e) {
  4490. var _a, _b;
  4491. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4492. showErrorDialog(msg);
  4493. console.error(msg, e);
  4494. });
  4495. }
  4496. function saveColumnDomain(param) {
  4497. if (typeof param === 'undefined') {
  4498. param = { datasource: 'master' };
  4499. }
  4500. else if (typeof param.datasource === 'undefined') {
  4501. param.datasource = 'master';
  4502. }
  4503. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4504. args: [
  4505. param
  4506. ]
  4507. }).catch(function (e) {
  4508. var _a, _b;
  4509. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4510. showErrorDialog('发生错误:' + msg);
  4511. console.error(msg, e);
  4512. });
  4513. }
  4514. function devOpsList() {
  4515. return request.post(getBaseUrl() + "@devOpsList", {
  4516. args: [{}]
  4517. }).catch(function (e) {
  4518. var _a, _b;
  4519. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4520. showErrorDialog('发生错误:' + msg);
  4521. console.error(msg, e);
  4522. });
  4523. }
  4524. function devOpsById(opsId) {
  4525. return request.post(getBaseUrl() + "@devOpsById", {
  4526. args: [{ opsId: opsId }]
  4527. }).catch(function (e) {
  4528. var _a, _b;
  4529. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4530. showErrorDialog('发生错误:' + msg);
  4531. console.error(msg, e);
  4532. });
  4533. }
  4534. function metricsRequestApi() {
  4535. return request.get("/api/metrics/request")
  4536. .catch(function (e) {
  4537. var _a, _b;
  4538. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4539. showErrorDialog('发生错误:' + msg);
  4540. console.error(msg, e);
  4541. });
  4542. }
  4543. function metricsJdbcApi() {
  4544. return request.get("/api/metrics/jdbc")
  4545. .catch(function (e) {
  4546. var _a, _b;
  4547. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4548. showErrorDialog('发生错误:' + msg);
  4549. console.error(msg, e);
  4550. });
  4551. }
  4552. function executeDDL(param) {
  4553. return request.post(getBaseUrl() + "@executeDDL", {
  4554. args: [
  4555. param,
  4556. ]
  4557. }).catch(function (e) {
  4558. var _a, _b;
  4559. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4560. showErrorDialog('发生错误:' + msg);
  4561. console.error(msg, e);
  4562. });
  4563. }
  4564. function getModifyIdxDDL(param) {
  4565. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4566. args: [
  4567. param,
  4568. ]
  4569. }).catch(function (e) {
  4570. var _a, _b;
  4571. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4572. showErrorDialog('发生错误:' + msg);
  4573. console.error(msg, e);
  4574. });
  4575. }
  4576. function getModifyProcedureSQL(param) {
  4577. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4578. args: [
  4579. param,
  4580. ]
  4581. }).catch(function (e) {
  4582. var _a, _b;
  4583. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4584. showErrorDialog('发生错误:' + msg);
  4585. console.error(msg, e);
  4586. });
  4587. }
  4588. function saveWhLayout(param) {
  4589. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4590. args: [
  4591. param,
  4592. ]
  4593. }).catch(function (e) {
  4594. var _a, _b;
  4595. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4596. showErrorDialog('发生错误:' + msg);
  4597. console.error(msg, e);
  4598. });
  4599. }
  4600. function deleteWhLayout(param) {
  4601. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4602. args: [
  4603. param,
  4604. ]
  4605. }).catch(function (e) {
  4606. var _a, _b;
  4607. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  4608. showErrorDialog('发生错误:' + msg);
  4609. console.error(msg, e);
  4610. });
  4611. }
  4612. function loadWhLayoutAll() {
  4613. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  4614. args: []
  4615. }).catch(function (e) {
  4616. var _a, _b;
  4617. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  4618. showErrorDialog('发生错误:' + msg);
  4619. console.error(msg, e);
  4620. });
  4621. }
  4622. function loadWhLayout(param) {
  4623. return request.post(getLayoutUrl() + "@loadWhLayout", {
  4624. args: [
  4625. param,
  4626. ]
  4627. }).catch(function (e) {
  4628. var _a, _b;
  4629. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  4630. showErrorDialog('发生错误:' + msg);
  4631. console.error(msg, e);
  4632. });
  4633. }
  4634. var baseUrl = "/api/com/yvan/studio/FileManager";
  4635. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  4636. function getBaseUrl() {
  4637. // return getCurrentProject().url + baseUrl
  4638. return baseUrl;
  4639. }
  4640. function getLayoutUrl() {
  4641. // return getCurrentProject().url + baseUrl
  4642. return layoutUrl;
  4643. }
  4644. var Request = /** @class */ (function () {
  4645. function Request(axiosInstance) {
  4646. this.axiosInstance = axiosInstance;
  4647. }
  4648. // 全局响应数据转换处理
  4649. Request.transformResponse = function (response) {
  4650. var _a;
  4651. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  4652. };
  4653. Request.prototype.get = function (url, config) {
  4654. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  4655. };
  4656. Request.prototype.delete = function (url, config) {
  4657. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  4658. };
  4659. Request.prototype.head = function (url, config) {
  4660. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  4661. };
  4662. Request.prototype.options = function (url, config) {
  4663. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  4664. };
  4665. Request.prototype.post = function (url, data, config) {
  4666. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  4667. };
  4668. Request.prototype.put = function (url, data, config) {
  4669. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  4670. };
  4671. Request.prototype.patch = function (url, data, config) {
  4672. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  4673. };
  4674. Request.prototype.request = function (config) {
  4675. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  4676. };
  4677. return Request;
  4678. }());
  4679. /** 创建一个axios实例对象 */
  4680. function axiosCreate(config) {
  4681. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  4682. }
  4683. var axiosInstance;
  4684. function init() {
  4685. axiosInstance = axiosCreate({
  4686. validateStatus: function (status) { return (status >= 200 && status < 400); },
  4687. });
  4688. request = new Request(axiosInstance);
  4689. }
  4690. var request;
  4691. //# sourceMappingURL=Api.js.map
  4692. /**
  4693. * 对比两个列 是否存在不一致
  4694. */
  4695. function compareColumn(t1, c1, t2, c2) {
  4696. if (typeof c2 === 'undefined') {
  4697. return 'column_name';
  4698. }
  4699. if (c1.column_name !== c2.column_name) {
  4700. return 'column_name';
  4701. }
  4702. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  4703. return 'default_value';
  4704. }
  4705. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  4706. return 'column_comment';
  4707. }
  4708. if (c1.is_primary_key !== c2.is_primary_key) {
  4709. return 'is_primary_key';
  4710. }
  4711. if (c1.not_null !== c2.not_null) {
  4712. return 'not_null';
  4713. }
  4714. var symbol1 = getDataTypeSymbol(t1, c1);
  4715. var symbol2 = getDataTypeSymbol(t2, c2);
  4716. if (symbol1 !== symbol2) {
  4717. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  4718. return 'data_type';
  4719. }
  4720. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  4721. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  4722. // 只关注长度
  4723. if (c1.column_size != c2.column_size) {
  4724. return 'column_size';
  4725. }
  4726. }
  4727. else {
  4728. // 其他情况,长度和精度都要关注
  4729. if (c1.column_size != c2.column_size) {
  4730. return 'column_size';
  4731. }
  4732. if (c1.decimal_digits !== c2.decimal_digits) {
  4733. return 'decimal_digits';
  4734. }
  4735. }
  4736. }
  4737. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  4738. var symbol1 = getDataTypeSymbol(tableInfo, column);
  4739. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  4740. if (symbol1 !== symbol2) {
  4741. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  4742. return 'data_type';
  4743. }
  4744. if (is_fix_size) {
  4745. // 字段域吧大小限制住了
  4746. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  4747. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  4748. // 只关注长度
  4749. if (column.column_size != domain.column_size) {
  4750. return 'column_size';
  4751. }
  4752. }
  4753. else {
  4754. // 其他情况,长度和精度都要关注
  4755. if (column.column_size != domain.column_size) {
  4756. return 'column_size';
  4757. }
  4758. if (column.decimal_digits !== domain.decimal_digits) {
  4759. return 'decimal_digits';
  4760. }
  4761. }
  4762. }
  4763. }
  4764. function checkColumn(table, col) {
  4765. if (isEmpty(col.column_name)) {
  4766. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  4767. }
  4768. if (isKeyword(col.column_name)) {
  4769. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  4770. }
  4771. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  4772. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  4773. }
  4774. return undefined;
  4775. }
  4776. function applyDomain(dbType, domain) {
  4777. var editRow = {
  4778. data_type: domain[dbType + '_datatype'],
  4779. };
  4780. domain = _$2.cloneDeep(domain);
  4781. if (!editRow.data_type) {
  4782. throw Error('字段域没有定义数据类型!');
  4783. }
  4784. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  4785. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  4786. if (match) {
  4787. // 类型里面包含括号
  4788. var sz = parseInt(match[2]);
  4789. if (isNaN(sz)) {
  4790. throw Error('字段域的定义错误:' + editRow.data_type);
  4791. }
  4792. domain.is_fix_size = true;
  4793. editRow.data_type = match[1];
  4794. domain.column_size = sz;
  4795. domain.decimal_digits = 0;
  4796. }
  4797. else {
  4798. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  4799. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  4800. if (match2) {
  4801. // 类型里面包含括号
  4802. var sz = parseInt(match2[2]);
  4803. if (isNaN(sz)) {
  4804. throw Error('字段域的定义错误:' + editRow.data_type);
  4805. }
  4806. var dg = parseInt(match2[3]);
  4807. if (isNaN(dg)) {
  4808. throw Error('字段域的定义错误:' + editRow.data_type);
  4809. }
  4810. domain.is_fix_size = true;
  4811. editRow.data_type = match[1];
  4812. domain.column_size = sz;
  4813. domain.decimal_digits = dg;
  4814. }
  4815. }
  4816. if (domain.domain_column_ui) {
  4817. _$2.extend(editRow, {
  4818. column_ui: domain.domain_column_ui,
  4819. });
  4820. }
  4821. if (domain.domain_column_dict) {
  4822. _$2.extend(editRow, {
  4823. column_dict: domain.domain_column_dict,
  4824. });
  4825. }
  4826. if (domain.is_fix_size) {
  4827. _$2.extend(editRow, {
  4828. column_size: domain.column_size,
  4829. decimal_digits: domain.decimal_digits
  4830. });
  4831. }
  4832. if (domain.is_fix_default_value) {
  4833. _$2.extend(editRow, {
  4834. default_value: domain.default_value,
  4835. });
  4836. }
  4837. return editRow;
  4838. }
  4839. /**
  4840. * 获取字段类型代号(用于做跨数据库数据类型对比)
  4841. */
  4842. function getDataTypeSymbol(table, col) {
  4843. if (table.db_type === 'oracle') {
  4844. switch (col.data_type) {
  4845. case 'number':
  4846. if (col.column_size <= 10 && !col.decimal_digits) {
  4847. return 'integer';
  4848. }
  4849. else if (col.column_size <= 19 && !col.decimal_digits) {
  4850. return 'long';
  4851. }
  4852. return 'bigdecimal';
  4853. case 'char':
  4854. if (col.column_size > 3000) {
  4855. return 'clob';
  4856. }
  4857. return 'char';
  4858. case 'integer':
  4859. return 'integer';
  4860. case 'varchar':
  4861. case 'varchar2':
  4862. if (col.column_size > 3000) {
  4863. return 'clob';
  4864. }
  4865. return 'varchar';
  4866. case 'clob':
  4867. return 'clob';
  4868. case 'blob':
  4869. return 'blob';
  4870. case 'date':
  4871. case 'timestamp':
  4872. case 'timestamp(6)':
  4873. case 'timestamp with local time zone':
  4874. case 'timestamp(6) with local time zone':
  4875. case 'timestamp(6) with time zone':
  4876. return 'timestamp';
  4877. }
  4878. return "undefined";
  4879. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  4880. }
  4881. if (table.db_type === 'pgsql') {
  4882. switch (col.data_type) {
  4883. case 'int4':
  4884. return 'integer';
  4885. case 'int8':
  4886. return 'long';
  4887. case 'char':
  4888. return 'char';
  4889. case 'varchar':
  4890. case 'varchar2':
  4891. if (col.column_size > 3000) {
  4892. return 'clob';
  4893. }
  4894. return 'varchar';
  4895. case 'numeric':
  4896. if (col.column_size <= 10 && !col.decimal_digits) {
  4897. return 'integer';
  4898. }
  4899. else if (col.column_size <= 19 && !col.decimal_digits) {
  4900. return 'long';
  4901. }
  4902. return 'bigdecimal';
  4903. case 'timestamp':
  4904. case 'timestamptz':
  4905. return 'timestamp';
  4906. case 'bytea':
  4907. return 'blob';
  4908. }
  4909. return "undefined";
  4910. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  4911. }
  4912. throw Error('未知数据库类型:' + table.db_type);
  4913. }
  4914. /**
  4915. * 判断对象名称是不是数据库关键字(保留字)
  4916. */
  4917. function isKeyword(word) {
  4918. if (!word || typeof word !== 'string') {
  4919. return false;
  4920. }
  4921. var kk = ['access',
  4922. 'add',
  4923. 'all',
  4924. 'alter',
  4925. 'and',
  4926. 'any',
  4927. 'as',
  4928. 'asc',
  4929. 'audit',
  4930. 'between',
  4931. 'by',
  4932. 'char',
  4933. 'check',
  4934. 'cluster',
  4935. 'column',
  4936. 'comment',
  4937. 'compress',
  4938. 'connect',
  4939. 'create',
  4940. 'current',
  4941. 'date',
  4942. 'decimal',
  4943. 'default',
  4944. 'delete',
  4945. 'desc',
  4946. 'distinct',
  4947. 'drop',
  4948. 'else',
  4949. 'exclusive',
  4950. 'exists',
  4951. 'file',
  4952. 'float',
  4953. 'for',
  4954. 'from',
  4955. 'grant',
  4956. 'group',
  4957. 'having',
  4958. 'identified',
  4959. 'immediate',
  4960. 'in',
  4961. 'increment',
  4962. 'index',
  4963. 'initial',
  4964. 'insert',
  4965. 'integer',
  4966. 'intersect',
  4967. 'into',
  4968. 'is',
  4969. 'level',
  4970. 'like',
  4971. 'lock',
  4972. 'long',
  4973. 'maxextents',
  4974. 'minus',
  4975. 'mlslabel',
  4976. 'mode',
  4977. 'modify',
  4978. 'noaudit',
  4979. 'nocompress',
  4980. 'not',
  4981. 'nowait',
  4982. 'null',
  4983. 'number',
  4984. 'of',
  4985. 'offline',
  4986. 'on',
  4987. 'online',
  4988. 'option',
  4989. 'or',
  4990. 'order',
  4991. 'p',
  4992. 'ctfree',
  4993. 'prior',
  4994. 'privileges',
  4995. 'public',
  4996. 'raw',
  4997. 'rename',
  4998. 'resource',
  4999. 'revoke',
  5000. 'row',
  5001. 'rowid',
  5002. 'rownum',
  5003. 'rows',
  5004. 'select',
  5005. 'session',
  5006. 'set',
  5007. 'share',
  5008. 'size',
  5009. 'smallint',
  5010. 'start',
  5011. 'successful',
  5012. 'synonym',
  5013. 'sysdate',
  5014. 'table',
  5015. 'then',
  5016. 'to',
  5017. 'trigger',
  5018. 'uid',
  5019. 'union',
  5020. 'unique',
  5021. 'update',
  5022. 'user',
  5023. 'validate',
  5024. 'values',
  5025. 'varchar',
  5026. 'varchar2',
  5027. 'view',
  5028. 'whenever',
  5029. 'where',
  5030. 'with'];
  5031. return _$2.includes(kk, word.toLowerCase());
  5032. }
  5033. //# sourceMappingURL=DbUtils.js.map
  5034. var DbSync = /** @class */ (function (_super) {
  5035. __extends(DbSync, _super);
  5036. function DbSync() {
  5037. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5038. }
  5039. DbSync.prototype.onLoad = function () {
  5040. };
  5041. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5042. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5043. getDataBaseNameApi().then(function (res) {
  5044. successCallback(res.data.map(function (name) {
  5045. return {
  5046. id: name, text: name
  5047. };
  5048. }));
  5049. });
  5050. };
  5051. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5052. showInfoDialog(record.get('remark'));
  5053. };
  5054. DbSync.prototype.diff = function () {
  5055. var _this = this;
  5056. var promise1 = getMateData({
  5057. datasource: this.viewModel.get('dataSource1')
  5058. });
  5059. var promise2 = getMateData({
  5060. datasource: this.viewModel.get('dataSource2')
  5061. });
  5062. this.viewModel.set('schema1', '');
  5063. this.viewModel.set('schema2', '');
  5064. this.refs.grid1.setLoading(true);
  5065. Promise.all([promise1, promise2]).then(function (_a) {
  5066. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5067. var rows = [];
  5068. if (_$2.size(res1) > 0) {
  5069. // res1 起码有一个 schema
  5070. _this.viewModel.set('schema1', res1[0].schema_name);
  5071. _this.viewModel.set('schema2', res2[0].schema_name);
  5072. if (!_this.viewModel.get('schema1')) {
  5073. msg$1('datasource1 最起码需要一张表');
  5074. return;
  5075. }
  5076. if (!_this.viewModel.get('schema2')) {
  5077. msg$1('datasource2 最起码需要一张表');
  5078. return;
  5079. }
  5080. _$2.forEach(res1[0].table_list, function (table1) {
  5081. var _a;
  5082. 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; });
  5083. if (table1.schema_name) {
  5084. _this.viewModel.set('schema1', table1.schema_name);
  5085. }
  5086. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5087. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5088. }
  5089. var row = {
  5090. table_name1: table1.table_name,
  5091. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5092. table_info: table1
  5093. };
  5094. if (!table2) {
  5095. row.diff = '不一致';
  5096. row.remark = '目标表缺失';
  5097. }
  5098. else if (table1.column_list.length !== table2.column_list.length) {
  5099. row.diff = '不一致';
  5100. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5101. }
  5102. else {
  5103. row.diff = '一致';
  5104. var remark_1 = [];
  5105. _$2.forEach(table1.column_list, function (col1) {
  5106. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5107. if (!col2) {
  5108. row.diff = '不一致';
  5109. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5110. }
  5111. else {
  5112. var colDiff = compareColumn(table1, col1, table2, col2);
  5113. if (colDiff) {
  5114. row.diff = '不一致';
  5115. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5116. }
  5117. }
  5118. });
  5119. row.remark = remark_1.join('\n');
  5120. }
  5121. rows.push(row);
  5122. });
  5123. }
  5124. _this.refs.grid1.setData(rows);
  5125. _this.viewModel.set('hasDiff', true);
  5126. }).finally(function () {
  5127. _this.refs.grid1.setLoading(false);
  5128. });
  5129. };
  5130. DbSync.prototype.structCopyTo = function () {
  5131. var _this = this;
  5132. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5133. msg$1('选择数据源!');
  5134. return;
  5135. }
  5136. var recordList = this.refs.grid1.getSelection();
  5137. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5138. if (_$2.size(tableNameList) <= 0) {
  5139. msg$1('请选择要同步的表');
  5140. return;
  5141. }
  5142. var error = undefined;
  5143. _$2.forEach(tableNameList, function (tableInfo) {
  5144. _$2.forEach(tableInfo.column_list, function (col) {
  5145. error = checkColumn(tableInfo, col);
  5146. return false;
  5147. });
  5148. if (error) {
  5149. return false;
  5150. }
  5151. });
  5152. if (error) {
  5153. msg$1(error);
  5154. return;
  5155. }
  5156. var schema1 = this.viewModel.get('schema1');
  5157. var schema2 = this.viewModel.get('schema2');
  5158. if (!schema1 || !schema2) {
  5159. msg$1('无法识别 schema 名称');
  5160. return;
  5161. }
  5162. this.refs.grid1.setLoading(true);
  5163. getDiffDDLApi({
  5164. datasource1: this.viewModel.get('dataSource1'),
  5165. datasource2: this.viewModel.get('dataSource2'),
  5166. schema1: this.viewModel.get('schema1'),
  5167. schema2: this.viewModel.get('schema2'),
  5168. tables: tableNameList,
  5169. }).then(function (res) {
  5170. if (res.success) {
  5171. _this.refs.ddleditor.setCode(res.data);
  5172. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5173. }
  5174. }).finally(function () {
  5175. _this.refs.grid1.setLoading(false);
  5176. });
  5177. };
  5178. DbSync.prototype.indexCopyTo = function () {
  5179. var _this = this;
  5180. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5181. msg$1('选择数据源!');
  5182. return;
  5183. }
  5184. var recordList = this.refs.grid1.getSelection();
  5185. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5186. if (_$2.size(tableNameList) <= 0) {
  5187. msg$1('请选择要同步的表');
  5188. return;
  5189. }
  5190. var schema1 = this.viewModel.get('schema1');
  5191. var schema2 = this.viewModel.get('schema2');
  5192. if (!schema1 || !schema2) {
  5193. msg$1('无法识别 schema 名称');
  5194. return;
  5195. }
  5196. this.refs.grid1.setLoading(true);
  5197. getModifyIdxDDL({
  5198. datasource1: this.viewModel.get('dataSource1'),
  5199. datasource2: this.viewModel.get('dataSource2'),
  5200. schema1: this.viewModel.get('schema1'),
  5201. schema2: this.viewModel.get('schema2'),
  5202. tables: tableNameList,
  5203. }).then(function (res) {
  5204. if (res.success) {
  5205. _this.refs.ddleditor_idx.setCode(res.data);
  5206. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5207. }
  5208. }).finally(function () {
  5209. _this.refs.grid1.setLoading(false);
  5210. });
  5211. };
  5212. DbSync.prototype.procedureCopyTo = function () {
  5213. var _this = this;
  5214. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5215. msg$1('选择数据源!');
  5216. return;
  5217. }
  5218. var schema1 = this.viewModel.get('schema1');
  5219. var schema2 = this.viewModel.get('schema2');
  5220. if (!schema1 || !schema2) {
  5221. msg$1('无法识别 schema 名称');
  5222. return;
  5223. }
  5224. this.refs.grid1.setLoading(true);
  5225. getModifyProcedureSQL({
  5226. datasource1: this.viewModel.get('dataSource1'),
  5227. datasource2: this.viewModel.get('dataSource2'),
  5228. schema1: this.viewModel.get('schema1'),
  5229. schema2: this.viewModel.get('schema2'),
  5230. }).then(function (res) {
  5231. if (res.success) {
  5232. _this.refs.ddleditor_procedure.setCode(res.data);
  5233. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5234. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5235. }
  5236. }).finally(function () {
  5237. _this.refs.grid1.setLoading(false);
  5238. });
  5239. };
  5240. DbSync.prototype.dataSync_start = function () {
  5241. var _this = this;
  5242. this.viewModel.set('dataSync_isStart', true);
  5243. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5244. this.refs.datacopy.setLoading(true);
  5245. dataSyncApi(dataSync)
  5246. .then(function (res) {
  5247. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5248. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5249. })
  5250. .finally(function () {
  5251. _this.refs.datacopy.setLoading(false);
  5252. });
  5253. };
  5254. DbSync.prototype.dataSync_process = function () {
  5255. var _this = this;
  5256. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5257. dataSyncInfoApi({ jobId: jobId })
  5258. .then(function (res) {
  5259. if (_$2.isArray(res.tableSyncInfos)) {
  5260. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5261. _this.refs.datacopy.setData(res.tableSyncInfos);
  5262. try {
  5263. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5264. }
  5265. catch (e) {
  5266. }
  5267. }
  5268. if (res.endTime) {
  5269. // 已经结束
  5270. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5271. if (res.success) {
  5272. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5273. }
  5274. else {
  5275. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5276. }
  5277. _this.dataSync_stop();
  5278. }
  5279. })
  5280. .catch(function (e) {
  5281. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5282. console.error(e);
  5283. // this.dataSync_stop()
  5284. })
  5285. .finally(function () {
  5286. _this.refs.datacopy.setLoading(false);
  5287. });
  5288. };
  5289. DbSync.prototype.dataSync_stop = function () {
  5290. this.viewModel.set('dataSync_isStart', false);
  5291. clearInterval(this.dataSyncInterval);
  5292. delete this.dataSyncInterval;
  5293. };
  5294. DbSync.prototype.dataCopyTo = function () {
  5295. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5296. msg$1('选择数据源!');
  5297. return;
  5298. }
  5299. var recordList = this.refs.grid1.getSelection();
  5300. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5301. if (_$2.size(tableNameList) <= 0) {
  5302. msg$1('请选择要同步的表');
  5303. return;
  5304. }
  5305. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5306. this.viewModel.set('dataSync.tables', tableNameList);
  5307. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5308. };
  5309. DbSync.prototype.next = function () {
  5310. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5311. };
  5312. DbSync.prototype.back = function () {
  5313. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5314. };
  5315. DbSync.prototype.dbToMeta = function () {
  5316. var _this = this;
  5317. var dataSource1 = this.viewModel.get('dataSource1');
  5318. var dataSource2 = this.viewModel.get('dataSource2');
  5319. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5320. var promise1 = dbToMeta({ datasource: dataSource1 });
  5321. var promise2 = dbToMeta({ datasource: dataSource2 });
  5322. _this.refs.grid1.setLoading(true);
  5323. Promise.all([promise1, promise2]).then(function (_a) {
  5324. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5325. _this.diff();
  5326. }).catch(function (res) {
  5327. _this.refs.grid1.setLoading(false);
  5328. showErrorDialog$1(res);
  5329. });
  5330. });
  5331. };
  5332. DbSync.prototype.executeDDL = function () {
  5333. var _this = this;
  5334. var code = this.refs.ddleditor.getValue();
  5335. var dataSource2 = this.viewModel.get('dataSource2');
  5336. var target_schema_name = this.viewModel.get('schema2');
  5337. var recordList = this.refs.grid1.getSelection();
  5338. var table_infos = _$2.map(recordList, function (r) {
  5339. return r.get('table_info');
  5340. });
  5341. this.setLoading(true);
  5342. pushToDbCommitApi({
  5343. datasource: dataSource2,
  5344. ddl: code,
  5345. table_infos: table_infos,
  5346. target_schema_name: target_schema_name,
  5347. }).then(function (res) {
  5348. if (res === null || res === void 0 ? void 0 : res.success) {
  5349. msg$1('执行成功');
  5350. _this.back();
  5351. _this.diff();
  5352. return;
  5353. }
  5354. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5355. }).finally(function () {
  5356. _this.setLoading(false);
  5357. });
  5358. };
  5359. DbSync.prototype.executeDDLIdx = function () {
  5360. var _this = this;
  5361. var code = this.refs.ddleditor_idx.getValue();
  5362. var dataSource2 = this.viewModel.get('dataSource2');
  5363. this.setLoading(true);
  5364. executeDDL({
  5365. datasource: dataSource2,
  5366. ddl: code,
  5367. }).then(function (res) {
  5368. if (res === null || res === void 0 ? void 0 : res.success) {
  5369. msg$1('执行成功');
  5370. _this.back();
  5371. return;
  5372. }
  5373. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5374. }).finally(function () {
  5375. _this.setLoading(false);
  5376. });
  5377. };
  5378. DbSync.prototype.executeProcedureSQL = function () {
  5379. var _this = this;
  5380. this.setLoading(true);
  5381. executeModifyProcedureSQL({
  5382. datasource1: this.viewModel.get('dataSource1'),
  5383. datasource2: this.viewModel.get('dataSource2'),
  5384. schema1: this.viewModel.get('schema1'),
  5385. schema2: this.viewModel.get('schema2'),
  5386. }).then(function (res) {
  5387. if (res === null || res === void 0 ? void 0 : res.success) {
  5388. msg$1('执行成功');
  5389. _this.back();
  5390. return;
  5391. }
  5392. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5393. }).finally(function () {
  5394. _this.setLoading(false);
  5395. });
  5396. };
  5397. return DbSync;
  5398. }(Scope));
  5399. //# sourceMappingURL=DbSync.js.map
  5400. var model$2 = {
  5401. data: {}
  5402. };
  5403. //# sourceMappingURL=DbCodeTemplate.model.js.map
  5404. var vjson$2 = {
  5405. title: '示例代码',
  5406. layout: 'fit',
  5407. items: [
  5408. {
  5409. layout: 'border',
  5410. items: [
  5411. {
  5412. region: 'north',
  5413. split: true,
  5414. height: 200,
  5415. title: '表格数据',
  5416. reference: 'dataeditor',
  5417. xtype: 'jsoneditor',
  5418. listeners: {
  5419. change: 'scope.dataChanged'
  5420. },
  5421. },
  5422. {
  5423. region: 'west',
  5424. split: true,
  5425. width: 230,
  5426. title: '模板',
  5427. reference: 'tree1',
  5428. xtype: 'treepanel',
  5429. rootVisible: false,
  5430. useArrows: true,
  5431. colspan: 2,
  5432. lines: true,
  5433. multiSelect: false,
  5434. listeners: {
  5435. itemclick: 'scope.templateChange',
  5436. },
  5437. },
  5438. {
  5439. region: 'center',
  5440. title: '参考代码',
  5441. reference: 'preview',
  5442. xtype: 'jsoneditor',
  5443. },
  5444. ]
  5445. }
  5446. ]
  5447. };
  5448. //# sourceMappingURL=DbCodeTemplate.view.js.map
  5449. var rootNode = {
  5450. id: 'ROOT',
  5451. type: "ROOT",
  5452. path: "",
  5453. expanded: true,
  5454. leaf: false,
  5455. children: [
  5456. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5457. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5458. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5459. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5460. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5461. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5462. ],
  5463. };
  5464. var TemplateDev = /** @class */ (function (_super) {
  5465. __extends(TemplateDev, _super);
  5466. function TemplateDev() {
  5467. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5468. _this.dataChanged = _$2.debounce(function () {
  5469. var me = _this;
  5470. if (me.refs.tree1.selection) {
  5471. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5472. }
  5473. }, 50);
  5474. return _this;
  5475. }
  5476. TemplateDev.prototype.onDestroy = function () {
  5477. setDbCode(undefined);
  5478. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5479. };
  5480. TemplateDev.prototype.onLoad = function () {
  5481. setDbCode(this);
  5482. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5483. this.refs.tree1.setRootNode(rootNode);
  5484. getColumnDomainApi({}).then(function (_a) {
  5485. var data = _a.data;
  5486. return window['dev_column_domain'] = data;
  5487. });
  5488. };
  5489. TemplateDev.prototype.dbTreeNodeChange = function () {
  5490. var me = handles$1.dbcode;
  5491. var tables = [];
  5492. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5493. var raw = _$2.cloneDeep(r.get('raw'));
  5494. raw.id = r.get('id');
  5495. if (r.get('type') === 'table') {
  5496. tables.push(raw);
  5497. return;
  5498. }
  5499. if (r.get('type') === 'column') {
  5500. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5501. if (!tableInfo) {
  5502. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5503. tables.push(tableInfo);
  5504. }
  5505. if (!tableInfo.column_list) {
  5506. tableInfo.column_list = [raw];
  5507. }
  5508. else {
  5509. tableInfo.column_list.push(raw);
  5510. }
  5511. }
  5512. });
  5513. // 对于没有选择列的表格,默认加上所有列
  5514. _$2.forEach(tables, function (tableInfo) {
  5515. if (typeof tableInfo.column_list === 'undefined') {
  5516. tableInfo.column_list = [];
  5517. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5518. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5519. });
  5520. }
  5521. });
  5522. var code = JSON.stringify(tables, null, ' ');
  5523. me.refs.dataeditor.setCode(code);
  5524. };
  5525. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5526. var url = record.data.url;
  5527. var rd = _$2.uniqueId('db_code_request');
  5528. if (url) {
  5529. var data = void 0;
  5530. try {
  5531. data = JSON.parse(this.refs.dataeditor.getCode());
  5532. }
  5533. catch (e) {
  5534. return;
  5535. }
  5536. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5537. // if (typeof node.default === "function") {
  5538. // const v = toString(node.default(data))
  5539. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5540. // this.refs.preview.setLanguage("plaintext")
  5541. // this.refs.preview.setCode(v)
  5542. // }
  5543. // })
  5544. showErrorDialog$1('没做这里');
  5545. }
  5546. };
  5547. return TemplateDev;
  5548. }(Scope));
  5549. //# sourceMappingURL=DbCodeTemplate.js.map
  5550. var model$3 = {
  5551. data: {
  5552. hasChanged: false,
  5553. }
  5554. };
  5555. //# sourceMappingURL=DbDomain.model.js.map
  5556. var vjson$3 = {
  5557. bind: {
  5558. title: '字段域{grid1.ischanged?" *":""}',
  5559. },
  5560. layout: 'fit',
  5561. items: [
  5562. {
  5563. layout: 'border',
  5564. items: [
  5565. {
  5566. region: 'center',
  5567. xtype: 'yvgrid',
  5568. selModel: {
  5569. type: 'spreadsheet',
  5570. columnSelect: true,
  5571. pruneRemoved: false,
  5572. extensible: 'y'
  5573. },
  5574. plugins: {
  5575. clipboard: true,
  5576. selectionreplicator: true
  5577. },
  5578. reference: 'grid1',
  5579. pagination: false,
  5580. tbar: {
  5581. xtype: 'toolbar',
  5582. items: [
  5583. {
  5584. xtype: 'button',
  5585. text: '添加',
  5586. iconCls: 'x-fa fa-plus-circle',
  5587. listeners: {
  5588. click: 'scope.addField'
  5589. }
  5590. },
  5591. {
  5592. xtype: 'button',
  5593. text: '删除',
  5594. iconCls: 'x-fa fa-minus-circle',
  5595. listeners: {
  5596. click: 'scope.removeField'
  5597. }
  5598. },
  5599. {
  5600. xtype: 'button',
  5601. text: '保存',
  5602. iconCls: 'x-fa fa-save',
  5603. bind: {
  5604. disabled: '{!grid1.ischanged}'
  5605. },
  5606. listeners: {
  5607. click: 'scope.save'
  5608. }
  5609. },
  5610. ]
  5611. },
  5612. listeners: {
  5613. editfinish: 'scope.gridEditFinish',
  5614. },
  5615. columns: [
  5616. {
  5617. text: '字段域名称', dataIndex: 'domain_name',
  5618. sortable: false,
  5619. menuDisabled: true,
  5620. locked: true,
  5621. editor: {
  5622. selectOnFocus: true
  5623. }
  5624. },
  5625. {
  5626. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  5627. sortable: false, menuDisabled: true,
  5628. editor: {
  5629. selectOnFocus: true
  5630. }
  5631. },
  5632. {
  5633. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  5634. sortable: false, menuDisabled: true,
  5635. editor: {
  5636. selectOnFocus: true
  5637. }
  5638. },
  5639. {
  5640. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  5641. sortable: false, menuDisabled: true,
  5642. editor: {
  5643. selectOnFocus: true
  5644. }
  5645. },
  5646. {
  5647. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  5648. sortable: false, menuDisabled: true,
  5649. editor: {
  5650. selectOnFocus: true
  5651. }
  5652. },
  5653. {
  5654. text: 'Java类型', dataIndex: 'java_datatype',
  5655. sortable: false, menuDisabled: true,
  5656. editor: {
  5657. selectOnFocus: true
  5658. }
  5659. },
  5660. {
  5661. text: '固定长度', dataIndex: 'is_fix_size',
  5662. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5663. width: 88, resizable: false,
  5664. },
  5665. {
  5666. text: '长度', dataIndex: 'column_size',
  5667. sortable: false, menuDisabled: true, dataType: 'int',
  5668. xtype: 'numbercolumn', format: '0',
  5669. editor: { selectOnFocus: true }
  5670. },
  5671. {
  5672. text: '小数位', dataIndex: 'decimal_digits',
  5673. sortable: false, menuDisabled: true, dataType: 'int',
  5674. xtype: 'numbercolumn', format: '0',
  5675. editor: { selectOnFocus: true }
  5676. },
  5677. {
  5678. text: '字典', dataIndex: 'domain_column_dict',
  5679. sortable: false, menuDisabled: true,
  5680. // fix: ['system.getDict("DICT")'],
  5681. width: 200,
  5682. editor: {
  5683. xtype: 'combo',
  5684. listConfig: {
  5685. minWidth: 350
  5686. },
  5687. }
  5688. },
  5689. {
  5690. text: '固定默认值', dataIndex: 'is_fix_default_value',
  5691. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5692. width: 88, resizable: false,
  5693. },
  5694. {
  5695. text: '默认值', dataIndex: 'default_value',
  5696. sortable: false, menuDisabled: true,
  5697. editor: {
  5698. selectOnFocus: true
  5699. }
  5700. },
  5701. {
  5702. text: 'UI建议', dataIndex: 'domain_column_ui',
  5703. sortable: false, menuDisabled: true,
  5704. // fix: ['system.getDict("column_ui")'],
  5705. editor: {
  5706. xtype: 'combo',
  5707. allowBlank: true,
  5708. listConfig: {
  5709. minWidth: 200
  5710. },
  5711. }
  5712. },
  5713. {
  5714. text: '详细描述', dataIndex: 'domain_note',
  5715. sortable: false, menuDisabled: true,
  5716. editor: {}
  5717. },
  5718. {
  5719. text: '责任人', dataIndex: 'domain_person',
  5720. sortable: false, menuDisabled: true,
  5721. editor: {
  5722. selectOnFocus: true
  5723. }
  5724. },
  5725. {
  5726. text: '版本', dataIndex: 'domain_version',
  5727. sortable: false, menuDisabled: true,
  5728. editor: {
  5729. selectOnFocus: true
  5730. }
  5731. },
  5732. ]
  5733. }
  5734. ]
  5735. },
  5736. ]
  5737. };
  5738. //# sourceMappingURL=DbDomain.view.js.map
  5739. var CacheStore = /** @class */ (function () {
  5740. function CacheStore() {
  5741. // 订阅
  5742. this.subscribeList = [];
  5743. this.apiResponse = undefined;
  5744. }
  5745. /**
  5746. * 订阅结果集
  5747. */
  5748. CacheStore.prototype.registe = function (fn) {
  5749. this.subscribeList.push(fn);
  5750. };
  5751. /**
  5752. * 取消订阅
  5753. */
  5754. CacheStore.prototype.unregiste = function (fn) {
  5755. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  5756. };
  5757. /**
  5758. * 尝试取数据(先读缓存)
  5759. */
  5760. CacheStore.prototype.reloadIfNeed = function (param) {
  5761. var _this = this;
  5762. if (typeof this.apiResponse === 'undefined') {
  5763. // 从未有获取过值
  5764. var cacheKey = this.getCacheKey(param);
  5765. if (cacheKey) {
  5766. // 可以从缓存读
  5767. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  5768. native.loadFile(fileName, function (res) {
  5769. if (res) {
  5770. // 缓存有值
  5771. _this.apiResponse = res;
  5772. _this.notifyRefresh();
  5773. }
  5774. else {
  5775. // 缓存没值
  5776. _this.reloadForce(param).then(function (res) {
  5777. });
  5778. }
  5779. });
  5780. }
  5781. else {
  5782. // 不能从缓存读
  5783. this.reloadForce(param).then(function (res) {
  5784. });
  5785. }
  5786. return true;
  5787. }
  5788. return false;
  5789. };
  5790. /**
  5791. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  5792. */
  5793. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  5794. var _this = this;
  5795. return new Promise(function (resolve, reject) {
  5796. if (typeof _this.apiResponse === 'undefined') {
  5797. // 从未有获取过值
  5798. var cacheKey = _this.getCacheKey(param);
  5799. if (cacheKey) {
  5800. // 可以从缓存读
  5801. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  5802. native.loadFile(fileName, function (res) {
  5803. if (res) {
  5804. // 缓存有值
  5805. _this.apiResponse = res;
  5806. _this.notifyRefresh();
  5807. resolve(_this.apiResponse);
  5808. }
  5809. else {
  5810. // 缓存没值
  5811. _this.reloadForce(param).then(function (res) {
  5812. resolve(_this.apiResponse);
  5813. });
  5814. }
  5815. });
  5816. }
  5817. else {
  5818. // 不能从缓存读
  5819. _this.reloadForce(param).then(function (res) {
  5820. resolve(_this.apiResponse);
  5821. });
  5822. }
  5823. }
  5824. else {
  5825. // 有值,获取过
  5826. resolve(_this.apiResponse);
  5827. }
  5828. });
  5829. };
  5830. /**
  5831. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  5832. */
  5833. CacheStore.prototype.reloadForce = function (param) {
  5834. var _this = this;
  5835. _$2.forEach(this.subscribeList, function (fn) {
  5836. fn(true);
  5837. });
  5838. return this.invokeApi(param)
  5839. .then(function (res) {
  5840. _this.apiResponse = res;
  5841. var cacheKey = _this.getCacheKey(param);
  5842. if (cacheKey) {
  5843. // 可以保存到缓存
  5844. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  5845. native.saveFile(fileName, res);
  5846. }
  5847. // 通知订阅者刷新
  5848. _this.notifyRefresh();
  5849. })
  5850. .finally(function () {
  5851. _$2.forEach(_this.subscribeList, function (fn) {
  5852. fn(false);
  5853. });
  5854. });
  5855. };
  5856. /**
  5857. * 通知组件,isLoading状态被更改
  5858. */
  5859. CacheStore.prototype.notifyLoading = function (isLoading) {
  5860. var _this = this;
  5861. _$2.forEach(this.subscribeList, function (fn) {
  5862. fn(_this.apiResponse);
  5863. });
  5864. };
  5865. /**
  5866. * 通知数据更改,需要刷新
  5867. */
  5868. CacheStore.prototype.notifyRefresh = function () {
  5869. var _this = this;
  5870. _$2.forEach(this.subscribeList, function (fn) {
  5871. fn(_this.apiResponse);
  5872. });
  5873. };
  5874. return CacheStore;
  5875. }());
  5876. //# sourceMappingURL=CacheStore.js.map
  5877. // 字段域数据
  5878. var columnDomain = undefined;
  5879. var DomainStore = /** @class */ (function (_super) {
  5880. __extends(DomainStore, _super);
  5881. function DomainStore() {
  5882. return _super !== null && _super.apply(this, arguments) || this;
  5883. }
  5884. DomainStore.prototype.getCacheKey = function (param) {
  5885. return "domain_data.json";
  5886. };
  5887. DomainStore.prototype.invokeApi = function (param) {
  5888. return getColumnDomainApi();
  5889. };
  5890. /**
  5891. * 设置全局可访问的 字段域数据
  5892. */
  5893. DomainStore.prototype.getColumnDomainComboData = function () {
  5894. var _this = this;
  5895. return new Promise(function (resolve) {
  5896. _this.reloadIfNeedPromise(undefined).then(function (res) {
  5897. resolve(_this.apiResponse.data.map(function (v) {
  5898. return { id: v.domain_id, text: v.domain_name };
  5899. }));
  5900. });
  5901. });
  5902. };
  5903. /**
  5904. * 设置全局可访问的 字段域数据
  5905. */
  5906. DomainStore.prototype.getColumnDomainById = function (value) {
  5907. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  5908. };
  5909. DomainStore.prototype.getAllDomain = function () {
  5910. return new Promise(function (resolve, reject) {
  5911. getColumnDomainApi()
  5912. .then(function (res) {
  5913. if (res.success) {
  5914. columnDomain = res.data;
  5915. resolve(res.data);
  5916. }
  5917. else {
  5918. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  5919. console.error('getColumnDomain', res.msg);
  5920. }
  5921. })
  5922. .catch(function (e) {
  5923. window['showErrorDialog']('getColumnDomain error!');
  5924. console.error('getColumnDomain', e);
  5925. reject(e);
  5926. });
  5927. });
  5928. };
  5929. return DomainStore;
  5930. }(CacheStore));
  5931. var instance = new DomainStore();
  5932. //# sourceMappingURL=DomainStore.js.map
  5933. var DbDomain = /** @class */ (function (_super) {
  5934. __extends(DbDomain, _super);
  5935. function DbDomain() {
  5936. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  5937. }
  5938. DbDomain.prototype.onLoad = function () {
  5939. var _this = this;
  5940. instance.getAllDomain().then(function (data) {
  5941. _this.refs.grid1.setData(data);
  5942. });
  5943. };
  5944. DbDomain.prototype.gridEditFinish = function () {
  5945. this.viewModel.set('hasChanged', true);
  5946. };
  5947. DbDomain.prototype.addField = function () {
  5948. this.refs.grid1.appendEditRow({
  5949. domainName: '',
  5950. pgSqlDataType: '',
  5951. mysqlDataType: '',
  5952. oracleDataType: '',
  5953. sqlserverDataType: '',
  5954. javaDataType: '',
  5955. isFixSize: true,
  5956. size: '',
  5957. decimalDigits: '',
  5958. isFixDefaultValue: false,
  5959. defaultValue: null,
  5960. domainColumnDict: '',
  5961. domainColumnUI: '',
  5962. note: '',
  5963. domainPerson: '',
  5964. domainVersion: '',
  5965. }, 0);
  5966. };
  5967. DbDomain.prototype.removeField = function () {
  5968. var _this = this;
  5969. var rows = [];
  5970. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  5971. rows.push(r);
  5972. });
  5973. _.forEach(rows, function (r) {
  5974. _this.refs.grid1.getStore().remove(r);
  5975. });
  5976. };
  5977. DbDomain.prototype.save = function () {
  5978. var _this = this;
  5979. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  5980. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  5981. if (err) {
  5982. // 如果有异常就不保存
  5983. return;
  5984. }
  5985. // 进行业务上的逻辑校验,比如说必填校验等等
  5986. var hasError = false;
  5987. _.forEach(rows, function (row, i) {
  5988. if (isEmpty(row.domain_name)) {
  5989. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  5990. hasError = true;
  5991. return false;
  5992. }
  5993. if (isEmpty(row.pgsql_datatype) ||
  5994. isEmpty(row.mysql_datatype) ||
  5995. isEmpty(row.oracle_datatype) ||
  5996. isEmpty(row.sqlserver_datatype)) {
  5997. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  5998. hasError = true;
  5999. return false;
  6000. }
  6001. });
  6002. if (hasError) {
  6003. return;
  6004. }
  6005. // 设置当前界面为 "保存中..." 状态
  6006. this.setLoading(true);
  6007. saveColumnDomain({
  6008. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6009. newRows: newRows,
  6010. modifyRows: modifyRows,
  6011. removeRecords: removeRecords,
  6012. }).then(function (res) {
  6013. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6014. system.msg(res.msg);
  6015. instance.reloadForce({}).then(function () {
  6016. instance.getAllDomain().then(function (data) {
  6017. _this.refs.grid1.setData(data);
  6018. });
  6019. }).finally(function () {
  6020. // 无论正常异常,关闭 "保存中..." 状态
  6021. _this.setLoading(false);
  6022. });
  6023. }).catch(function (e) {
  6024. // 无论正常异常,关闭 "保存中..." 状态
  6025. _this.setLoading(false);
  6026. });
  6027. };
  6028. return DbDomain;
  6029. }(Scope));
  6030. //# sourceMappingURL=DbDomain.js.map
  6031. var model$4 = {
  6032. data: {
  6033. report_id: '',
  6034. report_name: '',
  6035. report_enable: false,
  6036. report: {
  6037. dataSource: '',
  6038. grid: {
  6039. pagination: true,
  6040. },
  6041. query: [],
  6042. columns: [],
  6043. summary: [],
  6044. },
  6045. querySql: '',
  6046. summarySql: '',
  6047. createAt: '',
  6048. createBy: '',
  6049. updateAt: '',
  6050. updateBy: '',
  6051. }
  6052. };
  6053. //# sourceMappingURL=ReportDesign.model.js.map
  6054. var vjson$4 = {
  6055. bind: {
  6056. title: '报表-{report_name}',
  6057. },
  6058. layout: 'fit',
  6059. items: [
  6060. {
  6061. layout: 'border',
  6062. items: [
  6063. {
  6064. region: 'north',
  6065. items: [
  6066. {
  6067. xtype: 'toolbar',
  6068. border: false,
  6069. items: [
  6070. {
  6071. xtype: 'button',
  6072. text: '刷新',
  6073. iconCls: 'x-fa fa-refresh',
  6074. listeners: {
  6075. click: 'scope.load'
  6076. }
  6077. },
  6078. {
  6079. xtype: 'button',
  6080. text: '保存',
  6081. iconCls: 'x-fa fa-save',
  6082. listeners: {
  6083. click: 'scope.save'
  6084. }
  6085. },
  6086. {
  6087. xtype: 'button',
  6088. text: '预览',
  6089. iconCls: 'x-fa fa-play-circle-o',
  6090. listeners: {
  6091. click: 'scope.preview'
  6092. }
  6093. },
  6094. {
  6095. xtype: 'textfield',
  6096. fieldLabel: '报表名称',
  6097. flex: 1,
  6098. bind: {
  6099. value: '{report_name}'
  6100. }
  6101. },
  6102. {
  6103. xtype: 'checkbox',
  6104. fieldLabel: '启用报表',
  6105. checkedValue: 1,
  6106. uncheckedValue: 0,
  6107. bind: {
  6108. value: '{report_enable}'
  6109. }
  6110. },
  6111. {
  6112. xtype: 'checkbox',
  6113. fieldLabel: '启用分页',
  6114. bind: {
  6115. value: '{report.grid.pagination}'
  6116. }
  6117. },
  6118. {
  6119. xtype: 'textfield',
  6120. fieldLabel: '数据源',
  6121. flex: 1,
  6122. bind: {
  6123. value: '{report.dataSource}'
  6124. }
  6125. },
  6126. ]
  6127. }
  6128. ]
  6129. },
  6130. {
  6131. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6132. items: [
  6133. {
  6134. title: 'SQL和查询条件',
  6135. layout: 'border',
  6136. border: false,
  6137. items: [
  6138. {
  6139. region: 'north',
  6140. height: 200,
  6141. border: false,
  6142. split: true,
  6143. xtype: 'yvgrid',
  6144. reference: 'gridCondition',
  6145. pagination: false,
  6146. hideFootbar: true,
  6147. plugins: {
  6148. clipboard: true,
  6149. selectionreplicator: true
  6150. },
  6151. selModel: {
  6152. type: 'spreadsheet',
  6153. columnSelect: false,
  6154. pruneRemoved: false,
  6155. extensible: 'y'
  6156. },
  6157. tbar: {
  6158. xtype: 'toolbar',
  6159. border: false,
  6160. items: [
  6161. {
  6162. xtype: 'button',
  6163. text: '添加条件',
  6164. iconCls: 'x-fa fa-plus-circle',
  6165. listeners: {
  6166. click: 'scope.addCondition'
  6167. }
  6168. },
  6169. {
  6170. xtype: 'button',
  6171. text: '删除条件',
  6172. iconCls: 'x-fa fa-minus-circle',
  6173. listeners: {
  6174. click: 'scope.removeCondition'
  6175. }
  6176. },
  6177. '-',
  6178. {
  6179. xtype: 'button',
  6180. text: '自动分析条件变量',
  6181. iconCls: 'x-fa fa-code-fork',
  6182. listeners: {
  6183. click: 'scope.calcCondition'
  6184. }
  6185. },
  6186. {
  6187. xtype: 'button',
  6188. text: '上移',
  6189. iconCls: 'x-fa fa-arrow-up',
  6190. listeners: {
  6191. click: 'scope.moveUp'
  6192. }
  6193. },
  6194. {
  6195. xtype: 'button',
  6196. text: '下移',
  6197. iconCls: 'x-fa fa-arrow-down',
  6198. listeners: {
  6199. click: 'scope.moveDown'
  6200. }
  6201. },
  6202. ]
  6203. },
  6204. columns: [
  6205. {
  6206. text: '条件变量',
  6207. dataIndex: 'conditionFieldBind',
  6208. width: 140,
  6209. sortable: false,
  6210. menuDisabled: true,
  6211. editor: {
  6212. selectOnFocus: true
  6213. },
  6214. },
  6215. {
  6216. text: '中文标题',
  6217. dataIndex: 'conditionFieldLabel',
  6218. width: 120,
  6219. sortable: false,
  6220. menuDisabled: true,
  6221. editor: {
  6222. selectOnFocus: true
  6223. },
  6224. },
  6225. {
  6226. text: '编辑类型',
  6227. dataIndex: 'conditionFieldXtype',
  6228. width: 80,
  6229. sortable: false,
  6230. menuDisabled: true,
  6231. editor: {
  6232. xtype: 'combo',
  6233. typeAhead: true,
  6234. triggerAction: 'all',
  6235. selectOnFocus: true,
  6236. store: [
  6237. ['textfield', 'textfield'],
  6238. ['combo', 'combo'],
  6239. ['datefield', 'datefield'],
  6240. ['datetimefield', 'datetimefield'],
  6241. ['numberfield', 'numberfield'],
  6242. ['multiplesearch', 'multiplesearch'],
  6243. ]
  6244. }
  6245. },
  6246. {
  6247. text: '权重',
  6248. dataIndex: 'conditionFieldFlex',
  6249. align: 'right',
  6250. width: 60,
  6251. sortable: false,
  6252. menuDisabled: true,
  6253. editor: {
  6254. xtype: 'numberfield',
  6255. selectOnFocus: false,
  6256. minValue: 0,
  6257. maxValue: 10
  6258. },
  6259. },
  6260. {
  6261. text: '字典',
  6262. dataIndex: 'conditionFieldDict',
  6263. width: 160,
  6264. sortable: false,
  6265. menuDisabled: true,
  6266. editor: {
  6267. selectOnFocus: false
  6268. },
  6269. },
  6270. {
  6271. xtype: 'checkcolumn',
  6272. dataIndex: "conditionFieldWrap", header: "换行",
  6273. width: 65,
  6274. sortable: false,
  6275. menuDisabled: true,
  6276. },
  6277. {
  6278. text: '扩展参数',
  6279. dataIndex: 'conditionFieldExtend',
  6280. sortable: false,
  6281. menuDisabled: true,
  6282. editor: {
  6283. selectOnFocus: false
  6284. },
  6285. },
  6286. ]
  6287. },
  6288. {
  6289. region: 'center',
  6290. xtype: 'sqleditor',
  6291. layout: 'fit',
  6292. reference: 'sqlEditor',
  6293. split: true,
  6294. },
  6295. ]
  6296. },
  6297. {
  6298. title: '查询结果字段',
  6299. xtype: 'yvgrid',
  6300. reference: 'gridColumn',
  6301. pagination: false,
  6302. hideFootbar: true,
  6303. border: false,
  6304. plugins: {
  6305. clipboard: true,
  6306. selectionreplicator: true
  6307. },
  6308. selModel: {
  6309. type: 'spreadsheet',
  6310. columnSelect: false,
  6311. pruneRemoved: false,
  6312. extensible: 'y'
  6313. },
  6314. tbar: {
  6315. xtype: 'toolbar',
  6316. items: [
  6317. {
  6318. xtype: 'button',
  6319. text: '添加',
  6320. iconCls: 'x-fa fa-plus-circle',
  6321. listeners: {
  6322. click: 'scope.addColumn'
  6323. }
  6324. },
  6325. {
  6326. xtype: 'button',
  6327. text: '删除',
  6328. iconCls: 'x-fa fa-minus-circle',
  6329. listeners: {
  6330. click: 'scope.removeColumn'
  6331. }
  6332. },
  6333. '-',
  6334. {
  6335. xtype: 'button',
  6336. text: '自动分析',
  6337. iconCls: 'x-fa fa-code-fork',
  6338. listeners: {
  6339. click: 'scope.calcColumn'
  6340. }
  6341. },
  6342. {
  6343. xtype: 'button',
  6344. text: '上移',
  6345. iconCls: 'x-fa fa-arrow-up',
  6346. listeners: {
  6347. click: 'scope.moveUp'
  6348. }
  6349. },
  6350. {
  6351. xtype: 'button',
  6352. text: '下移',
  6353. iconCls: 'x-fa fa-arrow-down',
  6354. listeners: {
  6355. click: 'scope.moveDown'
  6356. }
  6357. },
  6358. ]
  6359. },
  6360. columns: [
  6361. { xtype: 'rownumberer' },
  6362. {
  6363. text: '字段',
  6364. dataIndex: 'dataIndex',
  6365. width: 140,
  6366. sortable: false,
  6367. menuDisabled: true,
  6368. editor: {
  6369. selectOnFocus: true
  6370. },
  6371. },
  6372. {
  6373. text: '标题',
  6374. dataIndex: 'header',
  6375. width: 120,
  6376. sortable: false,
  6377. menuDisabled: true,
  6378. editor: {
  6379. selectOnFocus: true
  6380. },
  6381. },
  6382. {
  6383. text: '显示类型',
  6384. dataIndex: 'xtype',
  6385. width: 90,
  6386. sortable: false,
  6387. menuDisabled: true,
  6388. editor: {
  6389. xtype: 'combo',
  6390. typeAhead: true,
  6391. triggerAction: 'all',
  6392. selectOnFocus: true,
  6393. store: [
  6394. ['', ''],
  6395. ['rownum', 'rownum'],
  6396. ['button', 'button'],
  6397. ['checkbox', 'checkbox'],
  6398. ['progres', 'progres'],
  6399. ]
  6400. }
  6401. },
  6402. {
  6403. text: '数据类型',
  6404. dataIndex: 'dataType',
  6405. width: 90,
  6406. sortable: false,
  6407. menuDisabled: true,
  6408. editor: {
  6409. xtype: 'combo',
  6410. typeAhead: true,
  6411. triggerAction: 'all',
  6412. selectOnFocus: true,
  6413. store: [
  6414. ['', ''],
  6415. ['string', 'string'],
  6416. ['number', 'number'],
  6417. ['date', 'date'],
  6418. ]
  6419. }
  6420. },
  6421. {
  6422. text: '宽度',
  6423. dataIndex: 'width',
  6424. align: 'right',
  6425. width: 60,
  6426. sortable: false,
  6427. menuDisabled: true,
  6428. editor: {
  6429. xtype: 'numberfield',
  6430. selectOnFocus: true,
  6431. minValue: 0,
  6432. maxValue: 1000
  6433. },
  6434. },
  6435. {
  6436. text: '权重',
  6437. dataIndex: 'flex',
  6438. align: 'right',
  6439. width: 60,
  6440. sortable: false,
  6441. menuDisabled: true,
  6442. editor: {
  6443. xtype: 'numberfield',
  6444. selectOnFocus: true,
  6445. minValue: 0,
  6446. maxValue: 10
  6447. },
  6448. },
  6449. {
  6450. text: '字典',
  6451. dataIndex: 'dict',
  6452. sortable: false,
  6453. menuDisabled: true,
  6454. width: 120,
  6455. editor: {
  6456. selectOnFocus: true,
  6457. },
  6458. },
  6459. {
  6460. text: '对齐',
  6461. dataIndex: 'align',
  6462. width: 60,
  6463. sortable: false,
  6464. menuDisabled: true,
  6465. editor: {
  6466. xtype: 'combo',
  6467. typeAhead: true,
  6468. triggerAction: 'all',
  6469. selectOnFocus: false,
  6470. store: [
  6471. ['', ''],
  6472. ['start', 'start'],
  6473. ['center', 'center'],
  6474. ['end', 'end'],
  6475. ]
  6476. },
  6477. },
  6478. {
  6479. text: '过滤',
  6480. dataIndex: 'filterable',
  6481. xtype: 'checkcolumn',
  6482. width: 50,
  6483. resizable: false,
  6484. sortable: false,
  6485. menuDisabled: true,
  6486. },
  6487. {
  6488. text: '隐藏',
  6489. dataIndex: 'hidden',
  6490. xtype: 'checkcolumn',
  6491. width: 50,
  6492. resizable: false,
  6493. sortable: false,
  6494. menuDisabled: true,
  6495. },
  6496. {
  6497. text: '排序',
  6498. dataIndex: 'sortable',
  6499. xtype: 'checkcolumn',
  6500. width: 50,
  6501. resizable: false,
  6502. sortable: false,
  6503. menuDisabled: true,
  6504. },
  6505. {
  6506. text: '扩展参数',
  6507. dataIndex: 'fieldExtend',
  6508. sortable: false,
  6509. menuDisabled: true,
  6510. editor: {
  6511. selectOnFocus: false
  6512. },
  6513. },
  6514. ],
  6515. },
  6516. {
  6517. title: '汇总和汇总逻辑',
  6518. layout: 'border',
  6519. border: false,
  6520. items: [
  6521. {
  6522. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6523. reference: 'gridSum',
  6524. pagination: false,
  6525. hideFootbar: true,
  6526. height: 200,
  6527. split: true,
  6528. border: false,
  6529. plugins: {
  6530. clipboard: true,
  6531. selectionreplicator: true
  6532. },
  6533. selModel: {
  6534. type: 'spreadsheet',
  6535. columnSelect: false,
  6536. pruneRemoved: false,
  6537. extensible: 'y'
  6538. },
  6539. tbar: {
  6540. xtype: 'toolbar',
  6541. border: false,
  6542. items: [
  6543. {
  6544. xtype: 'button',
  6545. text: '添加',
  6546. iconCls: 'x-fa fa-plus-circle',
  6547. listeners: {
  6548. click: 'scope.addSum'
  6549. }
  6550. },
  6551. {
  6552. xtype: 'button',
  6553. text: '删除',
  6554. iconCls: 'x-fa fa-minus-circle',
  6555. listeners: {
  6556. click: 'scope.removeSum'
  6557. }
  6558. },
  6559. '-',
  6560. {
  6561. xtype: 'button',
  6562. text: '自动分析',
  6563. iconCls: 'x-fa fa-code-fork',
  6564. listeners: {
  6565. click: 'scope.calcSum'
  6566. }
  6567. },
  6568. {
  6569. xtype: 'button',
  6570. text: '上移',
  6571. iconCls: 'x-fa fa-arrow-up',
  6572. listeners: {
  6573. click: 'scope.moveUp'
  6574. }
  6575. },
  6576. {
  6577. xtype: 'button',
  6578. text: '下移',
  6579. iconCls: 'x-fa fa-arrow-down',
  6580. listeners: {
  6581. click: 'scope.moveDown'
  6582. }
  6583. },
  6584. ]
  6585. },
  6586. columns: [
  6587. {
  6588. text: '字段名',
  6589. dataIndex: 'sumFieldBind',
  6590. width: 140,
  6591. sortable: false,
  6592. menuDisabled: true,
  6593. editor: {
  6594. selectOnFocus: true
  6595. },
  6596. },
  6597. {
  6598. text: '标题',
  6599. dataIndex: 'sumFieldLabel',
  6600. width: 120,
  6601. sortable: false,
  6602. menuDisabled: true,
  6603. editor: {
  6604. selectOnFocus: true
  6605. },
  6606. },
  6607. {
  6608. text: '权重',
  6609. dataIndex: 'sumFieldFlex',
  6610. align: 'right',
  6611. width: 60,
  6612. sortable: false,
  6613. menuDisabled: true,
  6614. editor: {
  6615. xtype: 'numberfield',
  6616. selectOnFocus: false,
  6617. allowBlank: true,
  6618. minValue: 0,
  6619. maxValue: 10
  6620. },
  6621. },
  6622. {
  6623. xtype: 'checkcolumn',
  6624. dataIndex: "sumFieldWrap", header: "换行",
  6625. sortable: false,
  6626. menuDisabled: true,
  6627. width: 65,
  6628. },
  6629. {
  6630. text: '扩展参数',
  6631. dataIndex: 'sumFieldExtend',
  6632. sortable: false,
  6633. menuDisabled: true,
  6634. editor: {
  6635. selectOnFocus: false
  6636. },
  6637. },
  6638. ]
  6639. },
  6640. {
  6641. region: 'center',
  6642. xtype: 'sqleditor',
  6643. layout: 'fit',
  6644. reference: 'sqlSumEditor',
  6645. },
  6646. ]
  6647. },
  6648. ]
  6649. }
  6650. ]
  6651. }
  6652. ]
  6653. }; //
  6654. //
  6655. //# sourceMappingURL=ReportDesign.view.js.map
  6656. var DbStore = /** @class */ (function (_super) {
  6657. __extends(DbStore, _super);
  6658. function DbStore() {
  6659. return _super !== null && _super.apply(this, arguments) || this;
  6660. }
  6661. DbStore.prototype.getCacheKey = function (param) {
  6662. return "db_data.json";
  6663. };
  6664. DbStore.prototype.invokeApi = function (param) {
  6665. return getMateData(param);
  6666. };
  6667. /**
  6668. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  6669. */
  6670. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  6671. return new Promise(function (resolve, reject) {
  6672. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  6673. resolve(res1);
  6674. // TODO 好像不需要,先跳过
  6675. // reloadByTableName(schema_name, table_name).then(res2 => {
  6676. // resolve(res1)
  6677. // }).catch(e => {
  6678. // reject(e)
  6679. // })
  6680. }).catch(function (e) {
  6681. reject(e);
  6682. });
  6683. });
  6684. };
  6685. /**
  6686. * 保存元数据至表格
  6687. */
  6688. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  6689. var _this = this;
  6690. return new Promise(function (resolve, reject) {
  6691. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  6692. // 保存后重新刷新
  6693. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  6694. resolve({
  6695. data: res2,
  6696. msg: res1.msg
  6697. });
  6698. }).catch(function (e) {
  6699. reject(e);
  6700. });
  6701. }).catch(function (e) {
  6702. reject(e);
  6703. });
  6704. });
  6705. };
  6706. /**
  6707. * 预览生成的 DDL 语句
  6708. */
  6709. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  6710. return new Promise(function (resolve, reject) {
  6711. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  6712. .then(function (res) {
  6713. resolve(res);
  6714. });
  6715. });
  6716. };
  6717. /**
  6718. * 执行 DDL
  6719. */
  6720. DbStore.prototype.pushToDbCommit = function (arg) {
  6721. return new Promise(function (resolve, reject) {
  6722. pushToDbCommitApi(arg).then(function (res) {
  6723. resolve(res);
  6724. }).catch(function (e) {
  6725. reject(e);
  6726. });
  6727. });
  6728. };
  6729. /**
  6730. * 重读某一个表格的 meta 元数据
  6731. */
  6732. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  6733. var _this = this;
  6734. return new Promise(function (resolve, reject) {
  6735. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  6736. if (!res[0] || !res[0].table_list[0]) {
  6737. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  6738. return;
  6739. }
  6740. var tableRow = _this.getTableByName(schema_name, table_name);
  6741. if (!tableRow) {
  6742. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  6743. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  6744. if (!schemaRow) {
  6745. showErrorDialog$1('没有找到 schema:' + schema_name);
  6746. return;
  6747. }
  6748. schemaRow.table_list.push(res[0].table_list[0]);
  6749. }
  6750. else {
  6751. // 找到了目标表格,就吧 table 所有属性都赋值过去
  6752. Object.assign(tableRow, res[0].table_list[0]);
  6753. }
  6754. // 所有界面通知一遍刷新
  6755. _this.notifyRefresh();
  6756. resolve(res);
  6757. }).catch(function (e) {
  6758. reject(e);
  6759. });
  6760. });
  6761. };
  6762. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  6763. var result = undefined;
  6764. _$2.forEach(this.apiResponse, function (schemaRow) {
  6765. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  6766. if (tableRow) {
  6767. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  6768. if (columnRow) {
  6769. result = columnRow;
  6770. return false;
  6771. }
  6772. }
  6773. });
  6774. return result;
  6775. };
  6776. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  6777. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  6778. if (!schemaRow) {
  6779. showErrorDialog$1('没有找到 schema:' + schemaName);
  6780. return;
  6781. }
  6782. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  6783. if (!schemaRow) {
  6784. showErrorDialog$1('没有找到 table:' + tableName);
  6785. return;
  6786. }
  6787. return tableRow;
  6788. };
  6789. /**
  6790. * 添加一个新表格
  6791. */
  6792. DbStore.prototype.appendNewTable = function (tableInfo) {
  6793. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  6794. if (!schemaRow) {
  6795. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  6796. return;
  6797. }
  6798. schemaRow.table_list.push(tableInfo);
  6799. };
  6800. /**
  6801. * 从数据库结构重新生成元数据
  6802. */
  6803. DbStore.prototype.dbToMetaAndReload = function () {
  6804. var _this = this;
  6805. this.notifyLoading(true);
  6806. dbToMeta().then(function () {
  6807. _this.reloadForce(undefined);
  6808. }).catch(function (e) {
  6809. _this.notifyLoading(false);
  6810. });
  6811. };
  6812. DbStore.prototype.getSchemaDbType = function (schemaName) {
  6813. var dbType = undefined;
  6814. _$2.forEach(this.apiResponse, function (schemaRow) {
  6815. if (schemaRow.schema_name === schemaName) {
  6816. dbType = schemaRow.db_type;
  6817. return false;
  6818. }
  6819. });
  6820. return dbType;
  6821. };
  6822. return DbStore;
  6823. }(CacheStore));
  6824. function syncQueryDSL(_a) {
  6825. var schema_name = _a.schema_name, table_name = _a.table_name;
  6826. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  6827. }
  6828. var instance$1 = new DbStore();
  6829. // // 字段域数据
  6830. // let columnDomain = undefined
  6831. // // 元数据
  6832. // let apiResponse = []
  6833. //
  6834. // // 订阅
  6835. // const subscribeList = []
  6836. // /**
  6837. // * 获取全部元数据
  6838. // */
  6839. // export function getApiResponse() {
  6840. // return apiResponse
  6841. // }
  6842. //
  6843. // export function getColumnDomain() {
  6844. // return columnDomain
  6845. // }
  6846. // window['getApiResponse'] = getApiResponse
  6847. // window['getColumnDomain'] = getColumnDomain
  6848. // window['getDbTreeStore'] = function () {
  6849. // return apiResponse
  6850. // }
  6851. //
  6852. // /**
  6853. // * 订阅结果集
  6854. // */
  6855. // export function subscribe(fn) {
  6856. // subscribeList.push(fn)
  6857. // }
  6858. //
  6859. // /**
  6860. // * 取消订阅
  6861. // */
  6862. // export function describe(fn) {
  6863. // _.remove(subscribeList, item => item === fn)
  6864. // }
  6865. //
  6866. // /**
  6867. // * 刷新,如果前端从来没有取到过结果的话
  6868. // * 如果强制刷新成功,就返回 true
  6869. // * 如果没有被强制刷新,返回 false
  6870. // */
  6871. // export function reloadIfNeed() {
  6872. // if (_.size(apiResponse) <= 0) {
  6873. // reloadForce()
  6874. // return true
  6875. // }
  6876. // return false
  6877. // }
  6878. //
  6879. // export function reloadIfNeedPromise() {
  6880. // return new Promise((resolve, reject) => {
  6881. // if (_.size(apiResponse) <= 0) {
  6882. // // 从未有获取过值
  6883. // reloadForce().then(res => {
  6884. // resolve(apiResponse)
  6885. // })
  6886. // return
  6887. // }
  6888. // resolve(apiResponse)
  6889. // return
  6890. // })
  6891. // }
  6892. //
  6893. // /**
  6894. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6895. // */
  6896. // export function reloadForce() {
  6897. // _.forEach(subscribeList, fn => {
  6898. // fn(true)
  6899. // })
  6900. //
  6901. // return getMateData().then((content) => {
  6902. // apiResponse = content
  6903. // _.forEach(subscribeList, fn => {
  6904. // fn(apiResponse)
  6905. // })
  6906. // }).finally(() => {
  6907. // _.forEach(subscribeList, fn => {
  6908. // fn(false)
  6909. // })
  6910. // })
  6911. // }
  6912. //
  6913. // /**
  6914. // * 通知刷新元数据
  6915. // */
  6916. // export function notifyRefresh() {
  6917. // _.forEach(subscribeList, fn => {
  6918. // fn(apiResponse)
  6919. // })
  6920. // }
  6921. // export function getAllDomain() {
  6922. // return new Promise((resolve, reject) => {
  6923. // getColumnDomainApi()
  6924. // .then(res => {
  6925. // if (res.success) {
  6926. // columnDomain = res.data
  6927. // resolve(res.data)
  6928. // } else {
  6929. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  6930. // console.error('getColumnDomain', res.msg)
  6931. // }
  6932. //
  6933. // })
  6934. // .catch(e => {
  6935. // showErrorDialog('getColumnDomain error!')
  6936. // console.error('getColumnDomain', e)
  6937. // reject(e)
  6938. // })
  6939. // })
  6940. // }
  6941. //# sourceMappingURL=DbStore.js.map
  6942. var PROJECT_DICT_CACHE = {};
  6943. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  6944. /**
  6945. *项目运行时构建
  6946. **/
  6947. function createRuntime() {
  6948. {
  6949. // 已经构建过了
  6950. return new Promise(function (resolve) {
  6951. resolve();
  6952. });
  6953. }
  6954. }
  6955. //# sourceMappingURL=ProjectRuntime.js.map
  6956. function ReportRunner(reportId, setLoadingFn) {
  6957. return new Promise(function (resolve) {
  6958. setLoadingFn(true);
  6959. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  6960. // const {model, vjson, report} = buildVjson(res.data)
  6961. // const ret = new ReportScope({model, vjson})
  6962. // ret.report_id = reportId
  6963. // ret.report = report
  6964. // resolve(ret)
  6965. var _b = __read(_a, 1), res = _b[0];
  6966. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  6967. resolve(ret);
  6968. }).finally(function () {
  6969. setLoadingFn(false);
  6970. });
  6971. });
  6972. }
  6973. //# sourceMappingURL=ReportRunner.js.map
  6974. //gridCondition
  6975. //gridColumn
  6976. //gridSum
  6977. //sqlSumEditor
  6978. //sqlEditor
  6979. var ReportDesign = /** @class */ (function (_super) {
  6980. __extends(ReportDesign, _super);
  6981. function ReportDesign() {
  6982. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  6983. }
  6984. ReportDesign.prototype.onLoad = function () {
  6985. this.load();
  6986. };
  6987. ReportDesign.prototype.save = function (sender) {
  6988. var _this = this;
  6989. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  6990. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  6991. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  6992. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  6993. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  6994. var report = this.viewModel.get('report');
  6995. var data = {
  6996. report_id: this.viewModel.get('report_id'),
  6997. report_name: this.viewModel.get('report_name'),
  6998. report_enable: this.viewModel.get('report_enable'),
  6999. query_sql: this.viewModel.get('querySql'),
  7000. summary_sql: this.viewModel.get('summarySql'),
  7001. report: json5.stringify(report, null, ' '),
  7002. };
  7003. sender.setLoading(true);
  7004. saveReportApi(data).then(function (res) {
  7005. if (res.success) {
  7006. msg$1('保存成功');
  7007. _this.dialogSuccess(data);
  7008. _this.load();
  7009. }
  7010. }).finally(function () {
  7011. sender.setLoading(false);
  7012. });
  7013. };
  7014. ReportDesign.prototype.preview = function (sender) {
  7015. var reportId = this.viewModel.get('report_id');
  7016. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7017. handles.mainWindow.showReportPreview(reportId, scope);
  7018. });
  7019. };
  7020. ReportDesign.prototype.load = function () {
  7021. var _this = this;
  7022. var reportId = this.viewModel.get('report_id');
  7023. this.setLoading(true);
  7024. reportByIdApi(reportId).then(function (res) {
  7025. 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;
  7026. if (report) {
  7027. report = json5.parse(report);
  7028. }
  7029. else {
  7030. report = {};
  7031. }
  7032. _this.viewModel.set('report_enable', report_enable);
  7033. _this.viewModel.set('report_name', report_name);
  7034. _this.viewModel.set('querySql', query_sql || '');
  7035. _this.viewModel.set('summarySql', summary_sql || '');
  7036. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7037. var query = _this.viewModel.get('report.query') || [];
  7038. var columns = _this.viewModel.get('report.columns') || [];
  7039. var summary = _this.viewModel.get('report.summary') || [];
  7040. var querySql = _this.viewModel.get('querySql');
  7041. var summarySql = _this.viewModel.get('summarySql');
  7042. _this.refs.gridCondition.setData(query);
  7043. _this.refs.gridColumn.setData(columns);
  7044. _this.refs.gridSum.setData(summary);
  7045. _this.refs.sqlEditor.setCode(querySql);
  7046. _this.refs.sqlSumEditor.setCode(summarySql);
  7047. }).finally(function () {
  7048. _this.setLoading(false);
  7049. });
  7050. };
  7051. ReportDesign.prototype.addCondition = function () {
  7052. this.refs.gridCondition.appendEditRow({
  7053. conditionFieldBind: '',
  7054. conditionFieldLabel: '',
  7055. conditionFieldXtype: 'textfield',
  7056. conditionFieldFlex: 1,
  7057. conditionFieldDict: '',
  7058. conditionFieldWrap: false,
  7059. conditionFieldExtend: '{}',
  7060. }, 'conditionFieldBind');
  7061. };
  7062. ReportDesign.prototype.removeCondition = function () {
  7063. var _this = this;
  7064. var rows = [];
  7065. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7066. rows.push(r);
  7067. });
  7068. _.forEach(rows, function (r) {
  7069. _this.refs.gridCondition.getStore().remove(r);
  7070. });
  7071. };
  7072. ReportDesign.prototype.moveUp = function (sender) {
  7073. var grid = sender.up('grid');
  7074. grid.rowMoveUp();
  7075. };
  7076. ReportDesign.prototype.moveDown = function (sender) {
  7077. var grid = sender.up('grid');
  7078. grid.rowMoveDown();
  7079. };
  7080. ReportDesign.prototype.calcCondition = function () {
  7081. var _this = this;
  7082. var sql = this.refs.sqlEditor.getCode();
  7083. var re = sql.matchAll(/#{(.+?)}/gi);
  7084. var rows = this.refs.gridCondition.getDataRows();
  7085. this.refs.gridCondition.setLoading(true);
  7086. Promise.all([
  7087. parseDynamicSqlApi(sql),
  7088. instance$1.reloadIfNeedPromise(),
  7089. ]).then(function (_a) {
  7090. var e_1, _b;
  7091. var _c = __read(_a, 1), res1 = _c[0];
  7092. if (res1.success) {
  7093. var tables_1 = [];
  7094. _.forEach(res1.data, function (parseItem) {
  7095. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7096. if (tableName && !_.includes(tables_1, tableName)) {
  7097. tables_1.push(tableName);
  7098. }
  7099. });
  7100. var _loop_1 = function (m) {
  7101. var e_2, _a;
  7102. var columnName = m[1];
  7103. // 没有这个列才添加
  7104. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7105. var meta = undefined;
  7106. try {
  7107. 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()) {
  7108. var tableName = tables_2_1.value;
  7109. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7110. if (meta) {
  7111. break;
  7112. }
  7113. }
  7114. }
  7115. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7116. finally {
  7117. try {
  7118. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7119. }
  7120. finally { if (e_2) throw e_2.error; }
  7121. }
  7122. if (meta) {
  7123. // 找到元数据
  7124. var r = {
  7125. conditionFieldBind: meta.column_name,
  7126. conditionFieldLabel: meta.column_comment,
  7127. conditionFieldXtype: 'textfield',
  7128. conditionFieldFlex: 1,
  7129. conditionFieldDict: '',
  7130. conditionFieldWrap: false,
  7131. conditionFieldExtend: '{}',
  7132. };
  7133. if (meta.column_ui === 'combo' && meta.column_dict) {
  7134. r.conditionFieldXtype = 'combo';
  7135. r.conditionFieldDict = meta.column_dict;
  7136. }
  7137. else if (meta.column_ui === "checkbox") {
  7138. r.conditionFieldXtype = 'checkbox';
  7139. }
  7140. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7141. r.conditionFieldXtype = 'numberfield';
  7142. }
  7143. _this.refs.gridCondition.appendEditRow(r);
  7144. }
  7145. else {
  7146. // 没找到元数据,直接添加
  7147. _this.refs.gridCondition.appendEditRow({
  7148. conditionFieldBind: columnName,
  7149. conditionFieldLabel: '',
  7150. conditionFieldXtype: 'textfield',
  7151. conditionFieldFlex: 1,
  7152. conditionFieldDict: '',
  7153. conditionFieldWrap: false,
  7154. conditionFieldExtend: '{}',
  7155. });
  7156. }
  7157. }
  7158. };
  7159. try {
  7160. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7161. var m = re_1_1.value;
  7162. _loop_1(m);
  7163. }
  7164. }
  7165. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7166. finally {
  7167. try {
  7168. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7169. }
  7170. finally { if (e_1) throw e_1.error; }
  7171. }
  7172. }
  7173. }).finally(function () {
  7174. _this.refs.gridCondition.setLoading(false);
  7175. });
  7176. };
  7177. ReportDesign.prototype.addColumn = function () {
  7178. this.refs.gridColumn.appendEditRow({
  7179. dataIndex: '',
  7180. header: '',
  7181. xtype: '',
  7182. dataType: '',
  7183. width: '',
  7184. dict: '',
  7185. align: '',
  7186. filterable: true,
  7187. hidden: false,
  7188. sortable: true,
  7189. fieldExtend: '{}',
  7190. }, 'header');
  7191. };
  7192. ReportDesign.prototype.removeColumn = function () {
  7193. var _this = this;
  7194. var rows = [];
  7195. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7196. rows.push(r);
  7197. });
  7198. _.forEach(rows, function (r) {
  7199. _this.refs.gridColumn.getStore().remove(r);
  7200. });
  7201. };
  7202. ReportDesign.prototype.calcColumn = function () {
  7203. var _this = this;
  7204. var sql = this.refs.sqlEditor.getCode();
  7205. this.refs.gridColumn.setLoading(true);
  7206. var rows = this.refs.gridColumn.getDataRows();
  7207. Promise.all([
  7208. parseDynamicSqlApi(sql),
  7209. instance$1.reloadIfNeedPromise(),
  7210. ]).then(function (_a) {
  7211. var _b = __read(_a, 1), res1 = _b[0];
  7212. if (res1.success) {
  7213. _.forEach(res1.data, function (parseItem) {
  7214. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7215. // 是否找到重复字段
  7216. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7217. if (exists) {
  7218. if ((columnTypeName || "").toLowerCase() === "number") {
  7219. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7220. if (record) {
  7221. record.set("dataType", "number");
  7222. record.set("align", "end");
  7223. }
  7224. }
  7225. return;
  7226. }
  7227. if (tableName) {
  7228. // 解出表格名和字段名
  7229. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7230. if (meta) {
  7231. // 找到了元数据
  7232. var r = {
  7233. dataIndex: meta.column_name,
  7234. header: meta.column_comment,
  7235. xtype: '',
  7236. dataType: '',
  7237. width: '',
  7238. dict: '',
  7239. align: '',
  7240. filterable: true,
  7241. hidden: false,
  7242. sortable: true,
  7243. fieldExtend: '{}',
  7244. };
  7245. if (meta.column_ui === 'combo' && meta.column_dict) {
  7246. r.dict = meta.column_dict;
  7247. }
  7248. else if (meta.column_ui === "checkbox") {
  7249. r.xtype = 'checkbox';
  7250. }
  7251. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7252. r.dataType = meta.data_type;
  7253. r.align = 'end';
  7254. }
  7255. if ((columnTypeName || "").toLowerCase() === "number") {
  7256. r.dataType = "number";
  7257. r.align = 'end';
  7258. }
  7259. _this.refs.gridColumn.appendEditRow(r);
  7260. return;
  7261. }
  7262. }
  7263. if (columnName) {
  7264. // 解出字段名
  7265. var r = {
  7266. dataIndex: columnName,
  7267. header: columnName,
  7268. xtype: '',
  7269. dataType: '',
  7270. width: '',
  7271. dict: '',
  7272. align: '',
  7273. filterable: true,
  7274. hidden: false,
  7275. sortable: true,
  7276. fieldExtend: '{}',
  7277. };
  7278. if ((columnTypeName || "").toLowerCase() === "number") {
  7279. r.dataType = "number";
  7280. r.align = 'end';
  7281. }
  7282. _this.refs.gridColumn.appendEditRow(r);
  7283. }
  7284. });
  7285. }
  7286. }).finally(function () {
  7287. _this.refs.gridColumn.setLoading(false);
  7288. });
  7289. };
  7290. ReportDesign.prototype.addSum = function () {
  7291. this.refs.gridSum.appendEditRow({
  7292. sumFieldBind: '',
  7293. sumFieldLabel: '',
  7294. sumFieldFlex: 1,
  7295. sumFieldWrap: false,
  7296. sumFieldExtend: '{}',
  7297. }, 'sumFieldBind');
  7298. };
  7299. ReportDesign.prototype.removeSum = function () {
  7300. var _this = this;
  7301. var rows = [];
  7302. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7303. rows.push(r);
  7304. });
  7305. _.forEach(rows, function (r) {
  7306. _this.refs.gridSum.getStore().remove(r);
  7307. });
  7308. };
  7309. ReportDesign.prototype.calcSum = function () {
  7310. var _this = this;
  7311. var sql = this.refs.sqlSumEditor.getCode();
  7312. var rows = this.refs.gridSum.getDataRows();
  7313. this.refs.gridSum.setLoading(true);
  7314. parseDynamicSqlApi(sql).then(function (res1) {
  7315. if (res1.success) {
  7316. _.forEach(res1.data, function (parseItem) {
  7317. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7318. // 是否找到重复字段
  7319. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7320. return;
  7321. }
  7322. if (columnName) {
  7323. // 解出字段名
  7324. _this.refs.gridSum.appendEditRow({
  7325. sumFieldBind: columnName,
  7326. sumFieldLabel: columnName,
  7327. sumFieldFlex: 1,
  7328. sumFieldWrap: false,
  7329. sumFieldExtend: '{}',
  7330. });
  7331. }
  7332. });
  7333. }
  7334. }).finally(function () {
  7335. _this.refs.gridSum.setLoading(false);
  7336. });
  7337. };
  7338. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7339. get: function () {
  7340. return this.viewModel.get('report_id');
  7341. },
  7342. enumerable: true,
  7343. configurable: true
  7344. });
  7345. return ReportDesign;
  7346. }(Scope));
  7347. //# sourceMappingURL=ReportDesign.js.map
  7348. var model$5 = {
  7349. data: {
  7350. originalTableInfo: {
  7351. table_name: '',
  7352. description: '',
  7353. },
  7354. hasChanged: false,
  7355. schema_name: undefined,
  7356. table_name: undefined,
  7357. column_name: undefined,
  7358. tableInfo: {
  7359. schema_name: '',
  7360. table_name: '',
  7361. description: '',
  7362. biz_category: '',
  7363. note: '',
  7364. archive_enable: false,
  7365. archive_cron: '',
  7366. archive_condition: '',
  7367. column_list: []
  7368. },
  7369. },
  7370. formulas: {
  7371. shouldSave: function (get) {
  7372. // console.log("-->", get('grid1.ischanged'))
  7373. return get('grid1.ischanged')
  7374. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7375. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7376. },
  7377. },
  7378. };
  7379. //# sourceMappingURL=DbColumn.model.js.map
  7380. var vjson$5 = {
  7381. bind: {
  7382. title: '{tableName}{shouldSave?" *":""}',
  7383. },
  7384. layout: 'fit',
  7385. items: [
  7386. {
  7387. layout: 'border',
  7388. tbar: {
  7389. xtype: 'toolbar',
  7390. items: [
  7391. // {
  7392. // xtype: 'button',
  7393. // text: '拉取库结构',
  7394. // iconCls: 'x-fa fa-cloud-download',
  7395. // listeners: {
  7396. // click: 'scope.pullFromDb'
  7397. // }
  7398. // },
  7399. {
  7400. xtype: 'button',
  7401. text: '保存至数据库',
  7402. iconCls: 'x-fa fa-save',
  7403. bind: {
  7404. disabled: '{!shouldSave}'
  7405. },
  7406. listeners: {
  7407. click: 'scope.pushToDb'
  7408. }
  7409. },
  7410. '-',
  7411. {
  7412. xtype: 'button',
  7413. text: '刷新 QueryDSL',
  7414. iconCls: 'x-fa fa-refresh',
  7415. listeners: {
  7416. click: 'scope.syncQueryDSL'
  7417. }
  7418. },
  7419. {
  7420. xtype: 'button',
  7421. text: '生成 DDL',
  7422. iconCls: 'x-fa fa-file-text',
  7423. listeners: {
  7424. click: 'scope.buildDDL'
  7425. }
  7426. }
  7427. ]
  7428. },
  7429. items: [
  7430. {
  7431. region: 'center',
  7432. xtype: 'tabpanel',
  7433. items: [
  7434. {
  7435. title: '字段',
  7436. xtype: 'yvgrid',
  7437. selModel: {
  7438. type: 'spreadsheet',
  7439. columnSelect: true,
  7440. pruneRemoved: false,
  7441. extensible: 'y'
  7442. },
  7443. enableLocking: false,
  7444. idField: 'column_name',
  7445. plugins: {
  7446. clipboard: true,
  7447. selectionreplicator: true
  7448. },
  7449. reference: 'grid1',
  7450. pagination: false,
  7451. // hideFootbar: true,
  7452. tbar: {
  7453. xtype: 'form',
  7454. items: [
  7455. {
  7456. xtype: 'cols',
  7457. items: [
  7458. {
  7459. xtype: 'textfield',
  7460. fieldLabel: '表格名',
  7461. reference: 'text_table_name',
  7462. readOnly: true,
  7463. bind: {
  7464. value: '{tableInfo.table_name}'
  7465. }
  7466. },
  7467. {
  7468. xtype: 'textfield',
  7469. fieldLabel: '描述',
  7470. // readOnly: true,
  7471. bind: {
  7472. value: '{tableInfo.description}'
  7473. }
  7474. },
  7475. ]
  7476. },
  7477. {
  7478. xtype: 'toolbar',
  7479. items: [
  7480. {
  7481. xtype: 'button',
  7482. text: '添加',
  7483. iconCls: 'x-fa fa-plus-circle',
  7484. listeners: {
  7485. click: 'scope.addField'
  7486. }
  7487. },
  7488. {
  7489. xtype: 'button',
  7490. text: '删除',
  7491. iconCls: 'x-fa fa-minus-circle',
  7492. listeners: {
  7493. click: 'scope.removeField'
  7494. }
  7495. },
  7496. ]
  7497. },
  7498. ]
  7499. },
  7500. listeners: {
  7501. editbefore: 'scope.gridEditBefore'
  7502. },
  7503. columns: [
  7504. {
  7505. text: '字段名', dataIndex: 'column_name',
  7506. sortable: false,
  7507. menuDisabled: true,
  7508. width: 120,
  7509. editor: {
  7510. allowBlank: true,
  7511. selectOnFocus: false
  7512. }
  7513. },
  7514. {
  7515. text: '字段中文', dataIndex: 'column_comment',
  7516. width: 130,
  7517. sortable: false,
  7518. menuDisabled: true,
  7519. editor: {
  7520. allowBlank: true,
  7521. selectOnFocus: false
  7522. }
  7523. },
  7524. {
  7525. text: '主键', dataIndex: 'is_primary_key',
  7526. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7527. width: 48, resizable: false,
  7528. },
  7529. {
  7530. text: '必填', dataIndex: 'not_null',
  7531. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7532. width: 48, resizable: false,
  7533. },
  7534. {
  7535. text: '字段域', dataIndex: 'column_domain',
  7536. sortable: false, menuDisabled: true,
  7537. width: 148,
  7538. fix: ['system.getDict("column_domain")'],
  7539. editor: {
  7540. xtype: 'combo',
  7541. allowBlank: true,
  7542. selectOnFocus: true,
  7543. fix: ['system.getDict("column_domain")'],
  7544. listConfig: {
  7545. minWidth: 200
  7546. },
  7547. listeners: {
  7548. change: 'scope.columnDomainChange',
  7549. }
  7550. }
  7551. },
  7552. {
  7553. text: '数据类型', dataIndex: 'data_type',
  7554. sortable: false, menuDisabled: true,
  7555. editor: { allowBlank: true, selectOnFocus: true }
  7556. },
  7557. {
  7558. text: '长度', dataIndex: 'column_size',
  7559. sortable: false, menuDisabled: true,
  7560. xtype: 'numbercolumn', format: '0',
  7561. editor: { allowBlank: true, selectOnFocus: true }
  7562. },
  7563. {
  7564. text: '小数位', dataIndex: 'decimal_digits',
  7565. sortable: false, menuDisabled: true,
  7566. xtype: 'numbercolumn', format: '0',
  7567. editor: { allowBlank: true, selectOnFocus: true }
  7568. },
  7569. {
  7570. text: '默认值', dataIndex: 'default_value',
  7571. sortable: false, menuDisabled: true,
  7572. editor: { allowBlank: true, selectOnFocus: true }
  7573. },
  7574. {
  7575. text: '字典', dataIndex: 'column_dict',
  7576. sortable: false, menuDisabled: true,
  7577. // fix: ['system.getDict("DICT")'],
  7578. width: 200,
  7579. editor: {
  7580. xtype: 'combo',
  7581. allowBlank: true,
  7582. listConfig: {
  7583. minWidth: 350
  7584. },
  7585. }
  7586. },
  7587. {
  7588. text: 'UI建议', dataIndex: 'column_ui',
  7589. sortable: false, menuDisabled: true,
  7590. // fix: ['system.getDict("column_ui")'],
  7591. editor: {
  7592. xtype: 'combo',
  7593. allowBlank: true,
  7594. listConfig: {
  7595. minWidth: 200
  7596. },
  7597. }
  7598. },
  7599. {
  7600. text: '详细描述', dataIndex: 'column_note',
  7601. sortable: false, menuDisabled: true,
  7602. editor: { allowBlank: true, }
  7603. },
  7604. ]
  7605. },
  7606. {
  7607. title: '高级属性',
  7608. xtype: 'form',
  7609. items: [
  7610. // {
  7611. // xtype: 'textfield',
  7612. // fieldLabel: '表格名',
  7613. // bind: {
  7614. // value: '{tableName}'
  7615. // }
  7616. // },
  7617. // {
  7618. // xtype: 'textfield',
  7619. // fieldLabel: '中文含义',
  7620. // bind: {
  7621. // value: '{tableInfo.description}'
  7622. // }
  7623. // },
  7624. {
  7625. xtype: 'combo',
  7626. fieldLabel: '业务类型',
  7627. bind: {
  7628. value: '{tableInfo.biz_category}'
  7629. },
  7630. store: [
  7631. '基础资料',
  7632. '系统',
  7633. '账目与库存',
  7634. '单据',
  7635. '指令',
  7636. '规则与流程',
  7637. '开发辅助',
  7638. ]
  7639. },
  7640. {
  7641. xtype: 'textfield',
  7642. fieldLabel: '详细描述',
  7643. bind: {
  7644. value: '{tableInfo.note}'
  7645. },
  7646. },
  7647. {
  7648. xtype: 'checkbox',
  7649. fieldLabel: '允许归档',
  7650. bind: "{tableInfo.archive_enable}",
  7651. },
  7652. {
  7653. xtype: 'textfield',
  7654. fieldLabel: '归档周期',
  7655. bind: {
  7656. value: '{tableInfo.archive_cron}',
  7657. hidden: '{!tableInfo.archive_enable}',
  7658. }
  7659. },
  7660. {
  7661. xtype: 'textfield',
  7662. fieldLabel: '归档条件',
  7663. bind: {
  7664. value: '{tableInfo.archive_condition}',
  7665. hidden: '{!tableInfo.archive_enable}',
  7666. }
  7667. },
  7668. ]
  7669. },
  7670. ]
  7671. }
  7672. ]
  7673. },
  7674. ]
  7675. };
  7676. //# sourceMappingURL=DbColumn.view.js.map
  7677. var DbColumn = /** @class */ (function (_super) {
  7678. __extends(DbColumn, _super);
  7679. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  7680. var _this = _super.call(this, {
  7681. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  7682. vjson: vjson$5
  7683. }) || this;
  7684. _this.isCreate = false;
  7685. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  7686. return _this;
  7687. }
  7688. DbColumn.prototype.onLoad = function () {
  7689. var _this = this;
  7690. var _a, _b, _c, _d, _e, _f, _g, _h;
  7691. console.log('me', this);
  7692. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  7693. this.refs.grid1.autoSizeColumns();
  7694. // this.refs.grid1.columns[0].hide()
  7695. // 自动定位到选定的列
  7696. if (this.viewModel.get('column_name')) {
  7697. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  7698. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  7699. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  7700. return;
  7701. }
  7702. }
  7703. }
  7704. instance.getColumnDomainComboData().then(function () {
  7705. _this.checkDomain();
  7706. });
  7707. 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 : "");
  7708. 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 : "");
  7709. if (this.isCreate)
  7710. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  7711. };
  7712. DbColumn.prototype.checkDomain = function () {
  7713. // 走查一遍 domain
  7714. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  7715. var dbType = this.viewModel.get('tableInfo.db_type');
  7716. var diffColumnName = [];
  7717. var tableInfo = this.viewModel.get('tableInfo');
  7718. this.refs.grid1.store.data.items.forEach(function (record) {
  7719. var data = record.data;
  7720. var column_domain = data.column_domain;
  7721. var domain = instance.getColumnDomainById(column_domain);
  7722. if (!domain) {
  7723. // 没有找到 domain
  7724. return;
  7725. }
  7726. var editRow = applyDomain(dbType, domain);
  7727. // 字段跟领域做对比
  7728. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  7729. if (typeof compareResult === 'string') {
  7730. // 不一样的情况下,要改成一致
  7731. _$2.forOwn(editRow, function (value, key) {
  7732. // 改成与 domain 一致
  7733. record.set(key, value);
  7734. });
  7735. diffColumnName.push(data.column_name + '.' + compareResult);
  7736. }
  7737. });
  7738. if (diffColumnName.length > 0) {
  7739. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  7740. }
  7741. };
  7742. DbColumn.prototype.addField = function () {
  7743. this.refs.grid1.appendEditRow({
  7744. column_name: '',
  7745. column_comment: '',
  7746. is_primary_key: false,
  7747. not_null: true,
  7748. column_domain: '',
  7749. data_type: '',
  7750. column_size: 0,
  7751. decimal_digits: 0,
  7752. default_value: '',
  7753. column_dict: '',
  7754. column_ui: '',
  7755. column_note: '',
  7756. }, 'column_name');
  7757. };
  7758. DbColumn.prototype.removeField = function () {
  7759. var _this = this;
  7760. var rows = [];
  7761. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  7762. rows.push(r);
  7763. });
  7764. _$2.forEach(rows, function (r) {
  7765. _this.refs.grid1.getStore().remove(r);
  7766. });
  7767. };
  7768. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  7769. instance.getColumnDomainComboData().then(function (data) {
  7770. editor.cmp.columns[5].getEditor().setStore({ data: data });
  7771. });
  7772. // 被字段域锁定的内容,不允许修改
  7773. var record = context.record, field = context.field;
  7774. var domainId = record.get('column_domain');
  7775. if (!domainId) {
  7776. return;
  7777. }
  7778. var domain = instance.getColumnDomainById(domainId);
  7779. if (!domain) {
  7780. msg$1('没有找到字段域' + domainId);
  7781. return;
  7782. }
  7783. if (field === "data_type") {
  7784. // 字段类型不允许修改
  7785. context.cancel = true;
  7786. return;
  7787. }
  7788. if (domain.is_fix_size &&
  7789. (field === "column_size" ||
  7790. field === "decimal_digits")) {
  7791. // 锁定长度的情况下,大小不允许修改
  7792. context.cancel = true;
  7793. return;
  7794. }
  7795. if (domain.is_fix_default_value && field === "default_value") {
  7796. // 锁定默认值的情况下,默认值不允许修改
  7797. context.cancel = true;
  7798. return;
  7799. }
  7800. };
  7801. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  7802. if (!newValue) {
  7803. return;
  7804. }
  7805. var grid = editor.up('grid').ownerGrid;
  7806. var domain = instance.getColumnDomainById(newValue);
  7807. if (!domain) {
  7808. msg$1('没有找到 domain:' + newValue);
  7809. return;
  7810. }
  7811. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  7812. var dbType = this.viewModel.get('tableInfo.db_type');
  7813. var editRow = applyDomain(dbType, domain);
  7814. grid.setEditRow(editRow);
  7815. };
  7816. DbColumn.prototype.pullFromDb = function () {
  7817. };
  7818. DbColumn.prototype.pushToDb = function (sender) {
  7819. var _this = this;
  7820. // 设置当前界面为 "保存中..." 状态
  7821. var me = this;
  7822. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  7823. this.viewModel.set('tableInfo.table_name', table_name);
  7824. this.viewModel.set('tableInfo.schema_name', schema_name);
  7825. var tableInfo = this.viewModel.get('tableInfo');
  7826. var column_list = this.refs.grid1.getDataRows();
  7827. var hasError = false;
  7828. if (column_list.length <= 0) {
  7829. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  7830. hasError = true;
  7831. }
  7832. var columnNameExistsCheck = {};
  7833. _$2.forEach(column_list, function (row, i) {
  7834. var checkResult = checkColumn(tableInfo, row);
  7835. if (typeof checkResult !== 'undefined') {
  7836. msg$1(checkResult);
  7837. hasError = true;
  7838. _this.refs.grid1.beginEdit(i, 'column_name');
  7839. return false;
  7840. }
  7841. if (!row.column_domain || row.column_domain === '0') {
  7842. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  7843. hasError = true;
  7844. _this.refs.grid1.beginEdit(i, 'column_domain');
  7845. return false;
  7846. }
  7847. if (isEmpty(row.data_type)) {
  7848. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  7849. hasError = true;
  7850. _this.refs.grid1.beginEdit(i, 'data_type');
  7851. return false;
  7852. }
  7853. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  7854. // 列名已存在
  7855. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  7856. hasError = true;
  7857. _this.refs.grid1.beginEdit(i, 'column_name');
  7858. return false;
  7859. }
  7860. columnNameExistsCheck[row.column_name] = true;
  7861. });
  7862. if (hasError)
  7863. return;
  7864. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  7865. me.setLoading(true);
  7866. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  7867. .then(function (res) {
  7868. var _a;
  7869. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  7870. // 返回 DDL 就要显示出来
  7871. var window_1 = Ext.create('Ext.window.Window', {
  7872. title: 'SQL 预览',
  7873. height: 400,
  7874. width: 600,
  7875. modal: true,
  7876. animateTarget: sender,
  7877. maximizable: true,
  7878. layout: 'fit',
  7879. items: {
  7880. xtype: 'sqleditor',
  7881. value: res.data.ddl
  7882. },
  7883. buttons: [
  7884. {
  7885. xtype: 'button',
  7886. text: '执行',
  7887. iconCls: 'x-fa fa-save',
  7888. handler: function (sender) {
  7889. var editor = sender.up('window').down('sqleditor');
  7890. var ddl = editor.getValue();
  7891. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  7892. }
  7893. },
  7894. {
  7895. xtype: 'button',
  7896. text: '取消',
  7897. iconCls: 'x-fa fa-times',
  7898. handler: function () {
  7899. window_1.close();
  7900. }
  7901. }
  7902. ]
  7903. }).show();
  7904. return;
  7905. }
  7906. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  7907. var tableRow = instance$1.getTableByName(schema_name, table_name);
  7908. if (!tableRow) {
  7909. // throw Error('没有找到 table', schemaName, tableName, columnName)
  7910. console.log('这是一个新 table');
  7911. instance$1.appendNewTable(tableInfo);
  7912. }
  7913. _this.viewModel.set('schema_name', schema_name);
  7914. _this.viewModel.set('table_name', table_name);
  7915. _this.viewModel.set('tableInfo', tableInfo);
  7916. _this.refs.grid1.setData(tableInfo.column_list);
  7917. if (tableRow)
  7918. Object.assign(tableRow, tableInfo);
  7919. msg$1('保存成功');
  7920. _this.viewModel.set('hasChanged', false);
  7921. })
  7922. .finally(function () {
  7923. me.setLoading(false);
  7924. });
  7925. };
  7926. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  7927. var _this = this;
  7928. window.setLoading(true);
  7929. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  7930. .then(function (res) {
  7931. var _a, _b, _c, _d;
  7932. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  7933. // 保存成功就提示一下,并重新载入数据
  7934. msg$1(res.msg);
  7935. instance$1.reloadForce(undefined);
  7936. var tableRow = instance$1.getTableByName(schema_name, table_name);
  7937. if (!tableRow) {
  7938. // throw Error('没有找到 table', schemaName, tableName, columnName)
  7939. console.log('这是一个新 table');
  7940. instance$1.appendNewTable(tableInfo);
  7941. }
  7942. _this.viewModel.set('schema_name', schema_name);
  7943. _this.viewModel.set('table_name', table_name);
  7944. _this.viewModel.set('tableInfo', tableInfo);
  7945. _this.refs.grid1.setData(tableInfo.column_list);
  7946. if (tableRow)
  7947. Object.assign(tableRow, tableInfo);
  7948. instance$1.notifyRefresh();
  7949. window.close();
  7950. _this.viewModel.set('hasChanged', false);
  7951. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  7952. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  7953. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  7954. })
  7955. .finally(function () {
  7956. // 无论正常异常,关闭 "保存中..." 状态
  7957. window.setLoading(false);
  7958. });
  7959. };
  7960. DbColumn.prototype.syncQueryDSL = function () {
  7961. var _this = this;
  7962. var tableInfo = this.viewModel.get("tableInfo");
  7963. this.setLoading(true);
  7964. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  7965. .then(function () {
  7966. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  7967. })
  7968. .finally(function () {
  7969. _this.setLoading(false);
  7970. });
  7971. };
  7972. DbColumn.prototype.buildDDL = function () {
  7973. };
  7974. return DbColumn;
  7975. }(Scope));
  7976. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  7977. model.data.schema_name = schemaName;
  7978. model.data.table_name = tableName;
  7979. model.data.column_name = columnName;
  7980. if (isCreateTable) {
  7981. var dbType = instance$1.getSchemaDbType(schemaName);
  7982. if (!dbType) {
  7983. throw Error('无法识别数据库类型' + schemaName);
  7984. }
  7985. model.data.tableInfo.schema_name = model.data.schema_name;
  7986. model.data.tableInfo.table_name = model.data.table_name;
  7987. model.data.tableInfo.db_type = dbType;
  7988. model.data.tableInfo.column_list = [];
  7989. model.data.tableInfo.is_create = true;
  7990. return model;
  7991. }
  7992. var tableRow = instance$1.getTableByName(schemaName, tableName);
  7993. if (!tableRow) {
  7994. throw Error('没有找到 table' + schemaName + tableName + columnName);
  7995. }
  7996. model.data.tableInfo = _$2.cloneDeep(tableRow);
  7997. model.data.tableInfo.is_create = false;
  7998. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  7999. return model;
  8000. }
  8001. //# sourceMappingURL=DbColumn.js.map
  8002. var model$6 = {
  8003. data: {
  8004. id: '',
  8005. path: '',
  8006. form: {
  8007. title: '',
  8008. sqlId: '',
  8009. }
  8010. }
  8011. };
  8012. //# sourceMappingURL=WidgetDesign.model.js.map
  8013. var vjson$6 = {
  8014. bind: {
  8015. title: '{title}',
  8016. },
  8017. layout: 'fit',
  8018. items: [
  8019. {
  8020. layout: 'border',
  8021. items: [
  8022. {
  8023. region: 'center',
  8024. layout: 'border',
  8025. items: [
  8026. {
  8027. region: 'north',
  8028. items: [
  8029. {
  8030. xtype: 'toolbar',
  8031. border: false,
  8032. items: [
  8033. {
  8034. xtype: 'button',
  8035. text: '刷新',
  8036. iconCls: 'x-fa fa-refresh',
  8037. listeners: {
  8038. click: 'scope.load'
  8039. }
  8040. },
  8041. {
  8042. xtype: 'button',
  8043. text: '保存',
  8044. iconCls: 'x-fa fa-save',
  8045. listeners: {
  8046. click: 'scope.widgetSave'
  8047. }
  8048. },
  8049. {
  8050. xtype: 'button',
  8051. text: '预览',
  8052. iconCls: 'x-fa fa-play-circle-o',
  8053. listeners: {
  8054. //click: 'scope.preview'
  8055. }
  8056. },
  8057. {
  8058. xtype: 'textfield',
  8059. fieldLabel: '弹窗文件',
  8060. reference: "wPath",
  8061. labelWidth: 80,
  8062. //width: 200,
  8063. bind: {
  8064. value: '{widgetPath}',
  8065. },
  8066. readOnly: true,
  8067. },
  8068. {
  8069. xtype: 'textfield',
  8070. fieldLabel: '弹窗名称',
  8071. reference: "wTitle",
  8072. labelWidth: 80,
  8073. //width: 200,
  8074. bind: {
  8075. value: '{form.title}',
  8076. },
  8077. readOnly: true,
  8078. },
  8079. {
  8080. xtype: 'textfield',
  8081. fieldLabel: 'sqlId',
  8082. bind: {
  8083. value: '{form.sqlId}',
  8084. },
  8085. readOnly: true,
  8086. },
  8087. ]
  8088. },
  8089. ]
  8090. },
  8091. {
  8092. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8093. items: [
  8094. {
  8095. title: "SQL和条件",
  8096. layout: 'border',
  8097. border: false,
  8098. items: [
  8099. {
  8100. region: 'north',
  8101. height: 200,
  8102. xtype: 'yvgrid',
  8103. reference: "grid2",
  8104. split: true,
  8105. selModel: {
  8106. selType: 'rowmodel',
  8107. mode: 'SINGLE',
  8108. },
  8109. store: {},
  8110. pagination: false,
  8111. hideFootbar: true,
  8112. tbar: {
  8113. xtype: 'toolbar',
  8114. items: [
  8115. {
  8116. xtype: 'button',
  8117. text: '添加',
  8118. iconCls: 'x-fa fa-plus-circle',
  8119. listeners: {}
  8120. },
  8121. {
  8122. xtype: 'button',
  8123. text: '删除',
  8124. iconCls: 'x-fa fa-minus-circle',
  8125. listeners: {
  8126. click: 'scope.delCondition'
  8127. }
  8128. },
  8129. '-',
  8130. {
  8131. xtype: 'button',
  8132. text: '上移',
  8133. iconCls: 'x-fa fa-refresh',
  8134. listeners: {
  8135. //click: 'scope.saveAll'
  8136. }
  8137. },
  8138. {
  8139. xtype: 'button',
  8140. text: '下移',
  8141. iconCls: 'x-fa fa-refresh',
  8142. listeners: {
  8143. //click: 'scope.saveAll'
  8144. }
  8145. },
  8146. '-',
  8147. {
  8148. xtype: 'button',
  8149. text: '自动分析',
  8150. iconCls: 'x-fa fa-refresh',
  8151. listeners: {
  8152. click: 'scope.calcCondition'
  8153. }
  8154. },
  8155. ]
  8156. },
  8157. columns: [
  8158. {
  8159. text: '条件变量',
  8160. dataIndex: 'conditionFieldBind',
  8161. width: 140,
  8162. sortable: false,
  8163. menuDisabled: true,
  8164. editor: {
  8165. selectOnFocus: true
  8166. },
  8167. },
  8168. {
  8169. text: '中文标题',
  8170. dataIndex: 'conditionFieldLabel',
  8171. width: 120,
  8172. sortable: false,
  8173. menuDisabled: true,
  8174. editor: {
  8175. selectOnFocus: true
  8176. },
  8177. },
  8178. {
  8179. text: '编辑类型',
  8180. dataIndex: 'xtype',
  8181. sortable: false,
  8182. menuDisabled: true,
  8183. editor: {
  8184. xtype: 'combo',
  8185. typeAhead: true,
  8186. triggerAction: 'all',
  8187. selectOnFocus: true,
  8188. store: [
  8189. ['textfield', 'textfield'],
  8190. ['combo', 'combo'],
  8191. ['datefield', 'datefield'],
  8192. ['datetimefield', 'datetimefield'],
  8193. ['numberfield', 'numberfield'],
  8194. ['multiplesearch', 'multiplesearch'],
  8195. ]
  8196. }
  8197. },
  8198. {
  8199. text: '权重',
  8200. dataIndex: 'conditionFieldFlex',
  8201. align: 'right',
  8202. sortable: false,
  8203. menuDisabled: true,
  8204. editor: {
  8205. xtype: 'numberfield',
  8206. selectOnFocus: false,
  8207. minValue: 0,
  8208. maxValue: 10
  8209. },
  8210. },
  8211. {
  8212. text: '字典',
  8213. dataIndex: 'conditionFieldDict',
  8214. width: 160,
  8215. sortable: false,
  8216. menuDisabled: true,
  8217. editor: {
  8218. selectOnFocus: false
  8219. },
  8220. },
  8221. {
  8222. xtype: 'checkcolumn',
  8223. dataIndex: "conditionFieldWrap", header: "换行",
  8224. width: 65,
  8225. sortable: false,
  8226. menuDisabled: true,
  8227. },
  8228. ]
  8229. },
  8230. {
  8231. region: 'center',
  8232. xtype: 'sqleditor',
  8233. layout: 'fit',
  8234. reference: 'sqlEditor',
  8235. split: true,
  8236. bind: {
  8237. value: "{form.sql}"
  8238. },
  8239. },
  8240. ]
  8241. },
  8242. {
  8243. title: "结果字段定义",
  8244. border: false,
  8245. xtype: 'yvgrid',
  8246. reference: "grid3",
  8247. selModel: {
  8248. selType: 'rowmodel',
  8249. mode: 'SINGLE',
  8250. },
  8251. store: {},
  8252. pagination: false,
  8253. hideFootbar: true,
  8254. tbar: {
  8255. xtype: 'toolbar',
  8256. items: [
  8257. {
  8258. xtype: 'button',
  8259. text: '添加',
  8260. iconCls: 'x-fa fa-plus-circle',
  8261. listeners: {}
  8262. },
  8263. {
  8264. xtype: 'button',
  8265. text: '删除',
  8266. iconCls: 'x-fa fa-minus-circle',
  8267. listeners: {
  8268. click: 'scope.delColumn'
  8269. }
  8270. },
  8271. '-',
  8272. {
  8273. xtype: 'button',
  8274. text: '上移',
  8275. iconCls: 'x-fa fa-refresh',
  8276. listeners: {
  8277. //click: 'scope.saveAll'
  8278. }
  8279. },
  8280. {
  8281. xtype: 'button',
  8282. text: '下移',
  8283. iconCls: 'x-fa fa-refresh',
  8284. listeners: {
  8285. //click: 'scope.saveAll'
  8286. }
  8287. },
  8288. '-',
  8289. {
  8290. xtype: 'button',
  8291. text: '自动分析',
  8292. iconCls: 'x-fa fa-refresh',
  8293. listeners: {
  8294. click: 'scope.calcColumn'
  8295. }
  8296. },
  8297. ]
  8298. },
  8299. columns: [
  8300. { xtype: 'rownumberer' },
  8301. {
  8302. text: '字段',
  8303. dataIndex: 'dataIndex',
  8304. width: 140,
  8305. sortable: false,
  8306. menuDisabled: true,
  8307. editor: {
  8308. selectOnFocus: true
  8309. },
  8310. },
  8311. {
  8312. text: '标题',
  8313. dataIndex: 'header',
  8314. width: 120,
  8315. sortable: false,
  8316. menuDisabled: true,
  8317. editor: {
  8318. selectOnFocus: true
  8319. },
  8320. },
  8321. {
  8322. text: '显示类型',
  8323. dataIndex: 'xtype',
  8324. width: 90,
  8325. sortable: false,
  8326. menuDisabled: true,
  8327. editor: {
  8328. xtype: 'combo',
  8329. typeAhead: true,
  8330. triggerAction: 'all',
  8331. selectOnFocus: true,
  8332. store: [
  8333. ['', ''],
  8334. ['rownum', 'rownum'],
  8335. ['button', 'button'],
  8336. ['checkbox', 'checkbox'],
  8337. ['progres', 'progres'],
  8338. ]
  8339. }
  8340. },
  8341. {
  8342. text: '数据类型',
  8343. dataIndex: 'dataType',
  8344. width: 90,
  8345. sortable: false,
  8346. menuDisabled: true,
  8347. editor: {
  8348. xtype: 'combo',
  8349. typeAhead: true,
  8350. triggerAction: 'all',
  8351. selectOnFocus: true,
  8352. store: [
  8353. ['', ''],
  8354. ['string', 'string'],
  8355. ['number', 'number'],
  8356. ['date', 'date'],
  8357. ]
  8358. }
  8359. },
  8360. {
  8361. text: '数据字典',
  8362. dataIndex: 'dict',
  8363. sortable: false,
  8364. menuDisabled: true,
  8365. width: 120,
  8366. editor: {
  8367. selectOnFocus: true,
  8368. },
  8369. },
  8370. ],
  8371. },
  8372. ]
  8373. },
  8374. ]
  8375. },
  8376. ]
  8377. }
  8378. ]
  8379. }; //
  8380. //
  8381. //# sourceMappingURL=WidgetDesign.view.js.map
  8382. var WidgetDesign = /** @class */ (function (_super) {
  8383. __extends(WidgetDesign, _super);
  8384. function WidgetDesign(widgetPath, widgetName) {
  8385. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8386. _this.widgetPath = widgetPath;
  8387. _this.widgetName = widgetName;
  8388. return _this;
  8389. }
  8390. WidgetDesign.prototype.onLoad = function () {
  8391. if (this.widgetPath) {
  8392. this.loadForm(this.widgetPath);
  8393. this.viewModel.set("widgetPath", this.widgetPath);
  8394. this.refs.wTitle.setReadOnly(true);
  8395. this.refs.wPath.setReadOnly(true);
  8396. }
  8397. else {
  8398. this.refs.wTitle.setReadOnly(false);
  8399. this.refs.wPath.setReadOnly(false);
  8400. }
  8401. };
  8402. WidgetDesign.prototype.load = function () {
  8403. var widgetPath = this.viewModel.get("widgetPath");
  8404. if (widgetPath) {
  8405. this.loadForm(widgetPath);
  8406. }
  8407. };
  8408. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8409. var _this = this;
  8410. var me = this;
  8411. me.setLoading(true);
  8412. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8413. msg$1(res.msg);
  8414. if (res.success) {
  8415. _this.viewModel.set("widgetPath", widgetPath);
  8416. me.refs.grid3.getStore().removeAll();
  8417. if (res.data.form.columns) {
  8418. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8419. }
  8420. _this.viewModel.set("form.title", res.data.form.title);
  8421. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8422. // set sql
  8423. _this.refs.sqlEditor.setCode(res.data.sql);
  8424. }
  8425. }).finally(function () {
  8426. me.setLoading(false);
  8427. });
  8428. };
  8429. WidgetDesign.prototype.widgetAdd = function (sender) {
  8430. var _this = this;
  8431. var title = this.viewModel.get("form.title");
  8432. if (title) {
  8433. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8434. if (btn == 'yes') {
  8435. alert(1);
  8436. }
  8437. else {
  8438. alert(2);
  8439. }
  8440. });
  8441. }
  8442. else {
  8443. var me_1 = this;
  8444. var win_1 = new Ext.Window({
  8445. autoDestroy: true,
  8446. title: "新建弹框",
  8447. width: 400,
  8448. height: 220,
  8449. resizable: true,
  8450. closable: true,
  8451. maximizable: true,
  8452. minimizable: true,
  8453. plain: true,
  8454. // constrainHeader: true,
  8455. constrain: true,
  8456. layout: 'fit',
  8457. animateTarget: sender,
  8458. buttonAlign: 'center',
  8459. items: [
  8460. {
  8461. xtype: "form",
  8462. layout: "hbox",
  8463. margin: '10px 20px',
  8464. border: 0,
  8465. items: [
  8466. {
  8467. flex: 1,
  8468. layout: 'vbox',
  8469. items: [
  8470. {
  8471. xtype: "textfield",
  8472. name: "widgetcode",
  8473. fieldLabel: "弹框编号",
  8474. flex: 1,
  8475. allowBlank: false,
  8476. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8477. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8478. labelWidth: 50,
  8479. width: "100%",
  8480. },
  8481. {
  8482. xtype: "textfield",
  8483. name: "widgetname",
  8484. fieldLabel: "弹框名称",
  8485. flex: 1,
  8486. allowBlank: false,
  8487. labelWidth: 50,
  8488. width: "100%",
  8489. },
  8490. ]
  8491. },
  8492. ]
  8493. }
  8494. ],
  8495. //窗口按钮
  8496. buttons: [
  8497. {
  8498. xtype: 'button', text: '保存', handler: function (btn) {
  8499. //窗口获取表单
  8500. var form = win_1.down('form');
  8501. var vaildSuccess = form.isValid();
  8502. if (!vaildSuccess) {
  8503. return;
  8504. }
  8505. var title = form.down('textfield[name="widgetname"]').getValue();
  8506. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8507. me_1.viewModel.set("form.title", title);
  8508. me_1.viewModel.set("widgetPath", widgetPath);
  8509. var formdata = _this.viewModel.get("form");
  8510. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8511. if (res.success) {
  8512. msg$1('添加成功');
  8513. }
  8514. me_1.loadForm(widgetPath);
  8515. win_1.close();
  8516. });
  8517. }
  8518. },
  8519. {
  8520. xtype: 'button', text: '取消', handler: function (btn) {
  8521. //窗口关闭
  8522. win_1.close();
  8523. }
  8524. }
  8525. ]
  8526. });
  8527. win_1.show();
  8528. }
  8529. };
  8530. WidgetDesign.prototype.widgetSave = function () {
  8531. var _this = this;
  8532. var _a, _b;
  8533. var widgetPath = this.viewModel.get("widgetPath");
  8534. if (!widgetPath) {
  8535. msg$1("请选择或添加弹框后再保存!");
  8536. return;
  8537. }
  8538. var title = this.viewModel.get("form.title");
  8539. if (!title) {
  8540. msg$1("请选择或添加弹框后再保存!");
  8541. return;
  8542. }
  8543. // 获取条件
  8544. 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) {
  8545. delete r.id;
  8546. return r;
  8547. });
  8548. this.viewModel.set("form.conditions", conditions);
  8549. // 获取查询列
  8550. 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) {
  8551. delete r.id;
  8552. if (r.dict) {
  8553. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8554. }
  8555. return r;
  8556. });
  8557. this.viewModel.set("form.columns", columns);
  8558. // sql
  8559. var sql = this.refs.sqlEditor.getCode();
  8560. this.viewModel.set("form.sql", sql);
  8561. var form = this.viewModel.get("form");
  8562. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8563. msg$1(res.msg);
  8564. if (res.success) {
  8565. msg$1('保存成功');
  8566. _this.loadForm(widgetPath);
  8567. }
  8568. }).catch(function (res) {
  8569. });
  8570. };
  8571. WidgetDesign.prototype.delCondition = function () {
  8572. var _a;
  8573. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8574. };
  8575. WidgetDesign.prototype.delColumn = function () {
  8576. var _a;
  8577. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8578. };
  8579. WidgetDesign.prototype.calcCondition = function () {
  8580. var _this = this;
  8581. var sql = this.refs.sqlEditor.getCode();
  8582. var re = sql.matchAll(/#{(.+?)}/gi);
  8583. var rows = this.refs.grid2.getDataRows();
  8584. this.refs.grid2.setLoading(true);
  8585. parseDynamicSqlApi(sql).then(function (res) {
  8586. var e_1, _a;
  8587. if (res.success) {
  8588. var tables_1 = [];
  8589. _.forEach(res.data, function (parseItem) {
  8590. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8591. if (tableName && !_.includes(tables_1, tableName)) {
  8592. tables_1.push(tableName);
  8593. }
  8594. });
  8595. var _loop_1 = function (m) {
  8596. var e_2, _a;
  8597. var columnName = m[1];
  8598. // 没有这个列才添加
  8599. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8600. var meta = undefined;
  8601. try {
  8602. 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()) {
  8603. var tableName = tables_2_1.value;
  8604. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8605. if (meta) {
  8606. break;
  8607. }
  8608. }
  8609. }
  8610. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8611. finally {
  8612. try {
  8613. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  8614. }
  8615. finally { if (e_2) throw e_2.error; }
  8616. }
  8617. if (meta) {
  8618. // 没找到元数据,直接添加
  8619. _this.refs.grid2.appendEditRow({
  8620. conditionFieldBind: columnName,
  8621. conditionFieldLabel: meta.column_comment,
  8622. conditionFieldXtype: 'textfield',
  8623. conditionFieldFlex: 1,
  8624. conditionFieldDict: '',
  8625. conditionFieldWrap: false,
  8626. });
  8627. }
  8628. else {
  8629. _this.refs.grid2.appendEditRow({
  8630. conditionFieldBind: columnName,
  8631. conditionFieldLabel: '',
  8632. conditionFieldXtype: 'textfield',
  8633. conditionFieldFlex: 1,
  8634. conditionFieldDict: '',
  8635. conditionFieldWrap: false,
  8636. });
  8637. }
  8638. }
  8639. };
  8640. try {
  8641. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  8642. var m = re_1_1.value;
  8643. _loop_1(m);
  8644. }
  8645. }
  8646. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  8647. finally {
  8648. try {
  8649. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  8650. }
  8651. finally { if (e_1) throw e_1.error; }
  8652. }
  8653. }
  8654. }).finally(function () {
  8655. _this.refs.grid2.setLoading(false);
  8656. });
  8657. };
  8658. WidgetDesign.prototype.calcColumn = function () {
  8659. var _this = this;
  8660. var sql = this.refs.sqlEditor.getCode();
  8661. var rows = this.refs.grid3.getDataRows();
  8662. this.refs.grid3.setLoading(true);
  8663. parseDynamicSqlApi(sql).then(function (res) {
  8664. _.forEach(res.data, function (parseItem) {
  8665. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  8666. // 是否找到重复字段
  8667. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  8668. if (exists) {
  8669. return;
  8670. }
  8671. if (tableName) {
  8672. // 解出表格名和字段名
  8673. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8674. if (meta) {
  8675. // 找到了元数据
  8676. var r = {
  8677. dataIndex: meta.column_name,
  8678. header: meta.column_comment,
  8679. xtype: '',
  8680. dataType: 'string',
  8681. dict: '',
  8682. };
  8683. if (meta.column_ui === 'combo' && meta.column_dict) {
  8684. r.dict = meta.column_dict;
  8685. }
  8686. else if (meta.column_ui === "checkbox") {
  8687. r.xtype = 'checkbox';
  8688. }
  8689. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  8690. r.dataType = meta.data_type;
  8691. }
  8692. _this.refs.grid3.appendEditRow(r);
  8693. return;
  8694. }
  8695. }
  8696. if (columnName) {
  8697. // 解出字段名
  8698. var r = {
  8699. dataIndex: columnName,
  8700. header: columnName,
  8701. xtype: '',
  8702. dataType: 'string',
  8703. dict: '',
  8704. };
  8705. _this.refs.grid3.appendEditRow(r);
  8706. }
  8707. });
  8708. }).finally(function () {
  8709. _this.refs.grid3.setLoading(false);
  8710. });
  8711. };
  8712. return WidgetDesign;
  8713. }(Scope));
  8714. //# sourceMappingURL=WidgetDesign.js.map
  8715. var model$7 = {
  8716. data: {
  8717. // spreadsheet: false,
  8718. // multSelect: false,
  8719. // showCheckColumn: false,
  8720. // checkColumncheckOnly: false,
  8721. // disableSelection: false,
  8722. vjson: {
  8723. reference: '',
  8724. pagination: false,
  8725. pageSize: false,
  8726. pageSizeOption: false,
  8727. hideFootbar: false,
  8728. hideRefresh: false,
  8729. hideExport: false,
  8730. hideAutoSize: false,
  8731. hideClearFilter: false,
  8732. hideSaveGridUIConfig: false,
  8733. hideClearGridUIConfig: false,
  8734. selectMode: '',
  8735. cellediting_clicksToEdit: 1,
  8736. columnLines: false,
  8737. rowLines: false,
  8738. border: false,
  8739. autoLoad: false,
  8740. remoteSort: false,
  8741. remoteFilter: false,
  8742. enableLocking: false,
  8743. enableColumnHide: false,
  8744. enableColumnMove: false,
  8745. gridfilters: false,
  8746. enableColumnResize: false,
  8747. sortOnClick: false,
  8748. hidden: false,
  8749. cls: '',
  8750. dataSource: {
  8751. url: '',
  8752. params: {
  8753. formData: '{form}',
  8754. },
  8755. },
  8756. listeners: {
  8757. beforeselect: '',
  8758. selectionchange: '',
  8759. itemclick: '',
  8760. itemdblclick: '',
  8761. cellClick: '',
  8762. celldblclick: '',
  8763. afterrender: '',
  8764. destory: '',
  8765. }
  8766. },
  8767. }
  8768. };
  8769. //# sourceMappingURL=YvgridDesign.model.js.map
  8770. var vjson$7 = {
  8771. title: '表格-高级',
  8772. height: 450,
  8773. width: 970,
  8774. layout: 'fit',
  8775. modal: true,
  8776. items: [
  8777. {
  8778. xtype: 'tabpanel',
  8779. items: [
  8780. {
  8781. title: '属性',
  8782. xtype: 'form',
  8783. scrollable: true,
  8784. items: [
  8785. {
  8786. xtype: 'cols',
  8787. items: [
  8788. {
  8789. xtype: 'textfield',
  8790. fieldLabel: '引用名',
  8791. tooltip: 'reference',
  8792. bind: '{vjson.reference}',
  8793. },
  8794. ]
  8795. },
  8796. {
  8797. xtype: 'cols',
  8798. border: false,
  8799. items: [
  8800. // 允许分页、页大小、页大小选项
  8801. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  8802. // 多选、显示勾选、自动勾选、
  8803. // 单击编辑、列分割线、行分割线、边框
  8804. // 数据源自动加载、后端排序、后端过滤
  8805. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  8806. {
  8807. xtype: 'checkbox',
  8808. fieldLabel: '允许分页',
  8809. bind: {
  8810. value: "{vjson.pagination}"
  8811. }
  8812. },
  8813. {
  8814. xtype: 'numberfield',
  8815. fieldLabel: '页大小',
  8816. bind: '{vjson.pageSize}',
  8817. },
  8818. {
  8819. xtype: 'textfield',
  8820. fieldLabel: '页大小选项',
  8821. flex: 2,
  8822. bind: '{vjson.pageSizeOption}',
  8823. },
  8824. ]
  8825. },
  8826. {
  8827. layout: 'hbox',
  8828. border: false,
  8829. items: [
  8830. {
  8831. xtype: 'combo',
  8832. fieldLabel: '选择模式',
  8833. flex: 4,
  8834. data: [
  8835. { id: 'spreadsheet', text: 'Excel模式' },
  8836. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  8837. { id: 'checkColumn', text: '勾选框' },
  8838. { id: 'row_mulity', text: '行选择-允许多选' },
  8839. { id: 'row_single', text: '行选择-单选' },
  8840. { id: 'disableSelection', text: '禁用' },
  8841. ],
  8842. bind: {
  8843. value: '{vjson.selectMode}'
  8844. }
  8845. }
  8846. ]
  8847. },
  8848. {
  8849. layout: 'hbox',
  8850. border: false,
  8851. defaults: {
  8852. xtype: 'checkbox',
  8853. margin: '0 15 0 0',
  8854. },
  8855. items: [
  8856. {
  8857. xtype: 'container',
  8858. margin: '3',
  8859. border: false,
  8860. width: 80,
  8861. },
  8862. {
  8863. boxLabel: '隐藏底部',
  8864. bind: {
  8865. value: "{vjson.hideFootbar}"
  8866. }
  8867. },
  8868. {
  8869. boxLabel: '隐藏刷新',
  8870. bind: {
  8871. value: "{vjson.hideRefresh}"
  8872. }
  8873. },
  8874. {
  8875. boxLabel: '隐藏导出',
  8876. bind: {
  8877. value: "{vjson.hideExport}"
  8878. }
  8879. },
  8880. {
  8881. boxLabel: '隐藏自动调宽',
  8882. bind: {
  8883. value: "{vjson.hideAutoSize}"
  8884. }
  8885. },
  8886. {
  8887. boxLabel: '隐藏清空筛选',
  8888. bind: {
  8889. value: "{vjson.hideClearFilter}"
  8890. }
  8891. },
  8892. {
  8893. boxLabel: '隐藏保存布局',
  8894. bind: {
  8895. value: "{vjson.hideSaveGridUIConfig}"
  8896. }
  8897. },
  8898. {
  8899. boxLabel: '隐藏重置布局',
  8900. bind: {
  8901. value: "{vjson.hideClearGridUIConfig}"
  8902. }
  8903. },
  8904. ]
  8905. },
  8906. {
  8907. layout: 'hbox',
  8908. border: false,
  8909. defaults: {
  8910. xtype: 'checkbox',
  8911. margin: '0 15 0 0',
  8912. },
  8913. items: [
  8914. {
  8915. xtype: 'container',
  8916. margin: '3',
  8917. border: false,
  8918. width: 80
  8919. },
  8920. {
  8921. boxLabel: '单击编辑',
  8922. bind: {
  8923. value: "{vjson.cellediting_clicksToEdit}"
  8924. }
  8925. },
  8926. {
  8927. boxLabel: '列分隔线',
  8928. bind: {
  8929. value: "{vjson.columnLines}"
  8930. }
  8931. },
  8932. {
  8933. boxLabel: '行分隔线',
  8934. bind: {
  8935. value: "{vjson.rowLines}"
  8936. }
  8937. },
  8938. {
  8939. boxLabel: '边框',
  8940. bind: {
  8941. value: "{vjson.border}"
  8942. }
  8943. },
  8944. ]
  8945. },
  8946. {
  8947. layout: 'hbox',
  8948. border: false,
  8949. defaults: {
  8950. xtype: 'checkbox',
  8951. margin: '0 15 0 0',
  8952. },
  8953. items: [
  8954. {
  8955. xtype: 'container',
  8956. margin: '3',
  8957. border: false,
  8958. width: 80
  8959. },
  8960. {
  8961. boxLabel: '数据源自动加载',
  8962. bind: {
  8963. value: "{vjson.autoLoad}"
  8964. }
  8965. },
  8966. {
  8967. boxLabel: '后端排序',
  8968. bind: {
  8969. value: "{vjson.remoteSort}"
  8970. }
  8971. },
  8972. {
  8973. boxLabel: '后端过滤',
  8974. bind: {
  8975. value: "{vjson.remoteFilter}"
  8976. }
  8977. },
  8978. ]
  8979. },
  8980. {
  8981. layout: 'hbox',
  8982. border: false,
  8983. defaults: {
  8984. xtype: 'checkbox',
  8985. margin: '0 15 0 0',
  8986. },
  8987. items: [
  8988. {
  8989. xtype: 'container',
  8990. margin: '3',
  8991. border: false,
  8992. width: 80
  8993. },
  8994. {
  8995. boxLabel: '自定义锁定',
  8996. bind: {
  8997. value: "{vjson.enableLocking}"
  8998. }
  8999. },
  9000. {
  9001. boxLabel: '自定义隐藏',
  9002. bind: {
  9003. value: "{vjson.enableColumnHide}"
  9004. }
  9005. },
  9006. {
  9007. boxLabel: '用户拖拽字段',
  9008. bind: {
  9009. value: "{vjson.enableColumnMove}"
  9010. }
  9011. },
  9012. {
  9013. boxLabel: '自定义筛选',
  9014. bind: {
  9015. value: "{vjson.gridfilters}"
  9016. }
  9017. },
  9018. {
  9019. boxLabel: '用户拖拽字段宽度',
  9020. bind: {
  9021. value: "{vjson.enableColumnResize}"
  9022. }
  9023. },
  9024. {
  9025. boxLabel: '点击列头排序',
  9026. bind: {
  9027. value: "{vjson.sortOnClick}"
  9028. }
  9029. },
  9030. {
  9031. xtype: 'checkbox',
  9032. boxLabel: '隐藏',
  9033. bind: {
  9034. value: "{vjson.hidden}"
  9035. }
  9036. },
  9037. ]
  9038. },
  9039. {
  9040. xtype: 'cols',
  9041. items: [
  9042. {
  9043. xtype: 'textfield',
  9044. fieldLabel: '样式',
  9045. bind: '{vjson.cls}',
  9046. flex: 4
  9047. },
  9048. ]
  9049. },
  9050. ]
  9051. },
  9052. {
  9053. title: '字段',
  9054. xtype: 'yvgrid',
  9055. reference: 'grid1',
  9056. pagination: false,
  9057. hideFootbar: true,
  9058. plugins: {
  9059. clipboard: true,
  9060. selectionreplicator: true
  9061. },
  9062. selModel: {
  9063. type: 'spreadsheet',
  9064. columnSelect: true,
  9065. pruneRemoved: false,
  9066. extensible: 'y'
  9067. },
  9068. listeners: {
  9069. editfinish: 'scope.gridEditFinish',
  9070. },
  9071. tbar: {
  9072. xtype: 'toolbar',
  9073. items: [
  9074. {
  9075. xtype: 'button',
  9076. text: '添加',
  9077. iconCls: 'x-fa fa-plus-circle',
  9078. listeners: {
  9079. click: 'scope.addColumn'
  9080. }
  9081. },
  9082. {
  9083. xtype: 'button',
  9084. text: '删除',
  9085. iconCls: 'x-fa fa-minus-circle',
  9086. listeners: {
  9087. click: 'scope.removeColumn'
  9088. }
  9089. },
  9090. '-',
  9091. {
  9092. xtype: 'button',
  9093. text: '自动分析',
  9094. iconCls: 'x-fa fa-code-fork',
  9095. listeners: {
  9096. click: 'scope.calcColumn'
  9097. }
  9098. },
  9099. {
  9100. xtype: 'button',
  9101. text: '上移',
  9102. iconCls: 'x-fa fa-arrow-up',
  9103. listeners: {
  9104. click: 'scope.moveUp'
  9105. }
  9106. },
  9107. {
  9108. xtype: 'button',
  9109. text: '下移',
  9110. iconCls: 'x-fa fa-arrow-down',
  9111. listeners: {
  9112. click: 'scope.moveDown'
  9113. }
  9114. },
  9115. ]
  9116. },
  9117. columns: [
  9118. { xtype: 'rownumberer' },
  9119. {
  9120. text: '字段',
  9121. dataIndex: 'dataIndex',
  9122. width: 140,
  9123. sortable: false,
  9124. menuDisabled: true,
  9125. editor: {
  9126. selectOnFocus: true,
  9127. },
  9128. },
  9129. {
  9130. text: '标题',
  9131. dataIndex: 'header',
  9132. width: 120,
  9133. sortable: false,
  9134. menuDisabled: true,
  9135. editor: {
  9136. selectOnFocus: true,
  9137. },
  9138. },
  9139. {
  9140. text: '类型',
  9141. dataIndex: 'xtype',
  9142. width: 100,
  9143. sortable: false,
  9144. menuDisabled: true,
  9145. editor: {
  9146. xtype: 'combo',
  9147. typeAhead: true,
  9148. triggerAction: 'all',
  9149. selectOnFocus: false,
  9150. listConfig: {
  9151. minWidth: 200
  9152. },
  9153. store: [
  9154. ['', '默认'],
  9155. ['rownum', 'rownum'],
  9156. ['checkcolumn', 'checkcolumn'],
  9157. ]
  9158. },
  9159. },
  9160. {
  9161. text: '数据类型',
  9162. dataIndex: 'dataType',
  9163. width: 100,
  9164. sortable: false,
  9165. menuDisabled: true,
  9166. editor: {
  9167. xtype: 'combo',
  9168. selectOnFocus: true,
  9169. listConfig: {
  9170. minWidth: 200
  9171. },
  9172. store: [
  9173. ['', '默认'],
  9174. ['string', 'string'],
  9175. ['number', 'number'],
  9176. ['date', 'date'],
  9177. ]
  9178. },
  9179. },
  9180. {
  9181. text: '编辑模式',
  9182. dataIndex: 'editor',
  9183. width: 100,
  9184. sortable: false,
  9185. menuDisabled: true,
  9186. editor: {
  9187. xtype: 'combo',
  9188. selectOnFocus: true,
  9189. listConfig: {
  9190. minWidth: 200
  9191. },
  9192. store: [
  9193. ['', ''],
  9194. ['textfield', 'textfield'],
  9195. ['numberfield', 'numberfield'],
  9196. ['combo', 'combo'],
  9197. ['combogrid', 'combogrid'],
  9198. ['datefield', 'datefield'],
  9199. ]
  9200. },
  9201. },
  9202. {
  9203. text: '宽度',
  9204. dataIndex: 'width',
  9205. align: 'right',
  9206. width: 100,
  9207. sortable: false,
  9208. menuDisabled: true,
  9209. editor: {
  9210. xtype: 'numberfield',
  9211. selectOnFocus: true,
  9212. minValue: 0,
  9213. maxValue: 1000
  9214. },
  9215. },
  9216. {
  9217. text: '权重',
  9218. dataIndex: 'flex',
  9219. align: 'right',
  9220. width: 90,
  9221. sortable: false,
  9222. menuDisabled: true,
  9223. editor: {
  9224. xtype: 'numberfield',
  9225. selectOnFocus: true,
  9226. minValue: 0,
  9227. maxValue: 10
  9228. },
  9229. },
  9230. {
  9231. text: '字典',
  9232. dataIndex: 'dict',
  9233. sortable: false,
  9234. menuDisabled: true,
  9235. width: 210,
  9236. editor: {
  9237. selectOnFocus: true,
  9238. },
  9239. },
  9240. {
  9241. text: '对齐',
  9242. dataIndex: 'align',
  9243. width: 90,
  9244. sortable: false,
  9245. menuDisabled: true,
  9246. editor: {
  9247. xtype: 'combo',
  9248. selectOnFocus: true,
  9249. listConfig: {
  9250. minWidth: 120
  9251. },
  9252. store: [
  9253. ['start', 'start'],
  9254. ['center', 'center'],
  9255. ['end', 'end'],
  9256. ]
  9257. },
  9258. },
  9259. {
  9260. text: '必填',
  9261. dataIndex: 'notAllowBlank',
  9262. width: 50,
  9263. resizable: false,
  9264. sortable: false,
  9265. menuDisabled: true,
  9266. xtype: 'checkcolumn',
  9267. },
  9268. {
  9269. text: '禁用',
  9270. dataIndex: 'disabled',
  9271. width: 50,
  9272. resizable: false,
  9273. sortable: false,
  9274. menuDisabled: true,
  9275. xtype: 'checkcolumn',
  9276. },
  9277. {
  9278. text: '禁菜',
  9279. dataIndex: 'menuDisabled',
  9280. width: 50,
  9281. resizable: false,
  9282. sortable: false,
  9283. menuDisabled: true,
  9284. xtype: 'checkcolumn',
  9285. },
  9286. {
  9287. text: '过滤',
  9288. dataIndex: 'filterable',
  9289. xtype: 'checkcolumn',
  9290. width: 50,
  9291. resizable: false,
  9292. sortable: false,
  9293. menuDisabled: true,
  9294. },
  9295. {
  9296. text: '隐藏',
  9297. dataIndex: 'hidden',
  9298. xtype: 'checkcolumn',
  9299. width: 50,
  9300. resizable: false,
  9301. sortable: false,
  9302. menuDisabled: true,
  9303. },
  9304. {
  9305. text: '可隐',
  9306. dataIndex: 'hideable',
  9307. xtype: 'checkcolumn',
  9308. width: 50,
  9309. resizable: false,
  9310. sortable: false,
  9311. menuDisabled: true,
  9312. },
  9313. {
  9314. text: '调宽',
  9315. dataIndex: 'resizable',
  9316. xtype: 'checkcolumn',
  9317. width: 50,
  9318. resizable: false,
  9319. sortable: false,
  9320. menuDisabled: true,
  9321. },
  9322. {
  9323. text: '排序',
  9324. dataIndex: 'sortable',
  9325. xtype: 'checkcolumn',
  9326. width: 50,
  9327. resizable: false,
  9328. sortable: false,
  9329. menuDisabled: true,
  9330. },
  9331. {
  9332. text: '适宽',
  9333. dataIndex: 'autoSize',
  9334. xtype: 'checkcolumn',
  9335. width: 50,
  9336. resizable: false,
  9337. sortable: false,
  9338. menuDisabled: true,
  9339. },
  9340. ],
  9341. },
  9342. {
  9343. title: '数据源',
  9344. layout: 'border',
  9345. listeners: {
  9346. activate: 'scope.dataSourceActivate'
  9347. },
  9348. items: [
  9349. {
  9350. region: 'north',
  9351. xtype: 'toolbar',
  9352. border: false,
  9353. items: [
  9354. {
  9355. xtype: 'textfield',
  9356. fieldLabel: '数据源',
  9357. flex: 1,
  9358. bind: {
  9359. value: '{vjson.dataSource.url}'
  9360. }
  9361. },
  9362. {
  9363. xtype: 'button',
  9364. text: '保存',
  9365. iconCls: 'x-fa fa-save',
  9366. listeners: {
  9367. click: 'scope.dataSourceSave'
  9368. }
  9369. },
  9370. {
  9371. xtype: 'button',
  9372. text: '读取',
  9373. iconCls: 'x-fa fa-folder-open',
  9374. listeners: {
  9375. click: 'scope.reloadSqlContent'
  9376. }
  9377. },
  9378. ]
  9379. },
  9380. {
  9381. region: 'center',
  9382. xtype: 'sqleditor',
  9383. layout: 'fit',
  9384. reference: 'sqlEditor',
  9385. },
  9386. {
  9387. region: 'south',
  9388. xtype: 'jsoneditor',
  9389. height: 200,
  9390. split: true,
  9391. collapsible: true,
  9392. title: '参数',
  9393. reference: 'sqlParams',
  9394. }
  9395. ]
  9396. },
  9397. {
  9398. title: '事件',
  9399. xtype: 'form',
  9400. scrollable: true,
  9401. margin: '10',
  9402. defaults: {
  9403. width: '100%',
  9404. labelAlign: 'top',
  9405. },
  9406. items: [
  9407. {
  9408. xtype: 'textfield',
  9409. fieldLabel: '选中前触发 beforeSelect',
  9410. bind: {
  9411. value: '{vjson.listeners.beforeselect}'
  9412. },
  9413. },
  9414. {
  9415. xtype: 'textfield',
  9416. fieldLabel: '选择范围改变 selectionChange',
  9417. bind: {
  9418. value: '{vjson.listeners.selectionchange}'
  9419. },
  9420. },
  9421. {
  9422. xtype: 'textfield',
  9423. fieldLabel: '行点击 itemClick',
  9424. bind: {
  9425. value: '{vjson.listeners.itemclick}'
  9426. },
  9427. },
  9428. {
  9429. xtype: 'textfield',
  9430. fieldLabel: '行双击 itemDblClick',
  9431. bind: {
  9432. value: '{vjson.listeners.itemdblclick}'
  9433. },
  9434. },
  9435. {
  9436. xtype: 'textfield',
  9437. fieldLabel: '单元格点击 cellClick',
  9438. bind: {
  9439. value: '{vjson.listeners.cellClick}'
  9440. },
  9441. },
  9442. {
  9443. xtype: 'textfield',
  9444. fieldLabel: '单元格双击 cellDblClick',
  9445. bind: {
  9446. value: '{vjson.listeners.celldblclick}'
  9447. },
  9448. },
  9449. {
  9450. xtype: 'textfield',
  9451. fieldLabel: '渲染后触发 afterrender',
  9452. bind: {
  9453. value: '{vjson.listeners.afterrender}'
  9454. },
  9455. },
  9456. {
  9457. xtype: 'textfield',
  9458. fieldLabel: '销毁后触发 destory',
  9459. bind: {
  9460. value: '{vjson.listeners.destory}'
  9461. },
  9462. },
  9463. ]
  9464. },
  9465. ],
  9466. }
  9467. ],
  9468. fbar: [
  9469. {
  9470. text: '应用', iconCls: 'x-fa fa-save',
  9471. listeners: {
  9472. click: 'scope.save'
  9473. }
  9474. },
  9475. '-',
  9476. {
  9477. text: '确定', iconCls: 'x-fa fa-check-circle',
  9478. listeners: {
  9479. click: 'scope.saveClose'
  9480. }
  9481. },
  9482. {
  9483. text: '取消', iconCls: 'x-fa fa-times-circle',
  9484. listeners: {
  9485. click: 'system.closeMe()'
  9486. }
  9487. },
  9488. ]
  9489. };
  9490. //# sourceMappingURL=YvgridDesign.view.js.map
  9491. var idPrefix = "_ds_";
  9492. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  9493. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  9494. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  9495. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  9496. var layoutOrXtypeNameMap = {
  9497. fit: 'fit布局',
  9498. border: 'border布局',
  9499. center: '中部',
  9500. north: '上部',
  9501. south: '下部',
  9502. west: '左部',
  9503. east: '右部',
  9504. yvgrid: '表格',
  9505. tree: '树',
  9506. tabpanel: '标签页',
  9507. form: '表单',
  9508. fieldset: '字段组',
  9509. tbar: '顶部工具栏',
  9510. fbar: '底部工具栏',
  9511. toolbar: '工具栏',
  9512. cols: '列容器',
  9513. rows: '行容器',
  9514. textfield: '文本框',
  9515. textareafield: '长文本框',
  9516. numberfield: '数字框',
  9517. label: "文本",
  9518. combo: "下拉框",
  9519. combobox: "下拉框",
  9520. combotree: "下拉树",
  9521. combogrid: "下拉表",
  9522. datefield: "日期框",
  9523. searchfield: "搜索框",
  9524. button: "按钮",
  9525. checkbox: "勾选",
  9526. checkboxgroup: "勾选组",
  9527. radio: "点选",
  9528. radiogroup: "点选组",
  9529. container: "占位"
  9530. };
  9531. /**
  9532. * 从 VJSON 中找到 rows/cols 的数组
  9533. */
  9534. function findArrayContainer(vjson, id) {
  9535. var parentVJson = getSuperVjson(vjson, id);
  9536. if (_$2.isArray(parentVJson)) {
  9537. return parentVJson;
  9538. }
  9539. if (parentVJson.hasOwnProperty('items')) {
  9540. return parentVJson.items;
  9541. }
  9542. }
  9543. /**
  9544. * 根据id查找上级vjson
  9545. * @param vjson 原始 vjson 视图
  9546. * @param targetId 子元素的id
  9547. */
  9548. function getSuperVjson(vjson, targetId) {
  9549. return deepTravFindSuper(vjson, vjson, targetId);
  9550. }
  9551. /**
  9552. * 根据id查找上级vjson id
  9553. * @param vjson 原始 vjson 视图
  9554. * @param targetId 子元素的id
  9555. */
  9556. function getSuperVjsonId(vjson, targetId) {
  9557. var vj = getSuperVjson(vjson, targetId);
  9558. return vj.id;
  9559. }
  9560. function deepTravFindSuper(superVjson, vjson, targetId) {
  9561. var rObj = null;
  9562. _$2.forOwn(vjson, function (value, key) {
  9563. if (rObj) {
  9564. return;
  9565. }
  9566. if (typeof value !== "object") {
  9567. return;
  9568. }
  9569. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  9570. if (key !== 'items') {
  9571. return;
  9572. }
  9573. }
  9574. else {
  9575. // 模型、数据、数据源不扫描
  9576. if (key === 'data' ||
  9577. key === 'dataSource' ||
  9578. key === 'suggest' ||
  9579. key === 'options' ||
  9580. key === 'config' ||
  9581. key === 'columns' ||
  9582. key === 'viewModel' ||
  9583. key === 'store') {
  9584. return;
  9585. }
  9586. }
  9587. //事件不扫描
  9588. if (key === "on" && _$2.isObject(value)) {
  9589. return;
  9590. }
  9591. if (key.startsWith("on") && _$2.size(key) > 2) {
  9592. return;
  9593. }
  9594. if (value.id === targetId) {
  9595. if (_$2.isArray(vjson)) {
  9596. rObj = superVjson;
  9597. }
  9598. else {
  9599. rObj = vjson;
  9600. }
  9601. return;
  9602. }
  9603. rObj = deepTravFindSuper(vjson, value, targetId);
  9604. });
  9605. return rObj;
  9606. }
  9607. /**
  9608. * 深度遍历 vjson
  9609. * @param vjson 视图JSON
  9610. * @param resolver 分析函数
  9611. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  9612. */
  9613. function deepTravVJson(vjson, resolver, propDeep) {
  9614. if (propDeep === void 0) { propDeep = false; }
  9615. var markerList = [];
  9616. deepTrav1(vjson, resolver, markerList, propDeep);
  9617. return markerList;
  9618. }
  9619. function deepTrav1(obj, resolver, marker, propDeep) {
  9620. if (propDeep === void 0) { propDeep = false; }
  9621. var isMarker = resolver(obj);
  9622. if (marker && isMarker === true) {
  9623. marker.unshift({ id: 0, keyName: '', object: obj });
  9624. }
  9625. _$2.forOwn(obj, function (value, key) {
  9626. if (typeof value !== 'object') {
  9627. return;
  9628. }
  9629. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  9630. if (key !== 'items' && key !== 'children') {
  9631. return;
  9632. }
  9633. }
  9634. else {
  9635. // 模型、数据、数据源不扫描
  9636. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  9637. return;
  9638. }
  9639. if (!propDeep &&
  9640. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  9641. key === 'listeners' || key === 'bind')) {
  9642. return;
  9643. }
  9644. }
  9645. //事件不扫描
  9646. if (key === 'on' && _$2.isObject(value)) {
  9647. return;
  9648. }
  9649. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  9650. return;
  9651. }
  9652. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  9653. if (marker && isMarkerChild === true) {
  9654. isMarker = true;
  9655. marker.unshift({ id: obj.id, keyName: key, object: value });
  9656. }
  9657. });
  9658. // @ts-ignore 删除作废对象
  9659. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  9660. return isMarker;
  9661. }
  9662. /**
  9663. * 在代码中找到 reference 对应的对象
  9664. */
  9665. function findInCode(code, id) {
  9666. try {
  9667. deepTravVJson(code, function (child) {
  9668. if (child.id === id) {
  9669. throw child;
  9670. }
  9671. });
  9672. return undefined;
  9673. }
  9674. catch (err) {
  9675. return err;
  9676. }
  9677. }
  9678. function replaceVjsonById(vjson, itemVjson, itemId) {
  9679. if (!itemVjson || (!itemVjson.id && !itemId)) {
  9680. msgError('无法定位组件!');
  9681. debugger;
  9682. return;
  9683. }
  9684. var id = itemId || itemVjson.id;
  9685. deepTravVJson(vjson, function (obj) {
  9686. if (obj.id == id) {
  9687. _$2.assign(obj, itemVjson, { id: id });
  9688. }
  9689. });
  9690. }
  9691. function deepTravDeleteVjson(obj, targetId) {
  9692. var isDelete = false;
  9693. _$2.forOwn(obj, function (value, key) {
  9694. if (isDelete) {
  9695. return;
  9696. }
  9697. if (typeof value !== 'object') {
  9698. return;
  9699. }
  9700. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  9701. if (key !== 'items') {
  9702. return;
  9703. }
  9704. }
  9705. else {
  9706. // 模型、数据、数据源不扫描
  9707. if (key === 'data' ||
  9708. key === 'dataSource' ||
  9709. key === 'suggest' ||
  9710. key === 'options' ||
  9711. key === 'config' ||
  9712. key === 'columns' ||
  9713. key === 'viewModel' ||
  9714. key === 'store') {
  9715. return;
  9716. }
  9717. }
  9718. //事件不扫描
  9719. if (key === 'on' && _$2.isObject(value)) {
  9720. return;
  9721. }
  9722. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  9723. return;
  9724. }
  9725. if (value.id === targetId) {
  9726. isDelete = true;
  9727. /** 如果是数组的元素*/
  9728. if (_$2.isArray(obj)) {
  9729. obj.splice(key, 1);
  9730. }
  9731. else {
  9732. delete obj[key];
  9733. }
  9734. return;
  9735. }
  9736. isDelete = deepTravDeleteVjson(value, targetId);
  9737. });
  9738. return isDelete;
  9739. }
  9740. /**
  9741. * 根据id删除Vjson 会删除因删除元素造成的空对象
  9742. * @param obj 原始 vjson 视图
  9743. * @param targetId 子元素的id
  9744. */
  9745. function deletVjsonById(vjson, targetId) {
  9746. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  9747. // if (_.isArray(obj)) {
  9748. // if (obj.length <= 0) {
  9749. // let T: any = {
  9750. // view: "template",
  9751. // template: "拖动任何组件到此处",
  9752. // role: "placeholder",
  9753. // id: webix.uid()
  9754. // }
  9755. // obj.push(T);
  9756. // }
  9757. // }
  9758. return isDeleted;
  9759. }
  9760. function removeDesignProp(vjson) {
  9761. deepTravVJson(vjson, function (obj) {
  9762. if (obj.hasOwnProperty('id')) {
  9763. delete obj.id;
  9764. }
  9765. if (obj.hasOwnProperty("designMode")) {
  9766. delete obj.designMode;
  9767. }
  9768. });
  9769. if (vjson.hasOwnProperty("cls")) {
  9770. delete vjson.cls;
  9771. }
  9772. if (vjson.hasOwnProperty("viewModel")) {
  9773. delete vjson.viewModel;
  9774. }
  9775. if (vjson.hasOwnProperty("store")) {
  9776. delete vjson.store;
  9777. }
  9778. }
  9779. function getLayoutOutline(vjson) {
  9780. deepTravVJson(vjson, function (obj) {
  9781. if (!Array.isArray(obj)) {
  9782. _$2.forOwn(obj, function (value, key) {
  9783. if (key === 'id' || key === 'region' || key === 'layoutName'
  9784. || key === 'text' || key === 'fieldLabel' || key === 'title'
  9785. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  9786. if (key === 'region'
  9787. || (key === 'xtype' && !_$2.has(obj, 'region'))
  9788. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  9789. if (!_$2.has(obj, 'layoutName')) {
  9790. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  9791. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  9792. // console.log(obj.layoutName, obj.layoutNameDesc)
  9793. }
  9794. }
  9795. }
  9796. else {
  9797. if (key === 'items') {
  9798. obj.children = obj[key];
  9799. }
  9800. if (key === 'tbar') {
  9801. var t = obj[key];
  9802. t.layoutName = key;
  9803. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  9804. // console.log(t.layoutName, t.layoutNameDesc)
  9805. if (_$2.has(obj, "items")) {
  9806. obj.items.splice(0, 0, t);
  9807. }
  9808. else if (_$2.has(obj, "children")) {
  9809. obj.children.splice(0, 0, t);
  9810. }
  9811. else {
  9812. obj.children = [t];
  9813. }
  9814. }
  9815. if (key === 'fbar') {
  9816. var t = obj[key];
  9817. t.layoutName = key;
  9818. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  9819. // console.log(t.layoutName, t.layoutNameDesc)
  9820. if (_$2.has(obj, "items")) {
  9821. obj.items.push(t);
  9822. }
  9823. else if (_$2.has(obj, "children")) {
  9824. obj.children.push(t);
  9825. }
  9826. else {
  9827. obj.children = [t];
  9828. }
  9829. }
  9830. delete obj[key];
  9831. }
  9832. });
  9833. if (!obj.hasOwnProperty("children")) {
  9834. obj.leaf = true;
  9835. }
  9836. if (!obj.hasOwnProperty("expanded")) {
  9837. obj.expanded = true;
  9838. }
  9839. }
  9840. });
  9841. return vjson;
  9842. }
  9843. //# sourceMappingURL=ViewHelper.js.map
  9844. var checkFlags = {};
  9845. // ------------------------------------------------------------------------------------------ impls
  9846. function jsViewToVJson(modulePage, jsView) {
  9847. if (!jsView)
  9848. return {};
  9849. jsView = jsView.replace(/^\s*export\s+default/, "");
  9850. jsView = _$2.trim(jsView) || "{}";
  9851. try {
  9852. var json = dist.parse(jsView);
  9853. return modulePage.addViewId(json);
  9854. }
  9855. catch (e) {
  9856. //@ts-ignore
  9857. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9858. }
  9859. }
  9860. function stringToJsonObj(jsonStr) {
  9861. if (!jsonStr)
  9862. return {};
  9863. try {
  9864. return dist.parse(jsonStr);
  9865. }
  9866. catch (e) {
  9867. return {};
  9868. }
  9869. }
  9870. /**
  9871. * 获取view.js 文件 string
  9872. */
  9873. function vjsonTojsView(vjson) {
  9874. var reVjson = _$2.cloneDeep(vjson);
  9875. removeDesignProp(reVjson);
  9876. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9877. }
  9878. var ModuleStore = /** @class */ (function (_super) {
  9879. __extends(ModuleStore, _super);
  9880. function ModuleStore() {
  9881. var _this = _super.call(this) || this;
  9882. _this.store = {};
  9883. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9884. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9885. _this.addModule(id, module, modulePage);
  9886. });
  9887. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9888. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9889. _this.onMainTabChange(moduleId, oldModuleId, from);
  9890. });
  9891. return _this;
  9892. }
  9893. ModuleStore.prototype.getCacheKey = function (param) {
  9894. return "filetree_data.json";
  9895. };
  9896. ModuleStore.prototype.invokeApi = function (param) {
  9897. return moduleTree();
  9898. };
  9899. ModuleStore.prototype.reloadModule = function (id) {
  9900. var moduleObject = this.store[id];
  9901. if (!moduleObject)
  9902. return;
  9903. var module = moduleObject.module;
  9904. getModuleFileContent(module).then(function (_a) {
  9905. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9906. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9907. moduleObject.lastModifyTime = lastModifyTime;
  9908. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9909. // 触发事件 ModuleItemChange
  9910. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9911. moduleObject.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: "reloadModule" });
  9912. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9913. });
  9914. };
  9915. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9916. var _this = this;
  9917. getModuleFileContent(module).then(function (_a) {
  9918. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9919. var moduleObject = {
  9920. id: id, module: module,
  9921. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9922. lastModifyTime: lastModifyTime,
  9923. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9924. modulePage: modulePage,
  9925. moduleEventBus: modulePage.moduleEventBus
  9926. };
  9927. _this.store[id] = moduleObject;
  9928. // 触发事件 ModuleItemChange
  9929. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9930. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9931. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9932. });
  9933. };
  9934. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9935. if (this.store[moduleId]) {
  9936. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9937. }
  9938. };
  9939. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9940. var moduleObject = this.store[id];
  9941. moduleObject.fileContent.jsController = codeValue;
  9942. };
  9943. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9944. var moduleObject = this.store[id];
  9945. moduleObject.fileContent.jsView = codeValue;
  9946. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9947. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, { vjson: moduleObject.moduleObj.vjson, from: from });
  9948. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9949. };
  9950. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9951. var moduleObject = this.store[id];
  9952. moduleObject.fileContent.jsModel = codeValue;
  9953. };
  9954. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9955. var moduleObject = this.store[id];
  9956. moduleObject.fileContent.groovy = codeValue;
  9957. };
  9958. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  9959. var moduleObject = this.store[id];
  9960. moduleObject.fileContent.mybatis = codeValue;
  9961. };
  9962. ModuleStore.prototype.getModuleObject = function (id) {
  9963. return this.store[id];
  9964. };
  9965. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  9966. if (checkFlags[moduleId] === 1) {
  9967. // @ts-ignore
  9968. system.msg("正在检测文件是否有外部修改,请稍后操作");
  9969. }
  9970. eventBus.publish(EventType.StopCheckModule, {});
  9971. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  9972. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  9973. saveFile(fileFullPath, fileContent).then(function (res) {
  9974. if (res.data && res.data.lastModified) {
  9975. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  9976. }
  9977. }).finally(function () {
  9978. eventBus.publish(EventType.RunCheckModule, {});
  9979. });
  9980. };
  9981. ModuleStore.prototype.check = function (moduleId) {
  9982. {
  9983. return;
  9984. }
  9985. };
  9986. return ModuleStore;
  9987. }(CacheStore));
  9988. // ------------------------------------------------------------------------------------------ use
  9989. var moduleStore = new ModuleStore();
  9990. //# sourceMappingURL=ModuleStore.js.map
  9991. var VjsonExchange = /** @class */ (function () {
  9992. function VjsonExchange(vjson) {
  9993. this.pendingSet = true;
  9994. this.vjsonOrigin = _$2.cloneDeep(vjson);
  9995. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  9996. }
  9997. /**
  9998. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  9999. * @param propName
  10000. * @param value
  10001. */
  10002. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10003. if (this.pendingSet) {
  10004. return;
  10005. }
  10006. // selectMode
  10007. // pageSizeOption
  10008. // cellediting_clicksToEdit
  10009. msg$1('' + propName + '=' + value);
  10010. _$2.set(this.vjson, propName, value);
  10011. };
  10012. /**
  10013. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10014. */
  10015. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10016. var _a, _b, _c;
  10017. if (this.pendingSet) {
  10018. return;
  10019. }
  10020. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10021. // 如果不使用默认属性,就直接设定 undefined
  10022. var vs = {
  10023. dataIndex: undefined,
  10024. header: undefined,
  10025. xtype: '',
  10026. width: undefined,
  10027. flex: undefined,
  10028. align: 'start',
  10029. editor: undefined,
  10030. dataType: 'string',
  10031. dict: undefined,
  10032. disabled: false,
  10033. menuDisabled: false,
  10034. notAllowBlank: false,
  10035. filterable: true,
  10036. hidden: false,
  10037. hideable: true,
  10038. resizable: true,
  10039. sortable: true,
  10040. autoSize: true,
  10041. };
  10042. var raw = record.get('raw');
  10043. if (raw === undefined || raw == null) {
  10044. raw = {};
  10045. record.set('raw', raw);
  10046. }
  10047. var setRaw = function (propName, value) {
  10048. if (typeof value === 'undefined' || value == null) {
  10049. msg$1("delete columns[" + rowIdx + "]." + propName);
  10050. delete raw[propName];
  10051. return;
  10052. }
  10053. var defaultValue = vs[propName];
  10054. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10055. // 要设的值,与默认值相同,就直接删除这个属性
  10056. msg$1("delete columns[" + rowIdx + "]." + propName);
  10057. delete raw[propName];
  10058. return;
  10059. }
  10060. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10061. _$2.set(raw, propName, value);
  10062. };
  10063. if (!vs.hasOwnProperty(propName)) {
  10064. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10065. return;
  10066. }
  10067. else if (propName === 'dict') {
  10068. if (value) {
  10069. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10070. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10071. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10072. }
  10073. }
  10074. else {
  10075. setRaw('fix', undefined);
  10076. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10077. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10078. delete raw.editor.fix;
  10079. }
  10080. }
  10081. }
  10082. else if (propName === 'xtype') {
  10083. if (!value) {
  10084. setRaw('xtype', undefined);
  10085. }
  10086. else {
  10087. setRaw('xtype', value);
  10088. }
  10089. }
  10090. else if (propName === 'notAllowBlank') {
  10091. setRaw('editor.allowBlank', !value);
  10092. }
  10093. else if (propName === 'editor') {
  10094. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10095. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10096. value = undefined;
  10097. }
  10098. // editor.xtype
  10099. if (!value) {
  10100. // 不需要编辑器
  10101. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10102. msg$1("delete columns[" + rowIdx + "].editor");
  10103. delete raw.editor;
  10104. record.set('notAllowBlank', false);
  10105. }
  10106. }
  10107. else {
  10108. setRaw('editor.xtype', value);
  10109. var dict = record.get('dict');
  10110. if (value === 'combo' && dict) {
  10111. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10112. }
  10113. }
  10114. }
  10115. else if (propName === 'width') {
  10116. var width = value;
  10117. var flex = record.get('flex');
  10118. if (!width && !flex) {
  10119. setRaw('width', undefined);
  10120. setRaw('flex', undefined);
  10121. record.set('flex', undefined);
  10122. record.set('width', undefined);
  10123. return;
  10124. }
  10125. else if (!!width) {
  10126. setRaw('flex', undefined);
  10127. record.set('flex', undefined);
  10128. setRaw('width', width);
  10129. return;
  10130. }
  10131. }
  10132. else if (propName === 'flex') {
  10133. var width = record.get('width');
  10134. var flex = value;
  10135. if (!width && !flex) {
  10136. setRaw('width', undefined);
  10137. setRaw('flex', undefined);
  10138. record.set('flex', undefined);
  10139. record.set('width', undefined);
  10140. return;
  10141. }
  10142. else if (!!flex) {
  10143. setRaw('width', undefined);
  10144. record.set('width', undefined);
  10145. setRaw('flex', flex);
  10146. return;
  10147. }
  10148. }
  10149. else {
  10150. // 其他属性,作为同名属性,与 raw 同步
  10151. setRaw(propName, value);
  10152. }
  10153. };
  10154. /**
  10155. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10156. */
  10157. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10158. var _this = this;
  10159. var vs = [
  10160. 'reference', 'pagination', 'pageSize',
  10161. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10162. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10163. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10164. 'listeners.beforeselect',
  10165. 'listeners.selectionchange',
  10166. 'listeners.itemclick',
  10167. 'listeners.itemdblclick',
  10168. 'listeners.cellClick',
  10169. 'listeners.celldblclick',
  10170. 'listeners.afterrender',
  10171. 'listeners.destory',
  10172. ];
  10173. _$2.forEach(vs, function (v) {
  10174. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10175. });
  10176. };
  10177. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10178. var me = this;
  10179. return function (value) {
  10180. me.setPropValue(propName, value);
  10181. };
  10182. };
  10183. VjsonExchange.prototype.parseModel = function () {
  10184. var _this = this;
  10185. 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;
  10186. //@ts-ignore
  10187. var df = YvanUI.Defaults.grid;
  10188. var vjson = _$2.assign({}, df, this.vjson);
  10189. var model = {
  10190. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10191. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10192. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10193. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10194. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10195. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10196. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10197. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10198. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10199. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10200. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10201. selectMode: 'spreadsheet',
  10202. cellediting_clicksToEdit: true,
  10203. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10204. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10205. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10206. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10207. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10208. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10209. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10210. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10211. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10212. gridfilters: true,
  10213. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10214. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10215. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10216. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10217. columns: [],
  10218. listeners: {
  10219. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10220. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10221. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10222. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10223. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10224. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10225. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10226. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10227. }
  10228. };
  10229. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10230. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10231. }
  10232. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10233. if (_$2.get(vjson, 'disableSelection') == true) {
  10234. model.selectMode = 'disableSelection';
  10235. }
  10236. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10237. model.selectMode = 'spreadsheet';
  10238. }
  10239. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10240. model.selectMode = 'onlyCheckColumn';
  10241. }
  10242. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10243. model.selectMode = 'checkColumn';
  10244. }
  10245. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10246. model.selectMode = 'row_mulity';
  10247. }
  10248. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10249. model.selectMode = 'row_single';
  10250. }
  10251. else {
  10252. model.selectMode = 'row_single';
  10253. }
  10254. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10255. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10256. model.dataSource = {
  10257. url: _$2.get(vjson, 'dataSource.url'),
  10258. //@ts-ignore
  10259. params: _$2.get(vjson, 'dataSource.params')
  10260. };
  10261. }
  10262. _$2.forEach(vjson.columns, function (column) {
  10263. model.columns.push(_this.parseColumn(column));
  10264. });
  10265. return model;
  10266. };
  10267. VjsonExchange.prototype.parseColumn = function (column) {
  10268. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10269. var model = {
  10270. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10271. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10272. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10273. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10274. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10275. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10276. editor: '',
  10277. editParam: '',
  10278. dict: '',
  10279. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10280. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10281. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10282. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10283. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10284. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10285. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10286. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10287. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10288. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10289. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10290. raw: _$2.cloneDeep(column),
  10291. };
  10292. // width / flex 只能留一个属性, 或者全不留
  10293. if (model.width <= 0 && model.flex <= 0) {
  10294. delete model.width;
  10295. delete model.flex;
  10296. }
  10297. else if (model.width > 0) {
  10298. delete model.flex;
  10299. }
  10300. else {
  10301. delete model.width;
  10302. }
  10303. // editor
  10304. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10305. model.editor = _$2.get(column, 'editor.xtype');
  10306. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10307. if (!model.editor) {
  10308. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10309. model.editor = 'textfield';
  10310. }
  10311. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10312. msg$1('不可识别的 editor.xtype=' + model.editor);
  10313. console.error('不可识别的 editor.xtype', column);
  10314. }
  10315. if (_$2.get(column, 'editor.allowBlank') === false) {
  10316. model.notAllowBlank = true;
  10317. }
  10318. }
  10319. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10320. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10321. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10322. if (match && match[1]) {
  10323. model.dict = match[1];
  10324. }
  10325. }
  10326. return model;
  10327. };
  10328. return VjsonExchange;
  10329. }());
  10330. //
  10331. //# sourceMappingURL=YvgridExchange.js.map
  10332. var YvgridDesign = /** @class */ (function (_super) {
  10333. __extends(YvgridDesign, _super);
  10334. function YvgridDesign(moduleId) {
  10335. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10336. _this.moduleId = '';
  10337. _this.name = 'YvgridDesign';
  10338. _this.dataSourceIsActived = false;
  10339. _this.setModuleId(moduleId);
  10340. return _this;
  10341. }
  10342. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10343. var _this = this;
  10344. this.moduleId = moduleId;
  10345. if (this.componentSelectionChangeSubscribe) {
  10346. this.componentSelectionChangeSubscribe.cancel();
  10347. this.componentSelectionChangeSubscribe = null;
  10348. }
  10349. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10350. var id = _a.id, from = _a.from;
  10351. _this.onComponentSelectionChange(id, from);
  10352. });
  10353. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10354. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10355. if (vj.xtype !== 'yvgrid') {
  10356. throw Error('非 yvgrid 组件');
  10357. }
  10358. this.vjsonExchange = new VjsonExchange(vj);
  10359. };
  10360. YvgridDesign.prototype.onLoad = function () {
  10361. var _this = this;
  10362. var model = this.vjsonExchange.parseModel();
  10363. this.vjsonExchange.pendingSet = true;
  10364. mergeViewModel(this.viewModel, "vjson", model, false);
  10365. this.refs.grid1.setData(model.columns);
  10366. this.vjsonExchange.attachViewModel(this.viewModel);
  10367. _$2.defer(function () {
  10368. _this.vjsonExchange.pendingSet = false;
  10369. });
  10370. };
  10371. YvgridDesign.prototype.moveUp = function (sender) {
  10372. var grid = sender.up('grid');
  10373. grid.rowMoveUp();
  10374. };
  10375. YvgridDesign.prototype.moveDown = function (sender) {
  10376. var grid = sender.up('grid');
  10377. grid.rowMoveDown();
  10378. };
  10379. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10380. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10381. };
  10382. YvgridDesign.prototype.reloadSqlContent = function () {
  10383. var _this = this;
  10384. var url = this.viewModel.get('vjson.dataSource.url');
  10385. if (url) {
  10386. loadSqlContentApi(url).then(function (res) {
  10387. _this.refs.sqlEditor.setCode('');
  10388. if (res.success) {
  10389. _this.refs.sqlEditor.setCode(res.data.content);
  10390. }
  10391. }).catch(function () {
  10392. _this.refs.sqlEditor.setCode('');
  10393. });
  10394. }
  10395. };
  10396. YvgridDesign.prototype.dataSourceSave = function () {
  10397. var url = this.viewModel.get('vjson.dataSource.url');
  10398. if (!url) {
  10399. msg$1('必须填写 groovy/SQL 模块路径');
  10400. return;
  10401. }
  10402. var content = this.refs.sqlEditor.getCode();
  10403. saveSqlContentApi(url, content).then(function (res) {
  10404. if (res.success) {
  10405. msg$1('保存成功');
  10406. }
  10407. else {
  10408. msg$1(res.msg);
  10409. }
  10410. });
  10411. };
  10412. YvgridDesign.prototype.dataSourceActivate = function () {
  10413. if (!this.dataSourceIsActived) {
  10414. // 激活
  10415. this.reloadSqlContent();
  10416. var params = this.viewModel.get('vjson.dataSource.params');
  10417. if (_$2.isObject(params)) {
  10418. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10419. }
  10420. this.dataSourceIsActived = true;
  10421. }
  10422. };
  10423. // 外部控件选择发生改变
  10424. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10425. if (!id || from === this.name) {
  10426. return;
  10427. }
  10428. this.setVjson(id);
  10429. };
  10430. YvgridDesign.prototype.setVjson = function (id) {
  10431. // 找到对应的组件 判断是不是表格
  10432. };
  10433. YvgridDesign.prototype.save = function () {
  10434. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10435. if (this.dataSourceIsActived) {
  10436. var url = this.viewModel.get('vjson.dataSource.url');
  10437. // 解析 params
  10438. var paramsString = this.refs.sqlParams.getCode('');
  10439. var params = undefined;
  10440. if (paramsString) {
  10441. try {
  10442. params = window['YvanUI'].json5.parse(paramsString);
  10443. }
  10444. catch (e) {
  10445. msg$1('dataSource.params 格式非法,请检查');
  10446. return;
  10447. }
  10448. }
  10449. if (typeof params === 'undefined') {
  10450. params = this.viewModel.get('vjson.dataSource.params');
  10451. }
  10452. if (url) {
  10453. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10454. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10455. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10456. }
  10457. else {
  10458. delete this.vjsonExchange.vjson['dataSource'];
  10459. }
  10460. }
  10461. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10462. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10463. from: this.name,
  10464. ignoreRenderUI: false
  10465. });
  10466. };
  10467. YvgridDesign.prototype.saveClose = function () {
  10468. this.save();
  10469. this.close();
  10470. };
  10471. YvgridDesign.prototype.addColumn = function () {
  10472. this.refs.grid1.appendEditRow({
  10473. dataIndex: '',
  10474. header: '',
  10475. xtype: '',
  10476. width: 80,
  10477. align: '',
  10478. editor: '',
  10479. editParam: '',
  10480. dict: '',
  10481. disabled: false,
  10482. notAllowBlank: false,
  10483. menuDisabled: false,
  10484. filterable: false,
  10485. hidden: false,
  10486. hideable: true,
  10487. resizable: true,
  10488. sortable: true,
  10489. locked: false,
  10490. lockable: false,
  10491. autoSize: true,
  10492. raw: undefined,
  10493. }, 'header');
  10494. };
  10495. YvgridDesign.prototype.removeColumn = function () {
  10496. var _this = this;
  10497. var rows = [];
  10498. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10499. rows.push(r);
  10500. });
  10501. _$2.forEach(rows, function (r) {
  10502. _this.refs.grid1.getStore().remove(r);
  10503. });
  10504. };
  10505. YvgridDesign.prototype.calcColumn = function () {
  10506. msg$1('暂未实现');
  10507. };
  10508. YvgridDesign.prototype.onDestroy = function () {
  10509. if (this.componentSelectionChangeSubscribe) {
  10510. this.componentSelectionChangeSubscribe.cancel();
  10511. this.componentSelectionChangeSubscribe = null;
  10512. }
  10513. };
  10514. return YvgridDesign;
  10515. }(Scope));
  10516. //# sourceMappingURL=YvgridDesign.js.map
  10517. // export const idPrefix = "_ds_"
  10518. var _designInstance;
  10519. function setDesignInstance(instance) {
  10520. _designInstance = instance;
  10521. }
  10522. function getDesignInstance() {
  10523. return _designInstance;
  10524. }
  10525. function delegateDragmove(node, source, info) {
  10526. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10527. //@ts-ignore
  10528. _designInstance.dragmove(node, source, info);
  10529. }
  10530. }
  10531. function delegateDragend(node, source, info) {
  10532. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10533. //@ts-ignore
  10534. _designInstance.dragend(node, source, info);
  10535. }
  10536. }
  10537. //# sourceMappingURL=DropHelper.js.map
  10538. var YvanUI$1 = window['YvanUI'];
  10539. var _$1 = window["_"];
  10540. var Ext$1 = window['Ext'];
  10541. var $$1 = window["$"];
  10542. var historySize = 100;
  10543. var ViewDesign = /** @class */ (function () {
  10544. function ViewDesign(moduleId, reference) {
  10545. var _this = this;
  10546. this.name = "ViewDesign";
  10547. this.expandedVjsonObjArray = [];
  10548. // 编辑历史
  10549. this.undoVjsonList = [];
  10550. // 撤销历史
  10551. this.redoVjsonList = [];
  10552. // 订阅事件列表
  10553. this.subscribeList = [];
  10554. // private getOuterCopyValueTimer: any = null
  10555. /**
  10556. * 唯一编号
  10557. */
  10558. this.id = _$1.uniqueId("_dv");
  10559. this.moduleId = moduleId;
  10560. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10561. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10562. this.designReference = reference;
  10563. this.designElement = reference.ariaEl.dom;
  10564. this.$overlay.appendTo(this.designElement);
  10565. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10566. // 添加到撤销
  10567. this.lastVjson = _$1.cloneDeep(this.vjson);
  10568. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10569. event.stopPropagation();
  10570. event.preventDefault();
  10571. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10572. });
  10573. this.$overlay.on('click', '.studio_mask', function (event) {
  10574. event.stopPropagation();
  10575. event.preventDefault();
  10576. _this.clearSelection();
  10577. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10578. _$1.defer(function () {
  10579. _this.$overlay.focus();
  10580. });
  10581. });
  10582. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10583. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10584. this.$overlay.on('copy', this.onCopy.bind(this));
  10585. this.$overlay.on('paste', this.onPaste.bind(this));
  10586. this.$overlay.on('focus', this.onfocus.bind(this));
  10587. // this.$overlay.on('mouseenter', ()=>{
  10588. // clearTimeout(this.getOuterCopyValueTimer);
  10589. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10590. // })
  10591. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10592. _this.onMousemove(event);
  10593. }, 300, { maxWait: 500 }).bind(this));
  10594. window.addEventListener('message', this.onMessageEvent.bind(this));
  10595. this.subscribe();
  10596. setDesignInstance(this);
  10597. }
  10598. // todo ======== 方法 ==========
  10599. ViewDesign.prototype.subscribe = function () {
  10600. var _this = this;
  10601. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10602. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10603. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10604. _this.setVjson(vjson, from, ignoreRenderUI);
  10605. }));
  10606. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10607. var id = _a.id, from = _a.from;
  10608. _this.onComponentSelectionChange(id, from);
  10609. }));
  10610. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10611. var id = _a.id, from = _a.from;
  10612. _this.onComponentDelete(id, from);
  10613. }));
  10614. };
  10615. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10616. if (vjson === void 0) { vjson = this.vjson; }
  10617. if (from === void 0) { from = this.name; }
  10618. this.vjson = vjson;
  10619. if (from !== "undo" && from !== "redo") {
  10620. if (this.undoVjsonList.length >= 100) {
  10621. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10622. }
  10623. this.undoVjsonList.push(this.lastVjson);
  10624. }
  10625. this.lastVjson = _$1.cloneDeep(vjson);
  10626. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10627. };
  10628. /**
  10629. * 覆盖层点击事件
  10630. */
  10631. ViewDesign.prototype.overlayClickFunction = function (event) {
  10632. if (!event.altKey && !event.shiftKey) {
  10633. var target = this.findElByXY(event.clientX, event.clientY);
  10634. if (target) {
  10635. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10636. var extHandle = Ext$1.get(target).component;
  10637. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10638. rect.x = position.x;
  10639. rect.y = position.y;
  10640. this.clearSelection();
  10641. this.appendMaskbox(rect, extHandle.id);
  10642. }
  10643. }
  10644. };
  10645. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10646. if (dragType === void 0) { dragType = ""; }
  10647. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10648. var ele = document.elementsFromPoint(x, y);
  10649. if (ele.length <= 1) {
  10650. return;
  10651. }
  10652. var target = null;
  10653. for (var i = 0; i < ele.length; i++) {
  10654. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10655. 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) {
  10656. switch (dragType) {
  10657. case "cols-container":
  10658. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10659. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10660. target = ele[i];
  10661. }
  10662. break;
  10663. case "col-item":
  10664. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10665. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10666. target = ele[i];
  10667. }
  10668. break;
  10669. case "rows-container":
  10670. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10671. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10672. target = ele[i];
  10673. }
  10674. break;
  10675. case "row-item":
  10676. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10677. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10678. target = ele[i];
  10679. }
  10680. break;
  10681. default:
  10682. target = ele[i];
  10683. break;
  10684. }
  10685. if (target) {
  10686. break;
  10687. }
  10688. }
  10689. }
  10690. return target;
  10691. };
  10692. /**
  10693. * 清空选择项
  10694. */
  10695. ViewDesign.prototype.clearSelection = function () {
  10696. // $(this.designElement).removeClass('selected');
  10697. // // $(this.designElement).find('.selected').removeClass('selected')
  10698. // $(this.designElement).find('.ds_mask')
  10699. // .not('.mask_not_hide')
  10700. // .remove();
  10701. $$1('.studio_mask').remove();
  10702. // $(this.designElement).find('.selected').each(function () {
  10703. // $(this).removeClass('selected');
  10704. // // const extHandle = Ext.get(this).component
  10705. // // if (extHandle) {
  10706. // // extHandle.removeCls('selected')
  10707. // // }
  10708. // })
  10709. };
  10710. /**
  10711. * 添加遮罩层
  10712. */
  10713. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10714. var that = this;
  10715. if (vjsonId) {
  10716. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10717. }
  10718. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10719. // return item === cj.xtype
  10720. // }) >= 0
  10721. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10722. 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>");
  10723. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10724. this.$mask.css({
  10725. position: 'absolute',
  10726. top: top, left: left, width: width, height: height,
  10727. border: '2px dashed #1890ff',
  10728. zIndex: 100,
  10729. });
  10730. this.$mask.appendTo(this.$overlay);
  10731. this.$mask.on("click", ".ds_del", function (e) {
  10732. e.stopPropagation();
  10733. e.preventDefault();
  10734. that.deleteComponent(vjsonId);
  10735. });
  10736. // 点击选中父级
  10737. this.$mask.on('click', '.ds_parent', function (e) {
  10738. e.stopPropagation();
  10739. e.preventDefault();
  10740. that.selectParent(vjsonId);
  10741. });
  10742. var sel = document.getElementById(vjsonId);
  10743. var sVjosn = findInCode(this.vjson, vjsonId);
  10744. // 限制可以拖动的组件
  10745. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10746. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10747. this.dragSource = new Ext$1.drag.Source({
  10748. element: this.$mask[0],
  10749. constrain: this.$overlay[0],
  10750. listeners: {
  10751. dragmove: this.dragmove.bind(that, this.vjson),
  10752. dragend: this.dragend.bind(that, this.vjson)
  10753. },
  10754. startRect: rect,
  10755. sourceVjson: findInCode(this.vjson, vjsonId),
  10756. sourceVjsonId: vjsonId,
  10757. dragType: dragType
  10758. });
  10759. }
  10760. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10761. };
  10762. /**
  10763. * 选中某个选项
  10764. */
  10765. ViewDesign.prototype.setSelection = function (id) {
  10766. var _a, _b;
  10767. if (!this.designElement) {
  10768. return;
  10769. }
  10770. // 清空选中内容
  10771. this.clearSelection();
  10772. if (!id) {
  10773. return;
  10774. }
  10775. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10776. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10777. rect.x = position.x;
  10778. rect.y = position.y;
  10779. this.appendMaskbox(rect, id);
  10780. };
  10781. /**
  10782. * 删除组件
  10783. * @param id
  10784. */
  10785. ViewDesign.prototype.deleteComponent = function (id) {
  10786. deletVjsonById(this.vjson, id);
  10787. this.moduleObject.modulePage.currentComponentSelectId = null;
  10788. this.setVjson();
  10789. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10790. this.clearSelection();
  10791. };
  10792. ViewDesign.prototype.selectParent = function (id) {
  10793. var pid = getSuperVjsonId(this.vjson, id);
  10794. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10795. this.setSelection(pid);
  10796. };
  10797. // todo ====== 拖拽事件 ======
  10798. ViewDesign.prototype.dragmove = function (node, source, info) {
  10799. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10800. if (!target) {
  10801. return;
  10802. }
  10803. var rect = target.getBoundingClientRect();
  10804. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10805. var extHandle = Ext$1.get(target).component;
  10806. if (!extHandle) {
  10807. return;
  10808. }
  10809. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10810. rect.x = position.x;
  10811. rect.y = position.y;
  10812. this.appendDirection(rect, extHandle.id, direction);
  10813. };
  10814. ViewDesign.prototype.dragend = function (node, source, info) {
  10815. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10816. if (!target) {
  10817. return;
  10818. }
  10819. var rect = target.getBoundingClientRect();
  10820. var extHandle = Ext$1.get(target).component;
  10821. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10822. if (!extHandle) {
  10823. return;
  10824. }
  10825. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10826. this.removeDirection();
  10827. };
  10828. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10829. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10830. var cv = findInCode(this.vjson, vjsonId);
  10831. if (this.$direction) {
  10832. $$1('#direction' + this.id).remove();
  10833. }
  10834. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10835. //
  10836. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10837. if (direction) {
  10838. if (direction === "top") {
  10839. // direction = 'center'
  10840. height = height / 4;
  10841. }
  10842. else if (direction === "bottom") {
  10843. // direction = 'center'
  10844. top = top + height / 4 * 3;
  10845. height = height / 4;
  10846. }
  10847. else if (direction === "left") {
  10848. width = width / 4;
  10849. }
  10850. else if (direction === "right") {
  10851. left = left + width / 4 * 3;
  10852. width = width / 4;
  10853. }
  10854. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10855. this.$direction.css({
  10856. position: 'absolute',
  10857. top: top, left: left, width: width, height: height,
  10858. // border: '2px dashed #1890ff',
  10859. background: 'rgba(40,224,218,0.75)',
  10860. zIndex: 100,
  10861. });
  10862. this.$direction.appendTo(this.$overlay);
  10863. // }
  10864. }
  10865. };
  10866. ViewDesign.prototype.removeDirection = function () {
  10867. if (this.$direction) {
  10868. this.$direction.remove();
  10869. this.$direction = null;
  10870. }
  10871. };
  10872. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10873. var arrS;
  10874. if (sourceVjId) {
  10875. arrS = findArrayContainer(this.vjson, sourceVjId);
  10876. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10877. var indexS = _$1.findIndex(arrS, function (v) {
  10878. return v.id === sourceVjId;
  10879. });
  10880. if (indexS < 0) {
  10881. return;
  10882. }
  10883. }
  10884. delete sourceVjson.id;
  10885. var vjsonT = findInCode(this.vjson, targetVjId);
  10886. var arrT = findArrayContainer(this.vjson, targetVjId);
  10887. var indexT = _$1.findIndex(arrT, function (v) {
  10888. return v.id === targetVjId;
  10889. });
  10890. if (indexT < 0) {
  10891. return;
  10892. }
  10893. switch (direction) {
  10894. case 'top':
  10895. case 'left':
  10896. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10897. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10898. vjsonT.items.splice(0, 0, sourceVjson);
  10899. }
  10900. else {
  10901. arrT.splice(indexT, 0, sourceVjson);
  10902. }
  10903. break;
  10904. case 'bottom':
  10905. case 'right':
  10906. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10907. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10908. vjsonT.items.push(sourceVjson);
  10909. }
  10910. else {
  10911. arrT.splice(indexT + 1, 0, sourceVjson);
  10912. }
  10913. break;
  10914. case 'center':
  10915. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10916. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10917. vjsonT.items.push(sourceVjson);
  10918. }
  10919. else {
  10920. arrT.splice(indexT, 1, sourceVjson);
  10921. }
  10922. break;
  10923. }
  10924. if (sourceVjId) {
  10925. deletVjsonById(this.vjson, sourceVjId);
  10926. sourceVjson.id = sourceVjId;
  10927. }
  10928. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10929. };
  10930. // todo ======== 事件 ==========
  10931. // 接收 postMessage 事件分发
  10932. ViewDesign.prototype.onMessageEvent = function (event) {
  10933. var _a, _b;
  10934. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10935. if (fucName && typeof this[fucName] === 'function') {
  10936. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10937. }
  10938. };
  10939. // 接收外部选中组件事件
  10940. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10941. if (from !== this.name) {
  10942. this.setSelection(id);
  10943. }
  10944. };
  10945. // 接收外部组件删除事件
  10946. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10947. if (from !== this.name) {
  10948. this.deleteComponent(id);
  10949. }
  10950. };
  10951. // 组件被选中
  10952. ViewDesign.prototype.onComponentSelect = function (args) {
  10953. if (args[2] != this.moduleId) {
  10954. return;
  10955. }
  10956. if (args[0]) {
  10957. var rect = args[0];
  10958. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10959. rect.x = position.x;
  10960. rect.y = position.y;
  10961. this.clearSelection();
  10962. this.appendMaskbox(rect, args[1]);
  10963. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  10964. }
  10965. };
  10966. ViewDesign.prototype.onComponentInfo = function (_a) {
  10967. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  10968. if (moduleId != this.moduleId) {
  10969. return;
  10970. }
  10971. if (rect) {
  10972. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10973. rect.x = position.x;
  10974. rect.y = position.y;
  10975. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10976. var cv_1 = findInCode(this.vjson, vjsonId);
  10977. if (this.$direction) {
  10978. $$1('#direction' + this.id).remove();
  10979. }
  10980. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  10981. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  10982. if (direction) {
  10983. if (direction === "top") {
  10984. direction = 'center';
  10985. //height = height/3
  10986. }
  10987. else if (direction === "bottom") {
  10988. direction = 'center';
  10989. // top=top+height/3*2
  10990. // height = height/3
  10991. }
  10992. else if (direction === "left") {
  10993. width = width / 3;
  10994. }
  10995. else if (direction === "right") {
  10996. left = left + width / 3 * 2;
  10997. width = width / 3;
  10998. }
  10999. this.$direction = $$1("<div id='direction" + this.id + "'>");
  11000. this.$direction.css({
  11001. position: 'absolute',
  11002. top: top, left: left, width: width, height: height,
  11003. // border: '2px dashed #1890ff',
  11004. background: 'rgba(74,106,201,0.42)',
  11005. zIndex: 100,
  11006. });
  11007. this.$direction.appendTo(this.$overlay);
  11008. }
  11009. }
  11010. console.log("direction", direction);
  11011. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11012. // rect.x = position.x
  11013. // rect.y = position.y
  11014. // this.clearSelection()
  11015. // this.appendMaskbox(rect, args[1])
  11016. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11017. }
  11018. };
  11019. ViewDesign.prototype.onUndo = function () {
  11020. if (this.undoVjsonList.length > 0) {
  11021. if (this.redoVjsonList.length >= 100) {
  11022. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11023. }
  11024. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11025. this.vjson = this.undoVjsonList.pop();
  11026. // this.setVjson(this.vjson, "", false, "undo")
  11027. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11028. }
  11029. };
  11030. ViewDesign.prototype.onRedo = function () {
  11031. if (this.redoVjsonList.length > 0) {
  11032. if (this.undoVjsonList.length >= 100) {
  11033. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11034. }
  11035. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11036. this.vjson = this.redoVjsonList.pop();
  11037. // this.setVjson(this.vjson, "", false, "redo")
  11038. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11039. }
  11040. };
  11041. ViewDesign.prototype.onKeyPress = function (event) {
  11042. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11043. // if (this.backStep()) {
  11044. // event.stopPropagation()
  11045. // event.preventDefault()
  11046. // return
  11047. // }
  11048. // }
  11049. //
  11050. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11051. // if (this.recoverStep()) {
  11052. // event.stopPropagation()
  11053. // event.preventDefault()
  11054. // return
  11055. // }
  11056. // }
  11057. // if (event.key === 'ArrowUp') {
  11058. // if (this.selectParent()) {
  11059. // event.stopPropagation()
  11060. // event.preventDefault()
  11061. // return;
  11062. // }
  11063. // }
  11064. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11065. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11066. event.stopPropagation();
  11067. event.preventDefault();
  11068. return;
  11069. }
  11070. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11071. // if (this.copyView()) {
  11072. // event.stopPropagation()
  11073. // event.preventDefault()
  11074. // return;
  11075. // }
  11076. // }
  11077. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11078. // if (this.copyView(true)) {
  11079. // event.stopPropagation()
  11080. // event.preventDefault()
  11081. // return;
  11082. // }
  11083. // }
  11084. //
  11085. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11086. // if (this.selectRoot()) {
  11087. // event.stopPropagation()
  11088. // event.preventDefault()
  11089. // return;
  11090. // }
  11091. //
  11092. };
  11093. ViewDesign.prototype.onCopy = function (event) {
  11094. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11095. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11096. if (copyVjson) {
  11097. removeDesignProp(copyVjson);
  11098. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11099. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11100. }
  11101. }
  11102. };
  11103. ViewDesign.prototype.onPaste = function (event) {
  11104. debugger;
  11105. };
  11106. ViewDesign.prototype.onfocus = function () {
  11107. console.log("getCopy");
  11108. console.log("document.activeElement", document.activeElement.id);
  11109. // clearTimeout(this.getOuterCopyValueTimer);
  11110. // native.clipboardRead()
  11111. };
  11112. ViewDesign.prototype.onMousemove = function (event) {
  11113. var _a;
  11114. if (document.activeElement.id === this.$overlay[0].id) {
  11115. // console.log(event.clientX, event.clientY)
  11116. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11117. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11118. // this.iframeWindow.postMessage({
  11119. // method: 'overlayGetInfo',
  11120. // args: [position, this.moduleId]
  11121. // }, '*')
  11122. }
  11123. }
  11124. };
  11125. ViewDesign.prototype.onDestroy = function () {
  11126. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11127. for (var i = 0; i < this.subscribeList.length; i++) {
  11128. this.subscribeList[i].cancel();
  11129. }
  11130. };
  11131. // todo ======== 工具方法 ==========
  11132. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11133. if (relative === void 0) { relative = null; }
  11134. if (from === "main" && to === "overlay") {
  11135. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11136. var x = overlayRect.x;
  11137. var y = overlayRect.y;
  11138. if (relative) {
  11139. var relativeRect = relative.getBoundingClientRect();
  11140. console.log("main->", relativeRect.x, relativeRect.y);
  11141. x = x - relativeRect.x;
  11142. y = y - relativeRect.y;
  11143. }
  11144. pos.x = pos.x - x;
  11145. pos.y = pos.y - y;
  11146. }
  11147. else if (from === "overlay" && to === "main") {
  11148. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11149. var x = overlayRect.x;
  11150. var y = overlayRect.y;
  11151. if (relative) {
  11152. var relativeRect = relative.getBoundingClientRect();
  11153. console.log("iframe->", relativeRect.x, relativeRect.y);
  11154. x = x - relativeRect.x;
  11155. y = y - relativeRect.y;
  11156. }
  11157. pos.x = pos.x + x;
  11158. pos.y = pos.y + y;
  11159. }
  11160. return pos;
  11161. };
  11162. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11163. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11164. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11165. return "center";
  11166. }
  11167. // col-item 只能放左右
  11168. if (dragType === "col-item" || dragType === "") {
  11169. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11170. if (x > rect.x && x < rect.x + rect.width / 3) {
  11171. return "left";
  11172. }
  11173. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11174. return "right";
  11175. }
  11176. }
  11177. }
  11178. // cols-container 只能放上下
  11179. if (dragType === "cols-container" || dragType === "") {
  11180. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11181. if (y > rect.y && y < rect.y + rect.height / 3) {
  11182. return "top";
  11183. }
  11184. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11185. return "bottom";
  11186. }
  11187. }
  11188. }
  11189. return "";
  11190. };
  11191. return ViewDesign;
  11192. }());
  11193. //
  11194. //# sourceMappingURL=ViewDesign.js.map
  11195. var model$8 = {
  11196. data: {
  11197. iframeSrc: ''
  11198. }
  11199. };
  11200. //# sourceMappingURL=ModulePage.model.js.map
  11201. var vjson$8 = {
  11202. layout: 'fit',
  11203. border: false,
  11204. iconCls: 'x-fa fa-newspaper-o',
  11205. referenceHolder: true,
  11206. items: [
  11207. {
  11208. layout: 'border',
  11209. border: false,
  11210. items: [
  11211. {
  11212. region: 'center',
  11213. xtype: 'tabpanel',
  11214. border: false,
  11215. tabPosition: 'bottom',
  11216. reference: 'tabPanel',
  11217. listeners: {
  11218. tabchange: 'scope.tabchange'
  11219. },
  11220. defaults: {
  11221. border: false,
  11222. },
  11223. items: [
  11224. {
  11225. title: 'controller.js',
  11226. xtype: 'jseditor',
  11227. reference: 'controllerEditor',
  11228. },
  11229. {
  11230. title: 'view.design',
  11231. xtype: 'designer',
  11232. reference: 'designer',
  11233. listeners: {
  11234. afterrender: 'scope.previewRender'
  11235. },
  11236. },
  11237. {
  11238. title: 'view.js',
  11239. xtype: 'jseditor',
  11240. reference: 'viewEditor',
  11241. },
  11242. {
  11243. title: 'model.js',
  11244. xtype: 'jseditor',
  11245. reference: 'modelEditor',
  11246. },
  11247. {
  11248. title: 'groovy',
  11249. xtype: 'groovyeditor',
  11250. reference: 'groovyEditor',
  11251. },
  11252. {
  11253. title: 'SQL',
  11254. xtype: 'sqleditor',
  11255. reference: 'sqlEditor',
  11256. }
  11257. ]
  11258. }
  11259. ]
  11260. }
  11261. ]
  11262. };
  11263. //# sourceMappingURL=ModulePage.view.js.map
  11264. var ModulePage = /** @class */ (function (_super) {
  11265. __extends(ModulePage, _super);
  11266. function ModulePage(moduleId, module) {
  11267. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11268. _this.name = "ModulePage";
  11269. _this.viewDesign = null;
  11270. _this.maxViewId = 0;
  11271. _this.moduleEventBus = new EventBus();
  11272. _this.codeChange = _$2.debounce(function (code, from, e) {
  11273. try {
  11274. switch (from) {
  11275. case _this.refs.controllerEditor.name:
  11276. moduleStore.updateJsController(_this.moduleId, code, from);
  11277. break;
  11278. case _this.refs.viewEditor.name:
  11279. moduleStore.updateJsView(_this.moduleId, code, from);
  11280. break;
  11281. case _this.refs.modelEditor.name:
  11282. moduleStore.updateJsModel(_this.moduleId, code, from);
  11283. break;
  11284. case _this.refs.groovyEditor.name:
  11285. moduleStore.updateGroovy(_this.moduleId, code, from);
  11286. break;
  11287. case _this.refs.sqlEditor.name:
  11288. moduleStore.updateMybatis(_this.moduleId, code, from);
  11289. break;
  11290. }
  11291. }
  11292. catch (e) {
  11293. }
  11294. }, 500, { maxWait: 10000 });
  11295. _this.moduleId = moduleId;
  11296. _this.module = module;
  11297. _this.cancelSubscribe = [];
  11298. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11299. _this.initEditor(moduleItem);
  11300. }));
  11301. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11302. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11303. _this.previewReRender();
  11304. }));
  11305. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11306. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11307. _this.updateVjson(vjson, from, ignoreRenderUI);
  11308. }));
  11309. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11310. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11311. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11312. }));
  11313. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11314. var id = _a.id, from = _a.from;
  11315. _this.onComponentSelectionChange(id, from);
  11316. }));
  11317. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11318. _this.onUndo();
  11319. }));
  11320. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11321. _this.onRedo();
  11322. }));
  11323. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11324. _this.currentCopyVjson = stringToJsonObj(value);
  11325. }));
  11326. return _this;
  11327. }
  11328. ModulePage.prototype.onLoad = function () {
  11329. var _this = this;
  11330. // this.refs.preview.src = href
  11331. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11332. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11333. _this.saveCall();
  11334. }));
  11335. this.activeEditor = this.refs.controllerEditor;
  11336. this.refs.controllerEditor.modulePage = this;
  11337. this.refs.viewEditor.modulePage = this;
  11338. this.refs.modelEditor.modulePage = this;
  11339. this.refs.groovyEditor.modulePage = this;
  11340. this.refs.sqlEditor.modulePage = this;
  11341. this.refs.controllerEditor.name = "controllerEditor";
  11342. this.refs.viewEditor.name = "viewEditor";
  11343. this.refs.modelEditor.name = "modelEditor";
  11344. this.refs.groovyEditor.name = "groovyEditor";
  11345. this.refs.sqlEditor.name = "sqlEditor";
  11346. this.refs.controllerEditor.codeChange = this.codeChange;
  11347. this.refs.viewEditor.codeChange = this.codeChange;
  11348. this.refs.modelEditor.codeChange = this.codeChange;
  11349. this.refs.groovyEditor.codeChange = this.codeChange;
  11350. this.refs.sqlEditor.codeChange = this.codeChange;
  11351. };
  11352. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11353. if (!cmpVjson || from === this.name) {
  11354. return;
  11355. }
  11356. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11357. replaceVjsonById(vj, cmpVjson);
  11358. this.updateVjson(vj, from, ignoreRenderUI);
  11359. };
  11360. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11361. var _this = this;
  11362. var _a, _b;
  11363. if (!vjson || from === this.name) {
  11364. return;
  11365. }
  11366. this.addViewId(vjson);
  11367. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11368. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11369. (_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);
  11370. this.previewReRender();
  11371. _$2.defer(function () {
  11372. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11373. });
  11374. };
  11375. ModulePage.prototype.previewRender = function (sender) {
  11376. var _this = this;
  11377. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11378. if (!this.designScope) {
  11379. this.designScope = new Scope({
  11380. vjson: vjson,
  11381. model: {
  11382. data: {}
  11383. }
  11384. });
  11385. }
  11386. else {
  11387. this.designScope.vjson = vjson;
  11388. }
  11389. this.designScope.showDesigner(sender, {
  11390. moduleId: this.moduleId,
  11391. });
  11392. if (this.viewDesign) {
  11393. return;
  11394. }
  11395. _$2.defer(function () {
  11396. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11397. handles$1.mainWindow.setLoading(false);
  11398. });
  11399. };
  11400. ModulePage.prototype.previewReRender = function () {
  11401. var designer = this.refs.designer;
  11402. this.previewRender(designer);
  11403. };
  11404. ModulePage.prototype.initEditor = function (moduleItem) {
  11405. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11406. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11407. return;
  11408. (_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);
  11409. (_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);
  11410. (_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);
  11411. (_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);
  11412. (_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);
  11413. };
  11414. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11415. this.currentComponentSelectId = id;
  11416. };
  11417. ModulePage.prototype.onUndo = function () {
  11418. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11419. this.viewDesign.onUndo();
  11420. }
  11421. };
  11422. ModulePage.prototype.onRedo = function () {
  11423. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11424. this.viewDesign.onRedo();
  11425. }
  11426. };
  11427. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11428. this.activeEditor = newCard;
  11429. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11430. };
  11431. ModulePage.prototype.saveCall = function () {
  11432. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11433. moduleStore.saveFile(this.moduleId, "jsView");
  11434. }
  11435. else if (this.activeEditor === this.refs.controllerEditor) {
  11436. moduleStore.saveFile(this.moduleId, "jsController");
  11437. }
  11438. else if (this.activeEditor === this.refs.modelEditor) {
  11439. moduleStore.saveFile(this.moduleId, "jsModel");
  11440. }
  11441. else if (this.activeEditor === this.refs.groovyEditor) {
  11442. moduleStore.saveFile(this.moduleId, "groovy");
  11443. }
  11444. else if (this.activeEditor === this.refs.sqlEditor) {
  11445. moduleStore.saveFile(this.moduleId, "mybatis");
  11446. }
  11447. };
  11448. ModulePage.prototype.check = function () {
  11449. moduleStore.check(this.moduleId);
  11450. };
  11451. /**
  11452. * 为vjson添加id
  11453. * @param vjson
  11454. * @param isAll
  11455. */
  11456. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11457. var _this = this;
  11458. if (isAll === void 0) { isAll = false; }
  11459. var maxIdTag = 0;
  11460. // 先提取当前的最大id
  11461. deepTravVJson(vjson, function (obj) {
  11462. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11463. return;
  11464. }
  11465. if (obj.id && obj.id.indexOf(idPrefix)) {
  11466. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11467. if (sutr.length > 0) {
  11468. var tid = sutr.replace(idPrefix, "");
  11469. var idNum = parseInt(tid);
  11470. if (idNum && maxIdTag < idNum) {
  11471. maxIdTag = idNum;
  11472. }
  11473. }
  11474. }
  11475. });
  11476. // 标记最大的id号,避免重复
  11477. this.maxViewId = maxIdTag;
  11478. deepTravVJson(vjson, function (obj) {
  11479. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11480. return;
  11481. }
  11482. if (!obj.hasOwnProperty('id')) {
  11483. obj.id = _this.createViewId();
  11484. }
  11485. if (!obj.hasOwnProperty('designMode')) {
  11486. obj.designMode = true;
  11487. }
  11488. // if (obj.xtype == "tabview" && obj.activeTab) {
  11489. // // 设置默认的选项
  11490. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11491. // if (typeof obj.activeTab === 'number') {
  11492. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11493. // } else if (typeof obj.activeTab === 'string') {
  11494. // this._tabViewSelect[obj.id] = obj.activeTab
  11495. // }
  11496. //
  11497. // }
  11498. // }
  11499. if (isAll && obj.hasOwnProperty("view")) ;
  11500. });
  11501. return vjson;
  11502. };
  11503. /**
  11504. * 为组件创建 ID
  11505. */
  11506. ModulePage.prototype.createViewId = function () {
  11507. this.maxViewId++;
  11508. return this.id + idPrefix + this.maxViewId;
  11509. };
  11510. ModulePage.prototype.onDestroy = function () {
  11511. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11512. this.cancelSubscribe[i].cancel();
  11513. }
  11514. _super.prototype.onDestroy.call(this);
  11515. };
  11516. return ModulePage;
  11517. }(Scope));
  11518. //# sourceMappingURL=ModulePage.js.map
  11519. var camundaModdleDescriptor = {
  11520. "name": "Camunda",
  11521. "uri": "http://camunda.org/schema/1.0/bpmn",
  11522. "prefix": "camunda",
  11523. "xml": {
  11524. "tagAlias": "lowerCase"
  11525. },
  11526. "associations": [],
  11527. "types": [
  11528. {
  11529. "name": "Definitions",
  11530. "isAbstract": true,
  11531. "extends": [
  11532. "bpmn:Definitions"
  11533. ],
  11534. "properties": [
  11535. {
  11536. "name": "diagramRelationId",
  11537. "isAttr": true,
  11538. "type": "String"
  11539. }
  11540. ]
  11541. },
  11542. {
  11543. "name": "InOutBinding",
  11544. "superClass": [
  11545. "Element"
  11546. ],
  11547. "isAbstract": true,
  11548. "properties": [
  11549. {
  11550. "name": "source",
  11551. "isAttr": true,
  11552. "type": "String"
  11553. },
  11554. {
  11555. "name": "sourceExpression",
  11556. "isAttr": true,
  11557. "type": "String"
  11558. },
  11559. {
  11560. "name": "target",
  11561. "isAttr": true,
  11562. "type": "String"
  11563. },
  11564. {
  11565. "name": "businessKey",
  11566. "isAttr": true,
  11567. "type": "String"
  11568. },
  11569. {
  11570. "name": "local",
  11571. "isAttr": true,
  11572. "type": "Boolean",
  11573. "default": false
  11574. },
  11575. {
  11576. "name": "variables",
  11577. "isAttr": true,
  11578. "type": "String"
  11579. }
  11580. ]
  11581. },
  11582. {
  11583. "name": "In",
  11584. "superClass": [
  11585. "InOutBinding"
  11586. ],
  11587. "meta": {
  11588. "allowedIn": [
  11589. "bpmn:CallActivity",
  11590. "bpmn:SignalEventDefinition"
  11591. ]
  11592. }
  11593. },
  11594. {
  11595. "name": "Out",
  11596. "superClass": [
  11597. "InOutBinding"
  11598. ],
  11599. "meta": {
  11600. "allowedIn": [
  11601. "bpmn:CallActivity"
  11602. ]
  11603. }
  11604. },
  11605. {
  11606. "name": "AsyncCapable",
  11607. "isAbstract": true,
  11608. "extends": [
  11609. "bpmn:Activity",
  11610. "bpmn:Gateway",
  11611. "bpmn:Event"
  11612. ],
  11613. "properties": [
  11614. {
  11615. "name": "async",
  11616. "isAttr": true,
  11617. "type": "Boolean",
  11618. "default": false
  11619. },
  11620. {
  11621. "name": "asyncBefore",
  11622. "isAttr": true,
  11623. "type": "Boolean",
  11624. "default": false
  11625. },
  11626. {
  11627. "name": "asyncAfter",
  11628. "isAttr": true,
  11629. "type": "Boolean",
  11630. "default": false
  11631. },
  11632. {
  11633. "name": "exclusive",
  11634. "isAttr": true,
  11635. "type": "Boolean",
  11636. "default": true
  11637. }
  11638. ]
  11639. },
  11640. {
  11641. "name": "JobPriorized",
  11642. "isAbstract": true,
  11643. "extends": [
  11644. "bpmn:Process",
  11645. "camunda:AsyncCapable"
  11646. ],
  11647. "properties": [
  11648. {
  11649. "name": "jobPriority",
  11650. "isAttr": true,
  11651. "type": "String"
  11652. }
  11653. ]
  11654. },
  11655. {
  11656. "name": "SignalEventDefinitionExtension",
  11657. "isAbstract": true,
  11658. "extends": [
  11659. "bpmn:SignalEventDefinition"
  11660. ],
  11661. "properties": [
  11662. {
  11663. "name": "async",
  11664. "isAttr": true,
  11665. "type": "Boolean",
  11666. "default": false
  11667. }
  11668. ]
  11669. },
  11670. {
  11671. "name": "ErrorEventDefinitionExtension",
  11672. "isAbstract": true,
  11673. "extends": [
  11674. "bpmn:ErrorEventDefinition"
  11675. ],
  11676. "properties": [
  11677. {
  11678. "name": "errorCodeVariable",
  11679. "isAttr": true,
  11680. "type": "String"
  11681. },
  11682. {
  11683. "name": "errorMessageVariable",
  11684. "isAttr": true,
  11685. "type": "String"
  11686. }
  11687. ]
  11688. },
  11689. {
  11690. "name": "ErrorEventDefinition",
  11691. "superClass": [
  11692. "bpmn:ErrorEventDefinition",
  11693. "Element"
  11694. ],
  11695. "properties": [
  11696. {
  11697. "name": "expression",
  11698. "isAttr": true,
  11699. "type": "String"
  11700. }
  11701. ],
  11702. "meta": {
  11703. "allowedIn": ["bpmn:ServiceTask"]
  11704. }
  11705. },
  11706. {
  11707. "name": "Error",
  11708. "isAbstract": true,
  11709. "extends": [
  11710. "bpmn:Error"
  11711. ],
  11712. "properties": [
  11713. {
  11714. "name": "camunda:errorMessage",
  11715. "isAttr": true,
  11716. "type": "String"
  11717. }
  11718. ]
  11719. },
  11720. {
  11721. "name": "PotentialStarter",
  11722. "superClass": [
  11723. "Element"
  11724. ],
  11725. "properties": [
  11726. {
  11727. "name": "resourceAssignmentExpression",
  11728. "type": "bpmn:ResourceAssignmentExpression"
  11729. }
  11730. ]
  11731. },
  11732. {
  11733. "name": "FormSupported",
  11734. "isAbstract": true,
  11735. "extends": [
  11736. "bpmn:StartEvent",
  11737. "bpmn:UserTask"
  11738. ],
  11739. "properties": [
  11740. {
  11741. "name": "formHandlerClass",
  11742. "isAttr": true,
  11743. "type": "String"
  11744. },
  11745. {
  11746. "name": "formKey",
  11747. "isAttr": true,
  11748. "type": "String"
  11749. },
  11750. {
  11751. "name": "formRef",
  11752. "isAttr": true,
  11753. "type": "String"
  11754. },
  11755. {
  11756. "name": "formRefBinding",
  11757. "isAttr": true,
  11758. "type": "String"
  11759. },
  11760. {
  11761. "name": "formRefVersion",
  11762. "isAttr": true,
  11763. "type": "String"
  11764. }
  11765. ]
  11766. },
  11767. {
  11768. "name": "TemplateSupported",
  11769. "isAbstract": true,
  11770. "extends": [
  11771. "bpmn:Collaboration",
  11772. "bpmn:Process",
  11773. "bpmn:FlowElement"
  11774. ],
  11775. "properties": [
  11776. {
  11777. "name": "modelerTemplate",
  11778. "isAttr": true,
  11779. "type": "String"
  11780. },
  11781. {
  11782. "name": "modelerTemplateVersion",
  11783. "isAttr": true,
  11784. "type": "Integer"
  11785. }
  11786. ]
  11787. },
  11788. {
  11789. "name": "Initiator",
  11790. "isAbstract": true,
  11791. "extends": ["bpmn:StartEvent"],
  11792. "properties": [
  11793. {
  11794. "name": "initiator",
  11795. "isAttr": true,
  11796. "type": "String"
  11797. }
  11798. ]
  11799. },
  11800. {
  11801. "name": "ScriptTask",
  11802. "isAbstract": true,
  11803. "extends": [
  11804. "bpmn:ScriptTask"
  11805. ],
  11806. "properties": [
  11807. {
  11808. "name": "resultVariable",
  11809. "isAttr": true,
  11810. "type": "String"
  11811. },
  11812. {
  11813. "name": "resource",
  11814. "isAttr": true,
  11815. "type": "String"
  11816. }
  11817. ]
  11818. },
  11819. {
  11820. "name": "Process",
  11821. "isAbstract": true,
  11822. "extends": [
  11823. "bpmn:Process"
  11824. ],
  11825. "properties": [
  11826. {
  11827. "name": "candidateStarterGroups",
  11828. "isAttr": true,
  11829. "type": "String"
  11830. },
  11831. {
  11832. "name": "candidateStarterUsers",
  11833. "isAttr": true,
  11834. "type": "String"
  11835. },
  11836. {
  11837. "name": "versionTag",
  11838. "isAttr": true,
  11839. "type": "String"
  11840. },
  11841. {
  11842. "name": "historyTimeToLive",
  11843. "isAttr": true,
  11844. "type": "String"
  11845. },
  11846. {
  11847. "name": "isStartableInTasklist",
  11848. "isAttr": true,
  11849. "type": "Boolean",
  11850. "default": true
  11851. }
  11852. ]
  11853. },
  11854. {
  11855. "name": "EscalationEventDefinitionExtension",
  11856. "isAbstract": true,
  11857. "extends": [
  11858. "bpmn:EscalationEventDefinition"
  11859. ],
  11860. "properties": [
  11861. {
  11862. "name": "escalationCodeVariable",
  11863. "isAttr": true,
  11864. "type": "String"
  11865. }
  11866. ]
  11867. },
  11868. {
  11869. "name": "FormalExpression",
  11870. "isAbstract": true,
  11871. "extends": [
  11872. "bpmn:FormalExpression"
  11873. ],
  11874. "properties": [
  11875. {
  11876. "name": "resource",
  11877. "isAttr": true,
  11878. "type": "String"
  11879. }
  11880. ]
  11881. },
  11882. {
  11883. "name": "Assignable",
  11884. "extends": ["bpmn:UserTask"],
  11885. "properties": [
  11886. {
  11887. "name": "assignee",
  11888. "isAttr": true,
  11889. "type": "String"
  11890. },
  11891. {
  11892. "name": "candidateUsers",
  11893. "isAttr": true,
  11894. "type": "String"
  11895. },
  11896. {
  11897. "name": "candidateGroups",
  11898. "isAttr": true,
  11899. "type": "String"
  11900. },
  11901. {
  11902. "name": "dueDate",
  11903. "isAttr": true,
  11904. "type": "String"
  11905. },
  11906. {
  11907. "name": "followUpDate",
  11908. "isAttr": true,
  11909. "type": "String"
  11910. },
  11911. {
  11912. "name": "priority",
  11913. "isAttr": true,
  11914. "type": "String"
  11915. }
  11916. ]
  11917. },
  11918. {
  11919. "name": "CallActivity",
  11920. "extends": ["bpmn:CallActivity"],
  11921. "properties": [
  11922. {
  11923. "name": "calledElementBinding",
  11924. "isAttr": true,
  11925. "type": "String",
  11926. "default": "latest"
  11927. },
  11928. {
  11929. "name": "calledElementVersion",
  11930. "isAttr": true,
  11931. "type": "String"
  11932. },
  11933. {
  11934. "name": "calledElementVersionTag",
  11935. "isAttr": true,
  11936. "type": "String"
  11937. },
  11938. {
  11939. "name": "calledElementTenantId",
  11940. "isAttr": true,
  11941. "type": "String"
  11942. },
  11943. {
  11944. "name": "caseRef",
  11945. "isAttr": true,
  11946. "type": "String"
  11947. },
  11948. {
  11949. "name": "caseBinding",
  11950. "isAttr": true,
  11951. "type": "String",
  11952. "default": "latest"
  11953. },
  11954. {
  11955. "name": "caseVersion",
  11956. "isAttr": true,
  11957. "type": "String"
  11958. },
  11959. {
  11960. "name": "caseTenantId",
  11961. "isAttr": true,
  11962. "type": "String"
  11963. },
  11964. {
  11965. "name": "variableMappingClass",
  11966. "isAttr": true,
  11967. "type": "String"
  11968. },
  11969. {
  11970. "name": "variableMappingDelegateExpression",
  11971. "isAttr": true,
  11972. "type": "String"
  11973. }
  11974. ]
  11975. },
  11976. {
  11977. "name": "ServiceTaskLike",
  11978. "extends": [
  11979. "bpmn:ServiceTask",
  11980. "bpmn:BusinessRuleTask",
  11981. "bpmn:SendTask",
  11982. "bpmn:MessageEventDefinition"
  11983. ],
  11984. "properties": [
  11985. {
  11986. "name": "expression",
  11987. "isAttr": true,
  11988. "type": "String"
  11989. },
  11990. {
  11991. "name": "class",
  11992. "isAttr": true,
  11993. "type": "String"
  11994. },
  11995. {
  11996. "name": "delegateExpression",
  11997. "isAttr": true,
  11998. "type": "String"
  11999. },
  12000. {
  12001. "name": "resultVariable",
  12002. "isAttr": true,
  12003. "type": "String"
  12004. }
  12005. ]
  12006. },
  12007. {
  12008. "name": "DmnCapable",
  12009. "extends": [
  12010. "bpmn:BusinessRuleTask"
  12011. ],
  12012. "properties": [
  12013. {
  12014. "name": "decisionRef",
  12015. "isAttr": true,
  12016. "type": "String"
  12017. },
  12018. {
  12019. "name": "decisionRefBinding",
  12020. "isAttr": true,
  12021. "type": "String",
  12022. "default": "latest"
  12023. },
  12024. {
  12025. "name": "decisionRefVersion",
  12026. "isAttr": true,
  12027. "type": "String"
  12028. },
  12029. {
  12030. "name": "mapDecisionResult",
  12031. "isAttr": true,
  12032. "type": "String",
  12033. "default": "resultList"
  12034. },
  12035. {
  12036. "name": "decisionRefTenantId",
  12037. "isAttr": true,
  12038. "type": "String"
  12039. }
  12040. ]
  12041. },
  12042. {
  12043. "name": "ExternalCapable",
  12044. "extends": [
  12045. "camunda:ServiceTaskLike"
  12046. ],
  12047. "properties": [
  12048. {
  12049. "name": "type",
  12050. "isAttr": true,
  12051. "type": "String"
  12052. },
  12053. {
  12054. "name": "topic",
  12055. "isAttr": true,
  12056. "type": "String"
  12057. }
  12058. ]
  12059. },
  12060. {
  12061. "name": "TaskPriorized",
  12062. "extends": [
  12063. "bpmn:Process",
  12064. "camunda:ExternalCapable"
  12065. ],
  12066. "properties": [
  12067. {
  12068. "name": "taskPriority",
  12069. "isAttr": true,
  12070. "type": "String"
  12071. }
  12072. ]
  12073. },
  12074. {
  12075. "name": "Properties",
  12076. "superClass": [
  12077. "Element"
  12078. ],
  12079. "meta": {
  12080. "allowedIn": ["*"]
  12081. },
  12082. "properties": [
  12083. {
  12084. "name": "values",
  12085. "type": "Property",
  12086. "isMany": true
  12087. }
  12088. ]
  12089. },
  12090. {
  12091. "name": "Property",
  12092. "superClass": [
  12093. "Element"
  12094. ],
  12095. "properties": [
  12096. {
  12097. "name": "id",
  12098. "type": "String",
  12099. "isAttr": true
  12100. },
  12101. {
  12102. "name": "name",
  12103. "type": "String",
  12104. "isAttr": true
  12105. },
  12106. {
  12107. "name": "value",
  12108. "type": "String",
  12109. "isAttr": true
  12110. }
  12111. ]
  12112. },
  12113. {
  12114. "name": "Connector",
  12115. "superClass": [
  12116. "Element"
  12117. ],
  12118. "meta": {
  12119. "allowedIn": [
  12120. "camunda:ServiceTaskLike"
  12121. ]
  12122. },
  12123. "properties": [
  12124. {
  12125. "name": "inputOutput",
  12126. "type": "InputOutput"
  12127. },
  12128. {
  12129. "name": "connectorId",
  12130. "type": "String"
  12131. }
  12132. ]
  12133. },
  12134. {
  12135. "name": "InputOutput",
  12136. "superClass": [
  12137. "Element"
  12138. ],
  12139. "meta": {
  12140. "allowedIn": [
  12141. "bpmn:FlowNode",
  12142. "camunda:Connector"
  12143. ]
  12144. },
  12145. "properties": [
  12146. {
  12147. "name": "inputOutput",
  12148. "type": "InputOutput"
  12149. },
  12150. {
  12151. "name": "connectorId",
  12152. "type": "String"
  12153. },
  12154. {
  12155. "name": "inputParameters",
  12156. "isMany": true,
  12157. "type": "InputParameter"
  12158. },
  12159. {
  12160. "name": "outputParameters",
  12161. "isMany": true,
  12162. "type": "OutputParameter"
  12163. }
  12164. ]
  12165. },
  12166. {
  12167. "name": "InputOutputParameter",
  12168. "properties": [
  12169. {
  12170. "name": "name",
  12171. "isAttr": true,
  12172. "type": "String"
  12173. },
  12174. {
  12175. "name": "value",
  12176. "isBody": true,
  12177. "type": "String"
  12178. },
  12179. {
  12180. "name": "definition",
  12181. "type": "InputOutputParameterDefinition"
  12182. }
  12183. ]
  12184. },
  12185. {
  12186. "name": "InputOutputParameterDefinition",
  12187. "isAbstract": true
  12188. },
  12189. {
  12190. "name": "List",
  12191. "superClass": ["InputOutputParameterDefinition"],
  12192. "properties": [
  12193. {
  12194. "name": "items",
  12195. "isMany": true,
  12196. "type": "InputOutputParameterDefinition"
  12197. }
  12198. ]
  12199. },
  12200. {
  12201. "name": "Map",
  12202. "superClass": ["InputOutputParameterDefinition"],
  12203. "properties": [
  12204. {
  12205. "name": "entries",
  12206. "isMany": true,
  12207. "type": "Entry"
  12208. }
  12209. ]
  12210. },
  12211. {
  12212. "name": "Entry",
  12213. "properties": [
  12214. {
  12215. "name": "key",
  12216. "isAttr": true,
  12217. "type": "String"
  12218. },
  12219. {
  12220. "name": "value",
  12221. "isBody": true,
  12222. "type": "String"
  12223. },
  12224. {
  12225. "name": "definition",
  12226. "type": "InputOutputParameterDefinition"
  12227. }
  12228. ]
  12229. },
  12230. {
  12231. "name": "Value",
  12232. "superClass": [
  12233. "InputOutputParameterDefinition"
  12234. ],
  12235. "properties": [
  12236. {
  12237. "name": "id",
  12238. "isAttr": true,
  12239. "type": "String"
  12240. },
  12241. {
  12242. "name": "name",
  12243. "isAttr": true,
  12244. "type": "String"
  12245. },
  12246. {
  12247. "name": "value",
  12248. "isBody": true,
  12249. "type": "String"
  12250. }
  12251. ]
  12252. },
  12253. {
  12254. "name": "Script",
  12255. "superClass": ["InputOutputParameterDefinition"],
  12256. "properties": [
  12257. {
  12258. "name": "scriptFormat",
  12259. "isAttr": true,
  12260. "type": "String"
  12261. },
  12262. {
  12263. "name": "resource",
  12264. "isAttr": true,
  12265. "type": "String"
  12266. },
  12267. {
  12268. "name": "value",
  12269. "isBody": true,
  12270. "type": "String"
  12271. }
  12272. ]
  12273. },
  12274. {
  12275. "name": "Field",
  12276. "superClass": ["Element"],
  12277. "meta": {
  12278. "allowedIn": [
  12279. "camunda:ServiceTaskLike",
  12280. "camunda:ExecutionListener",
  12281. "camunda:TaskListener"
  12282. ]
  12283. },
  12284. "properties": [
  12285. {
  12286. "name": "name",
  12287. "isAttr": true,
  12288. "type": "String"
  12289. },
  12290. {
  12291. "name": "expression",
  12292. "type": "String"
  12293. },
  12294. {
  12295. "name": "stringValue",
  12296. "isAttr": true,
  12297. "type": "String"
  12298. },
  12299. {
  12300. "name": "string",
  12301. "type": "String"
  12302. }
  12303. ]
  12304. },
  12305. {
  12306. "name": "InputParameter",
  12307. "superClass": ["InputOutputParameter"]
  12308. },
  12309. {
  12310. "name": "OutputParameter",
  12311. "superClass": ["InputOutputParameter"]
  12312. },
  12313. {
  12314. "name": "Collectable",
  12315. "isAbstract": true,
  12316. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12317. "superClass": ["camunda:AsyncCapable"],
  12318. "properties": [
  12319. {
  12320. "name": "collection",
  12321. "isAttr": true,
  12322. "type": "String"
  12323. },
  12324. {
  12325. "name": "elementVariable",
  12326. "isAttr": true,
  12327. "type": "String"
  12328. }
  12329. ]
  12330. },
  12331. {
  12332. "name": "FailedJobRetryTimeCycle",
  12333. "superClass": ["Element"],
  12334. "meta": {
  12335. "allowedIn": [
  12336. "camunda:AsyncCapable",
  12337. "bpmn:MultiInstanceLoopCharacteristics"
  12338. ]
  12339. },
  12340. "properties": [
  12341. {
  12342. "name": "body",
  12343. "isBody": true,
  12344. "type": "String"
  12345. }
  12346. ]
  12347. },
  12348. {
  12349. "name": "ExecutionListener",
  12350. "superClass": ["Element"],
  12351. "meta": {
  12352. "allowedIn": [
  12353. "bpmn:Task",
  12354. "bpmn:ServiceTask",
  12355. "bpmn:UserTask",
  12356. "bpmn:BusinessRuleTask",
  12357. "bpmn:ScriptTask",
  12358. "bpmn:ReceiveTask",
  12359. "bpmn:ManualTask",
  12360. "bpmn:ExclusiveGateway",
  12361. "bpmn:SequenceFlow",
  12362. "bpmn:ParallelGateway",
  12363. "bpmn:InclusiveGateway",
  12364. "bpmn:EventBasedGateway",
  12365. "bpmn:StartEvent",
  12366. "bpmn:IntermediateCatchEvent",
  12367. "bpmn:IntermediateThrowEvent",
  12368. "bpmn:EndEvent",
  12369. "bpmn:BoundaryEvent",
  12370. "bpmn:CallActivity",
  12371. "bpmn:SubProcess",
  12372. "bpmn:Process"
  12373. ]
  12374. },
  12375. "properties": [
  12376. {
  12377. "name": "expression",
  12378. "isAttr": true,
  12379. "type": "String"
  12380. },
  12381. {
  12382. "name": "class",
  12383. "isAttr": true,
  12384. "type": "String"
  12385. },
  12386. {
  12387. "name": "delegateExpression",
  12388. "isAttr": true,
  12389. "type": "String"
  12390. },
  12391. {
  12392. "name": "event",
  12393. "isAttr": true,
  12394. "type": "String"
  12395. },
  12396. {
  12397. "name": "script",
  12398. "type": "Script"
  12399. },
  12400. {
  12401. "name": "fields",
  12402. "type": "Field",
  12403. "isMany": true
  12404. }
  12405. ]
  12406. },
  12407. {
  12408. "name": "TaskListener",
  12409. "superClass": ["Element"],
  12410. "meta": {
  12411. "allowedIn": [
  12412. "bpmn:UserTask"
  12413. ]
  12414. },
  12415. "properties": [
  12416. {
  12417. "name": "expression",
  12418. "isAttr": true,
  12419. "type": "String"
  12420. },
  12421. {
  12422. "name": "class",
  12423. "isAttr": true,
  12424. "type": "String"
  12425. },
  12426. {
  12427. "name": "delegateExpression",
  12428. "isAttr": true,
  12429. "type": "String"
  12430. },
  12431. {
  12432. "name": "event",
  12433. "isAttr": true,
  12434. "type": "String"
  12435. },
  12436. {
  12437. "name": "script",
  12438. "type": "Script"
  12439. },
  12440. {
  12441. "name": "fields",
  12442. "type": "Field",
  12443. "isMany": true
  12444. },
  12445. {
  12446. "name": "id",
  12447. "type": "String",
  12448. "isAttr": true
  12449. },
  12450. {
  12451. "name": "eventDefinitions",
  12452. "type": "bpmn:TimerEventDefinition",
  12453. "isMany": true
  12454. }
  12455. ]
  12456. },
  12457. {
  12458. "name": "FormProperty",
  12459. "superClass": ["Element"],
  12460. "meta": {
  12461. "allowedIn": [
  12462. "bpmn:StartEvent",
  12463. "bpmn:UserTask"
  12464. ]
  12465. },
  12466. "properties": [
  12467. {
  12468. "name": "id",
  12469. "type": "String",
  12470. "isAttr": true
  12471. },
  12472. {
  12473. "name": "name",
  12474. "type": "String",
  12475. "isAttr": true
  12476. },
  12477. {
  12478. "name": "type",
  12479. "type": "String",
  12480. "isAttr": true
  12481. },
  12482. {
  12483. "name": "required",
  12484. "type": "String",
  12485. "isAttr": true
  12486. },
  12487. {
  12488. "name": "readable",
  12489. "type": "String",
  12490. "isAttr": true
  12491. },
  12492. {
  12493. "name": "writable",
  12494. "type": "String",
  12495. "isAttr": true
  12496. },
  12497. {
  12498. "name": "variable",
  12499. "type": "String",
  12500. "isAttr": true
  12501. },
  12502. {
  12503. "name": "expression",
  12504. "type": "String",
  12505. "isAttr": true
  12506. },
  12507. {
  12508. "name": "datePattern",
  12509. "type": "String",
  12510. "isAttr": true
  12511. },
  12512. {
  12513. "name": "default",
  12514. "type": "String",
  12515. "isAttr": true
  12516. },
  12517. {
  12518. "name": "values",
  12519. "type": "Value",
  12520. "isMany": true
  12521. }
  12522. ]
  12523. },
  12524. {
  12525. "name": "FormData",
  12526. "superClass": ["Element"],
  12527. "meta": {
  12528. "allowedIn": [
  12529. "bpmn:StartEvent",
  12530. "bpmn:UserTask"
  12531. ]
  12532. },
  12533. "properties": [
  12534. {
  12535. "name": "fields",
  12536. "type": "FormField",
  12537. "isMany": true
  12538. },
  12539. {
  12540. "name": "businessKey",
  12541. "type": "String",
  12542. "isAttr": true
  12543. }
  12544. ]
  12545. },
  12546. {
  12547. "name": "FormField",
  12548. "superClass": ["Element"],
  12549. "properties": [
  12550. {
  12551. "name": "id",
  12552. "type": "String",
  12553. "isAttr": true
  12554. },
  12555. {
  12556. "name": "label",
  12557. "type": "String",
  12558. "isAttr": true
  12559. },
  12560. {
  12561. "name": "type",
  12562. "type": "String",
  12563. "isAttr": true
  12564. },
  12565. {
  12566. "name": "datePattern",
  12567. "type": "String",
  12568. "isAttr": true
  12569. },
  12570. {
  12571. "name": "defaultValue",
  12572. "type": "String",
  12573. "isAttr": true
  12574. },
  12575. {
  12576. "name": "properties",
  12577. "type": "Properties"
  12578. },
  12579. {
  12580. "name": "validation",
  12581. "type": "Validation"
  12582. },
  12583. {
  12584. "name": "values",
  12585. "type": "Value",
  12586. "isMany": true
  12587. }
  12588. ]
  12589. },
  12590. {
  12591. "name": "Validation",
  12592. "superClass": ["Element"],
  12593. "properties": [
  12594. {
  12595. "name": "constraints",
  12596. "type": "Constraint",
  12597. "isMany": true
  12598. }
  12599. ]
  12600. },
  12601. {
  12602. "name": "Constraint",
  12603. "superClass": ["Element"],
  12604. "properties": [
  12605. {
  12606. "name": "name",
  12607. "type": "String",
  12608. "isAttr": true
  12609. },
  12610. {
  12611. "name": "config",
  12612. "type": "String",
  12613. "isAttr": true
  12614. }
  12615. ]
  12616. },
  12617. {
  12618. "name": "ConditionalEventDefinitionExtension",
  12619. "isAbstract": true,
  12620. "extends": [
  12621. "bpmn:ConditionalEventDefinition"
  12622. ],
  12623. "properties": [
  12624. {
  12625. "name": "variableName",
  12626. "isAttr": true,
  12627. "type": "String"
  12628. },
  12629. {
  12630. "name": "variableEvents",
  12631. "isAttr": true,
  12632. "type": "String"
  12633. }
  12634. ]
  12635. }
  12636. ],
  12637. "emumerations": []
  12638. };
  12639. //# sourceMappingURL=camundaModdleDescriptor.js.map
  12640. /**
  12641. * This is a sample file that should be replaced with the actual translation.
  12642. *
  12643. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12644. * translations and labels to translate.
  12645. */
  12646. var translations = {
  12647. // Labels
  12648. 'Activate the global connect tool': '激活全局连接工具',
  12649. 'Append {type}': '追加 {type}',
  12650. 'Append EndEvent': '追加 结束事件 ',
  12651. 'Append Task': '追加 任务',
  12652. 'Append Gateway': '追加 网关',
  12653. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12654. 'Add Lane above': '在上面添加道',
  12655. 'Divide into two Lanes': '分割成两个道',
  12656. 'Divide into three Lanes': '分割成三个道',
  12657. 'Add Lane below': '在下面添加道',
  12658. 'Append compensation activity': '追加补偿活动',
  12659. 'Change type': '修改类型',
  12660. 'Connect using Association': '使用关联连接',
  12661. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12662. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12663. 'Remove': '移除',
  12664. 'Activate the hand tool': '激活抓手工具',
  12665. 'Activate the lasso tool': '激活套索工具',
  12666. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12667. 'Create expanded SubProcess': '创建扩展子过程',
  12668. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12669. 'Create Pool/Participant': '创建池/参与者',
  12670. 'Parallel Multi Instance': '并行多重事件',
  12671. 'Sequential Multi Instance': '时序多重事件',
  12672. 'DataObjectReference': '数据对象参考',
  12673. 'DataStoreReference': '数据存储参考',
  12674. 'Loop': '循环',
  12675. 'Ad-hoc': '即席',
  12676. 'Create {type}': '创建 {type}',
  12677. 'Create Task': '创建任务',
  12678. 'Create StartEvent': '创建开始事件',
  12679. 'Create EndEvent': '创建结束事件',
  12680. 'Create Group': '创建组',
  12681. 'Task': '任务',
  12682. 'Send Task': '发送任务',
  12683. 'Receive Task': '接收任务',
  12684. 'User Task': '用户任务',
  12685. 'Manual Task': '手工任务',
  12686. 'Business Rule Task': '业务规则任务',
  12687. 'Service Task': '服务任务',
  12688. 'Script Task': '脚本任务',
  12689. 'Call Activity': '调用活动',
  12690. 'Sub Process (collapsed)': '子流程(折叠的)',
  12691. 'Sub Process (expanded)': '子流程(展开的)',
  12692. 'Start Event': '开始事件',
  12693. 'StartEvent': '开始事件',
  12694. 'Intermediate Throw Event': '中间事件',
  12695. 'End Event': '结束事件',
  12696. 'EndEvent': '结束事件',
  12697. 'Create Gateway': '创建网关',
  12698. 'GateWay': '网关',
  12699. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12700. 'Message Start Event': '消息开始事件',
  12701. 'Timer Start Event': '定时开始事件',
  12702. 'Conditional Start Event': '条件开始事件',
  12703. 'Signal Start Event': '信号开始事件',
  12704. 'Error Start Event': '错误开始事件',
  12705. 'Escalation Start Event': '升级开始事件',
  12706. 'Compensation Start Event': '补偿开始事件',
  12707. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12708. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12709. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12710. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12711. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12712. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12713. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12714. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12715. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12716. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12717. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12718. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12719. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12720. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12721. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12722. 'Message End Event': '消息结束事件',
  12723. 'Escalation End Event': '定时结束事件',
  12724. 'Error End Event': '错误结束事件',
  12725. 'Cancel End Event': '取消结束事件',
  12726. 'Compensation End Event': '补偿结束事件',
  12727. 'Signal End Event': '信号结束事件',
  12728. 'Terminate End Event': '终止结束事件',
  12729. 'Message Boundary Event': '消息边界事件',
  12730. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12731. 'Timer Boundary Event': '定时边界事件',
  12732. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12733. 'Escalation Boundary Event': '升级边界事件',
  12734. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12735. 'Conditional Boundary Event': '条件边界事件',
  12736. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12737. 'Error Boundary Event': '错误边界事件',
  12738. 'Cancel Boundary Event': '取消边界事件',
  12739. 'Signal Boundary Event': '信号边界事件',
  12740. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12741. 'Compensation Boundary Event': '补偿边界事件',
  12742. 'Exclusive Gateway': '互斥网关',
  12743. 'Parallel Gateway': '并行网关',
  12744. 'Inclusive Gateway': '相容网关',
  12745. 'Complex Gateway': '复杂网关',
  12746. 'Event based Gateway': '事件网关',
  12747. 'Transaction': '转运',
  12748. 'Sub Process': '子流程',
  12749. 'Event Sub Process': '事件子流程',
  12750. 'Collapsed Pool': '折叠池',
  12751. 'Expanded Pool': '展开池',
  12752. // Errors
  12753. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12754. 'no shape type specified': '没有指定的形状类型',
  12755. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12756. 'out of bounds release': 'out of bounds release',
  12757. 'more than {count} child lanes': '子道大于{count} ',
  12758. 'element required': '元素不能为空',
  12759. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12760. 'no diagram to display': '没有可展示的流程图',
  12761. 'no process or collaboration to display': '没有可展示的流程/协作',
  12762. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12763. 'already rendered {element}': '{element} 已被渲染',
  12764. 'failed to import {element}': '导入{element}失败',
  12765. // 属性面板的参数
  12766. 'Id': '编号',
  12767. 'Name': '名称',
  12768. 'General': '常规',
  12769. 'Details': '详情',
  12770. 'Message Name': '消息名称',
  12771. 'Message': '消息',
  12772. 'Initiator': '创建者',
  12773. 'Asynchronous Continuations': '持续异步',
  12774. 'Asynchronous Before': '异步前',
  12775. 'Asynchronous After': '异步后',
  12776. 'Job Configuration': '工作配置',
  12777. 'Exclusive': '排除',
  12778. 'Job Priority': '工作优先级',
  12779. 'Retry Time Cycle': '重试时间周期',
  12780. 'Documentation': '文档',
  12781. 'Element Documentation': '元素文档',
  12782. 'History Configuration': '历史配置',
  12783. 'History Time To Live': '历史的生存时间',
  12784. 'Forms': '表单',
  12785. 'Form Key': '表单key',
  12786. 'Form Fields': '表单字段',
  12787. 'Business Key': '业务key',
  12788. 'Form Field': '表单字段',
  12789. 'ID': '编号',
  12790. 'Type': '类型',
  12791. 'Label': '名称',
  12792. 'Default Value': '默认值',
  12793. 'Validation': '校验',
  12794. 'Add Constraint': '添加约束',
  12795. 'Config': '配置',
  12796. 'Properties': '属性',
  12797. 'Add Property': '添加属性',
  12798. 'Value': '值',
  12799. 'Add': '添加',
  12800. 'Values': '值',
  12801. 'Add Value': '添加值',
  12802. 'Listeners': '监听器',
  12803. 'Execution Listener': '执行监听',
  12804. 'Event Type': '事件类型',
  12805. 'Listener Type': '监听器类型',
  12806. 'Java Class': 'Java类',
  12807. 'Expression': '表达式',
  12808. 'Must provide a value': '必须提供一个值',
  12809. 'Delegate Expression': '代理表达式',
  12810. 'Script': '脚本',
  12811. 'Script Format': '脚本格式',
  12812. 'Script Type': '脚本类型',
  12813. 'Inline Script': '内联脚本',
  12814. 'External Script': '外部脚本',
  12815. 'Resource': '资源',
  12816. 'Field Injection': '字段注入',
  12817. 'Extensions': '扩展',
  12818. 'Input/Output': '输入/输出',
  12819. 'Input Parameters': '输入参数',
  12820. 'Output Parameters': '输出参数',
  12821. 'Parameters': '参数',
  12822. 'Output Parameter': '输出参数',
  12823. 'Timer Definition Type': '定时器定义类型',
  12824. 'Timer Definition': '定时器定义',
  12825. 'Date': '日期',
  12826. 'Duration': '持续',
  12827. 'Cycle': '循环',
  12828. 'Signal': '信号',
  12829. 'Signal Name': '信号名称',
  12830. 'Escalation': '升级',
  12831. 'Error': '错误',
  12832. 'Link Name': '链接名称',
  12833. 'Condition': '条件名称',
  12834. 'Variable Name': '变量名称',
  12835. 'Variable Event': '变量事件',
  12836. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12837. 'Wait for Completion': '等待完成',
  12838. 'Activity Ref': '活动参考',
  12839. 'Version Tag': '版本标签',
  12840. 'Executable': '可执行文件',
  12841. 'External Task Configuration': '扩展任务配置',
  12842. 'Task Priority': '任务优先级',
  12843. 'External': '外部',
  12844. 'Connector': '连接器',
  12845. 'Must configure Connector': '必须配置连接器',
  12846. 'Connector Id': '连接器编号',
  12847. 'Implementation': '实现方式',
  12848. 'Field Injections': '字段注入',
  12849. 'Fields': '字段',
  12850. 'Result Variable': '结果变量',
  12851. 'Topic': '主题',
  12852. 'Configure Connector': '配置连接器',
  12853. 'Input Parameter': '输入参数',
  12854. 'Assignee': '代理人',
  12855. 'Candidate Users': '候选用户',
  12856. 'Candidate Groups': '候选组',
  12857. 'Due Date': '到期时间',
  12858. 'Follow Up Date': '跟踪日期',
  12859. 'Priority': '优先级',
  12860. // eslint-disable-next-line no-template-curly-in-string
  12861. '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',
  12862. // eslint-disable-next-line no-template-curly-in-string
  12863. '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',
  12864. 'Variables': '变量',
  12865. 'Candidate Starter Configuration': '候选开始配置',
  12866. 'Task Listener': '任务监听器',
  12867. 'Candidate Starter Groups': '候选开始组',
  12868. 'Candidate Starter Users': '候选开始用户',
  12869. 'Tasklist Configuration': '任务列表配置',
  12870. 'Startable': '启动',
  12871. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12872. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12873. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12874. 'CallActivity Type': '调用活动类型',
  12875. 'Condition Type': '条件类型',
  12876. 'Create UserTask': '创建用户任务',
  12877. 'Create CallActivity': '创建调用活动',
  12878. 'Called Element': '调用元素',
  12879. 'Create DataObjectReference': '创建数据对象引用',
  12880. 'Create DataStoreReference': '创建数据存储引用',
  12881. 'Multi Instance': '多实例',
  12882. 'Loop Cardinality': '实例数量',
  12883. Collection: '任务参与人列表',
  12884. 'Element Variable': '元素变量',
  12885. 'Completion Condition': '完成条件'
  12886. };
  12887. //# sourceMappingURL=translations.js.map
  12888. function customTranslate(template, replacements) {
  12889. replacements = replacements || {};
  12890. // Translate
  12891. template = translations[template] || template;
  12892. // Replace
  12893. return template.replace(/{([^}]+)}/g, function (_, key) {
  12894. return replacements[key] || '{' + key + '}';
  12895. });
  12896. }
  12897. //# sourceMappingURL=customTranslate.js.map
  12898. var vjson$9 = {
  12899. title: '导入流程',
  12900. layout: 'fit',
  12901. width: 400,
  12902. height: 400,
  12903. items: [
  12904. {
  12905. layout: 'border',
  12906. items: [
  12907. {
  12908. xtype: 'form',
  12909. items: [
  12910. // {
  12911. // xtype: 'cols',
  12912. // items: [
  12913. // {
  12914. // xtype: 'textfield',
  12915. // allowBlank: false,
  12916. // fieldLabel: '流程名称',
  12917. // bind: '{name}'
  12918. // },
  12919. // ],
  12920. // },
  12921. {
  12922. xtype: 'cols',
  12923. items: [
  12924. {
  12925. xtype: 'filefield',
  12926. name: 'deployFile',
  12927. fieldLabel: '文件名称',
  12928. // labelWidth: '100%',
  12929. msgTarget: 'side',
  12930. reference: 'MOBANB_FILE',
  12931. fileUpload: true,
  12932. allowBlank: false,
  12933. // flex: 1,
  12934. // width: '100%',
  12935. buttonText: '请选择文件位置',
  12936. listeners: {
  12937. change: 'scope.fileChange'
  12938. }
  12939. // bind: '{FILE}'
  12940. },
  12941. ]
  12942. }
  12943. ],
  12944. region: 'center',
  12945. split: true,
  12946. },
  12947. ],
  12948. },
  12949. ],
  12950. fbar: {
  12951. xtype: 'toolbar',
  12952. items: [
  12953. {
  12954. xtype: 'button',
  12955. text: '保存',
  12956. iconCls: 'x-fa fa-save',
  12957. listeners: {
  12958. click: 'scope.save',
  12959. },
  12960. }
  12961. ],
  12962. },
  12963. };
  12964. //# sourceMappingURL=ImportBpmn.view.js.map
  12965. var model$9 = {
  12966. data: {
  12967. name: '',
  12968. file_content: ''
  12969. }
  12970. };
  12971. //# sourceMappingURL=ImportBpmn.model.js.map
  12972. var ImportBpmn = /** @class */ (function (_super) {
  12973. __extends(ImportBpmn, _super);
  12974. function ImportBpmn() {
  12975. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  12976. }
  12977. ImportBpmn.prototype.onLoad = function () {
  12978. };
  12979. ImportBpmn.prototype.save = function (sender) {
  12980. if (this.data.file_content) {
  12981. this.dialogSuccess(this.data);
  12982. }
  12983. else {
  12984. Ext.Msg.alert('提示', "请先上传文件");
  12985. }
  12986. };
  12987. ImportBpmn.prototype.fileChange = function (e) {
  12988. var _this = this;
  12989. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  12990. var file = e.fileInputEl.dom.files[0]; //获取文件
  12991. var reader = new FileReader();
  12992. reader.readAsText(file, "UTF-8");
  12993. reader.onload = function () {
  12994. _this.data.file_content = reader.result;
  12995. };
  12996. };
  12997. return ImportBpmn;
  12998. }(Scope));
  12999. //# sourceMappingURL=ImportBpmn.js.map
  13000. var model$a = {
  13001. data: {
  13002. form_id: '',
  13003. form_name: '',
  13004. save_dir_path: '',
  13005. absolute_path: '',
  13006. form: {
  13007. id: '',
  13008. code: '',
  13009. name: '',
  13010. table: '',
  13011. controller: '',
  13012. groovy: '',
  13013. fields: [],
  13014. buttons: [],
  13015. },
  13016. }
  13017. };
  13018. //# sourceMappingURL=ConfigStrategy.model.js.map
  13019. var vjson$a = {
  13020. title: '配置适配策略',
  13021. layout: 'fit',
  13022. items: [
  13023. {
  13024. layout: 'border',
  13025. items: [
  13026. {
  13027. region: 'center',
  13028. xtype: 'yvgrid',
  13029. pagination: false,
  13030. hideFootbar: true,
  13031. plugins: {
  13032. clipboard: true,
  13033. selectionreplicator: true
  13034. },
  13035. tbar: {
  13036. xtype: 'toolbar',
  13037. items: [
  13038. {
  13039. xtype: 'button',
  13040. text: '添加策略',
  13041. iconCls: 'x-fa fa-plus-circle',
  13042. listeners: {
  13043. click: 'scope.addStrategy'
  13044. }
  13045. },
  13046. {
  13047. xtype: 'button',
  13048. text: '删除',
  13049. iconCls: 'x-fa fa-minus-circle',
  13050. listeners: {}
  13051. },
  13052. '-',
  13053. {
  13054. xtype: 'button',
  13055. text: '上移',
  13056. iconCls: 'x-fa fa-arrow-up',
  13057. listeners: {}
  13058. },
  13059. {
  13060. xtype: 'button',
  13061. text: '下移',
  13062. iconCls: 'x-fa fa-arrow-down',
  13063. listeners: {}
  13064. },
  13065. ]
  13066. },
  13067. columns: [
  13068. { xtype: 'rownumberer' },
  13069. {
  13070. header: '优先级',
  13071. dataIndex: 'priority',
  13072. width: 140,
  13073. sortable: false,
  13074. menuDisabled: true,
  13075. editor: {
  13076. selectOnFocus: true
  13077. },
  13078. },
  13079. {
  13080. header: '策略编号',
  13081. dataIndex: 'strategy_code',
  13082. width: 140,
  13083. sortable: false,
  13084. menuDisabled: true,
  13085. editor: {
  13086. selectOnFocus: true
  13087. },
  13088. },
  13089. {
  13090. header: '策略名称',
  13091. dataIndex: 'strategy_name',
  13092. width: 140,
  13093. sortable: false,
  13094. menuDisabled: true,
  13095. editor: {
  13096. selectOnFocus: true
  13097. },
  13098. },
  13099. {
  13100. header: "条件表达式",
  13101. dataIndex: "strategy_exp",
  13102. },
  13103. ],
  13104. },
  13105. {
  13106. title: '适配条件',
  13107. region: 'south',
  13108. height: '50%',
  13109. xtype: 'form',
  13110. items: [
  13111. {
  13112. xtype: 'cols',
  13113. items: [
  13114. {
  13115. xtype: 'rows',
  13116. items: [
  13117. {
  13118. xtype: 'textfield',
  13119. fieldLabel: "仓库",
  13120. },
  13121. {
  13122. xtype: 'textfield',
  13123. fieldLabel: "货主",
  13124. },
  13125. {
  13126. xtype: 'textfield',
  13127. fieldLabel: "项目",
  13128. },
  13129. {
  13130. xtype: 'textfield',
  13131. fieldLabel: "行政区划",
  13132. },
  13133. {
  13134. xtype: 'textfield',
  13135. fieldLabel: "客户",
  13136. },
  13137. {
  13138. xtype: 'textfield',
  13139. fieldLabel: "商品",
  13140. }
  13141. ]
  13142. },
  13143. {
  13144. xtype: 'rows',
  13145. margin: '8 0 0 10',
  13146. items: [
  13147. {
  13148. xtype: 'label',
  13149. html: '自定义表达式',
  13150. },
  13151. {
  13152. xtype: 'textarea',
  13153. }
  13154. ]
  13155. }
  13156. ]
  13157. }
  13158. ]
  13159. }
  13160. ]
  13161. }
  13162. ]
  13163. };
  13164. //
  13165. //# sourceMappingURL=ConfigStrategy.view.js.map
  13166. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13167. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13168. // import ReportRunner from "./ReportRunner";
  13169. var ConfigStrategy = /** @class */ (function (_super) {
  13170. __extends(ConfigStrategy, _super);
  13171. function ConfigStrategy() {
  13172. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13173. }
  13174. ConfigStrategy.prototype.onLoad = function () {
  13175. this.load();
  13176. };
  13177. ConfigStrategy.prototype.load = function () {
  13178. var _this = this;
  13179. var form_id = this.viewModel.get("form_id");
  13180. var absolute_path = this.viewModel.get("absolute_path");
  13181. var save_dir_path = this.viewModel.get("save_dir_path");
  13182. if (absolute_path && form_id) {
  13183. this.setLoading(true);
  13184. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13185. if (res.success) {
  13186. // 基础属性
  13187. _this.viewModel.set('form', res.data.form);
  13188. // 字段定义
  13189. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13190. // 按钮
  13191. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13192. }
  13193. }).finally(function () {
  13194. _this.setLoading(false);
  13195. });
  13196. }
  13197. };
  13198. ConfigStrategy.prototype.saveAll = function () {
  13199. var _this = this;
  13200. var save_dir_path = this.viewModel.get("save_dir_path");
  13201. if (!save_dir_path) {
  13202. msg("save_dir_path error");
  13203. return;
  13204. }
  13205. var form_id = this.viewModel.get("form_id");
  13206. var absolute_path = this.viewModel.get("absolute_path");
  13207. // 表格校验
  13208. if (!this.refs.form1.isValid()) {
  13209. msg("请检查表单必填项!");
  13210. return;
  13211. }
  13212. // 字段数据
  13213. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13214. delete item.id;
  13215. if (item.hide) {
  13216. delete item.hide_text;
  13217. }
  13218. else {
  13219. item.hide = item.hide_text;
  13220. delete item.hide_text;
  13221. }
  13222. if (item.readonly) {
  13223. delete item.readonly_text;
  13224. }
  13225. else {
  13226. item.readonly = item.readonly_text;
  13227. delete item.readonly_text;
  13228. }
  13229. if (item.disabled) {
  13230. delete item.disabled_text;
  13231. }
  13232. else {
  13233. item.disabled = item.disabled_text;
  13234. delete item.disabled_text;
  13235. }
  13236. if (item.required) {
  13237. delete item.required_text;
  13238. }
  13239. else {
  13240. item.required = item.required_text;
  13241. delete item.required_text;
  13242. }
  13243. return item;
  13244. });
  13245. this.viewModel.set("form.fields", gridColumnRows);
  13246. // 按钮数据
  13247. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13248. delete item.id;
  13249. return item;
  13250. });
  13251. this.viewModel.set("form.buttons", gridBtnRows);
  13252. // 查询条件
  13253. // 策略
  13254. var form = this.viewModel.get("form");
  13255. this.setLoading(true);
  13256. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13257. if (res.success) {
  13258. msg('保存成功');
  13259. handles$1.mainWindow.refs['exporerTree'].reload();
  13260. }
  13261. }).finally(function () {
  13262. _this.setLoading(false);
  13263. });
  13264. };
  13265. ConfigStrategy.prototype.addColumn = function () {
  13266. this.refs.gridColumn.getStore().add({});
  13267. };
  13268. ConfigStrategy.prototype.removeColumn = function () {
  13269. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13270. };
  13271. ConfigStrategy.prototype.calcColumn = function (sender) {
  13272. var _this = this;
  13273. var table = this.viewModel.get("form.table");
  13274. if (!table) {
  13275. msg("表名不存在!");
  13276. return;
  13277. }
  13278. this.setLoading(true);
  13279. calcColumnForm({ table: table }).then(function (res) {
  13280. if (res.success) {
  13281. msg(res.msg);
  13282. if (res.data.columns.length > 0) {
  13283. _$2.forEach(res.data.columns, function (it) {
  13284. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13285. });
  13286. }
  13287. }
  13288. }).finally(function () {
  13289. _this.setLoading(false);
  13290. });
  13291. };
  13292. ConfigStrategy.prototype.addButton = function () {
  13293. this.refs.gridButton.getStore().add({});
  13294. };
  13295. ConfigStrategy.prototype.moveUp = function (sender) {
  13296. var grid = sender.up('grid');
  13297. grid.rowMoveUp();
  13298. };
  13299. ConfigStrategy.prototype.moveDown = function (sender) {
  13300. var grid = sender.up('grid');
  13301. grid.rowMoveDown();
  13302. };
  13303. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13304. var win = new Ext.Window({
  13305. autoDestroy: true,
  13306. title: "添加(编辑)策略",
  13307. width: 400,
  13308. height: 300,
  13309. resizable: true,
  13310. closable: true,
  13311. maximizable: true,
  13312. minimizable: true,
  13313. plain: true,
  13314. // constrainHeader: true,
  13315. constrain: true,
  13316. layout: 'fit',
  13317. animateTarget: sender,
  13318. buttonAlign: 'center',
  13319. items: [
  13320. {
  13321. xtype: "form",
  13322. layout: "hbox",
  13323. margin: '10px 20px',
  13324. border: 0,
  13325. items: [
  13326. {
  13327. flex: 1,
  13328. layout: 'vbox',
  13329. items: [
  13330. {
  13331. xtype: "numberfield",
  13332. fieldLabel: "优先级",
  13333. flex: 1,
  13334. allowBlank: false,
  13335. labelWidth: 50,
  13336. width: "100%",
  13337. },
  13338. {
  13339. xtype: "textfield",
  13340. fieldLabel: "策略名称",
  13341. flex: 1,
  13342. allowBlank: false,
  13343. labelWidth: 50,
  13344. width: "100%",
  13345. },
  13346. {
  13347. xtype: "textfield",
  13348. fieldLabel: "策略编号",
  13349. flex: 1,
  13350. allowBlank: false,
  13351. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13352. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13353. labelWidth: 50,
  13354. width: "100%",
  13355. },
  13356. {
  13357. xtype: "textfield",
  13358. fieldLabel: "仓库ID",
  13359. flex: 1,
  13360. allowBlank: false,
  13361. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13362. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13363. labelWidth: 50,
  13364. width: "100%",
  13365. },
  13366. ]
  13367. },
  13368. ]
  13369. }
  13370. ],
  13371. //窗口按钮
  13372. buttons: [
  13373. {
  13374. xtype: 'button', text: '保存', handler: function (btn) {
  13375. //窗口获取表单
  13376. var form = win.down('form');
  13377. var vaildSuccess = form.isValid();
  13378. if (!vaildSuccess) {
  13379. return;
  13380. }
  13381. var filename = form.down('textfield[name="filename"]').getValue();
  13382. }
  13383. },
  13384. {
  13385. xtype: 'button', text: '取消', handler: function (btn) {
  13386. //窗口关闭
  13387. win.close();
  13388. }
  13389. }
  13390. ]
  13391. });
  13392. win.show();
  13393. };
  13394. return ConfigStrategy;
  13395. }(Scope));
  13396. //# sourceMappingURL=ConfigStrategy.js.map
  13397. var buildVjson = function () {
  13398. return {
  13399. bind: {
  13400. title: '流程编辑-{text}',
  13401. },
  13402. layout: 'fit',
  13403. items: [{
  13404. layout: 'border',
  13405. tbar: {
  13406. xtype: 'toolbar',
  13407. items: [
  13408. {
  13409. xtype: 'button',
  13410. text: '撤销',
  13411. listeners: {
  13412. click: "scope.undo"
  13413. }
  13414. },
  13415. {
  13416. xtype: 'button',
  13417. text: '还原',
  13418. listeners: {
  13419. click: "scope.redo"
  13420. }
  13421. },
  13422. {
  13423. xtype: 'button',
  13424. text: '保存',
  13425. listeners: {
  13426. click: "scope.save"
  13427. }
  13428. },
  13429. {
  13430. xtype: 'button',
  13431. text: '导入BPM',
  13432. listeners: {
  13433. click: "scope.importBpm"
  13434. }
  13435. },
  13436. {
  13437. xtype: 'button',
  13438. text: '配置适配策略',
  13439. listeners: {
  13440. click: "scope.configStrategy"
  13441. }
  13442. },
  13443. {
  13444. fieldLabel: '选择配置分支',
  13445. xtype: 'combogrid',
  13446. },
  13447. ]
  13448. },
  13449. items: [
  13450. {
  13451. xtype: "panel",
  13452. region: 'center',
  13453. reference: "bpmn_view",
  13454. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13455. },
  13456. {
  13457. split: true,
  13458. xtype: "panel",
  13459. region: 'east',
  13460. width: '30%',
  13461. reference: "bpmn_properties",
  13462. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13463. }
  13464. ],
  13465. }],
  13466. listeners: {
  13467. afterrender: 'scope.onViewRender'
  13468. }
  13469. };
  13470. };
  13471. var BpmnDesign = /** @class */ (function (_super) {
  13472. __extends(BpmnDesign, _super);
  13473. function BpmnDesign() {
  13474. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13475. _this.bpmnModeler = null;
  13476. _this.bpmnModelerName = "";
  13477. return _this;
  13478. }
  13479. BpmnDesign.prototype.onLoad = function () {
  13480. var _this = this;
  13481. _super.prototype.onLoad.call(this);
  13482. this.setLoading(true);
  13483. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13484. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13485. if (res && res.success && res.data && res.data.bpmn) {
  13486. var diagramXML = res.data.bpmn;
  13487. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13488. var elements = _this.bpmnModeler._definitions.rootElements;
  13489. if (Array.isArray(elements) && elements.length > 0) {
  13490. elements[0].name = _this.bpmnModelerName;
  13491. }
  13492. }).catch(function (err) {
  13493. msgError(err);
  13494. });
  13495. }
  13496. else {
  13497. msgError(res.msg);
  13498. }
  13499. }).finally(function () {
  13500. _this.setLoading(false);
  13501. });
  13502. };
  13503. BpmnDesign.prototype.onViewRender = function (sender) {
  13504. var customTranslateModule = {
  13505. translate: ['value', customTranslate]
  13506. };
  13507. this.bpmnModeler = new BpmnModeler({
  13508. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13509. propertiesPanel: {
  13510. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13511. },
  13512. additionalModules: [
  13513. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13514. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13515. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13516. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13517. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13518. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13519. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13520. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13521. customTranslateModule,
  13522. ],
  13523. moddleExtensions: {
  13524. camunda: camundaModdleDescriptor
  13525. },
  13526. keyboard: { bindTo: document } // 使用键盘快捷键
  13527. });
  13528. };
  13529. //开启快捷键
  13530. //modeler.get('keyboard').bind(document);
  13531. //关闭快捷键
  13532. //modeler.get('keyboard').unbind();
  13533. BpmnDesign.prototype.undo = function (sender) {
  13534. this.bpmnModeler.get('commandStack').undo();
  13535. };
  13536. BpmnDesign.prototype.redo = function (sender) {
  13537. this.bpmnModeler.get('commandStack').redo();
  13538. };
  13539. BpmnDesign.prototype.save = function (sender) {
  13540. var _this = this;
  13541. this.setLoading(true);
  13542. this.bpmnModeler.saveXML().then(function (resBpm) {
  13543. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13544. if (res.success) {
  13545. msg$1("保存成功");
  13546. }
  13547. else {
  13548. msgError(res.msg);
  13549. }
  13550. }).catch(function (e) {
  13551. var _a, _b;
  13552. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13553. msgError(msg);
  13554. }).finally(function () {
  13555. _this.setLoading(false);
  13556. });
  13557. }).catch(function (e) {
  13558. msgError(e);
  13559. _this.setLoading(false);
  13560. });
  13561. };
  13562. BpmnDesign.prototype.importBpm = function (sender) {
  13563. var _this = this;
  13564. var dlg = new ImportBpmn();
  13565. //@ts-ignore
  13566. dlg.success = function (sen, data) {
  13567. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13568. var elements = _this.bpmnModeler._definitions.rootElements;
  13569. if (Array.isArray(elements) && elements.length > 0) {
  13570. elements[0].name = _this.bpmnModelerName;
  13571. }
  13572. }).catch(function (err) {
  13573. msgError(err);
  13574. });
  13575. };
  13576. dlg.showDialog(sender, {}, {});
  13577. // this.bpmnModeler.importXML()
  13578. };
  13579. BpmnDesign.prototype.configStrategy = function (sender) {
  13580. var configStrategy = new ConfigStrategy();
  13581. configStrategy.showDialog(sender, {}, {});
  13582. };
  13583. return BpmnDesign;
  13584. }(Scope));
  13585. //# sourceMappingURL=BpmnDesign.js.map
  13586. var model$b = {
  13587. data: {
  13588. id: '',
  13589. path: '',
  13590. form: {
  13591. title: '',
  13592. sqlId: '',
  13593. }
  13594. }
  13595. };
  13596. //# sourceMappingURL=WhLayoutDesign.model.js.map
  13597. var vjson$b = {
  13598. bind: {
  13599. title: '{title}',
  13600. },
  13601. layout: 'fit',
  13602. items: [
  13603. {
  13604. layout: 'border',
  13605. items: [
  13606. {
  13607. region: 'center',
  13608. reference: 'editor',
  13609. html: '<div class="geEditor"></div>',
  13610. listeners: {
  13611. afterrender: 'scope.editorInit'
  13612. }
  13613. },
  13614. ]
  13615. }
  13616. ]
  13617. }; //
  13618. //
  13619. //# sourceMappingURL=WhLayoutDesign.view.js.map
  13620. var WidgetDesign$1 = /** @class */ (function (_super) {
  13621. __extends(WidgetDesign, _super);
  13622. function WidgetDesign(layoutCode, layoutName) {
  13623. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13624. _this.layoutCode = layoutCode;
  13625. _this.layoutName = layoutName;
  13626. return _this;
  13627. }
  13628. WidgetDesign.prototype.onLoad = function () {
  13629. this.viewModel.set('layoutCode', this.layoutCode);
  13630. this.viewModel.set('layoutName', this.layoutName);
  13631. if (this.layoutCode) {
  13632. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13633. }
  13634. else {
  13635. this.viewModel.set('title', '新建图纸');
  13636. }
  13637. };
  13638. WidgetDesign.prototype.reload = function () {
  13639. var _this = this;
  13640. this.setLoading(true);
  13641. loadWhLayout({
  13642. layoutCode: this.layoutCode,
  13643. layoutName: this.layoutName,
  13644. }).then(function (res) {
  13645. if (res.success) {
  13646. var xml = res.data.layoutContent;
  13647. var doc = mxUtils.parseXml(xml);
  13648. var graph = _this.editorUi.editor.graph;
  13649. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13650. }
  13651. }).finally(function () {
  13652. _this.setLoading(false);
  13653. });
  13654. };
  13655. WidgetDesign.prototype.editorInit = function (sender) {
  13656. var that = this;
  13657. var dom = $(sender.el.dom).find('.geEditor')[0];
  13658. //@ts-ignore
  13659. require(['mxgraph'], function () {
  13660. var editorUiInit = EditorUi.prototype.init;
  13661. EditorUi.prototype.init = function () {
  13662. editorUiInit.apply(this, arguments);
  13663. this.actions.get('save').funct = that.onFileSave.bind(that);
  13664. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13665. this.actions.get('open').visible = false;
  13666. this.actions.get('new').visible = false;
  13667. this.actions.get('preview').visible = false;
  13668. this.actions.get('print').visible = false;
  13669. this.actions.get('pageSetup').visible = false;
  13670. this.actions.get('help').visible = false;
  13671. this.actions.get('export').visible = false;
  13672. this.actions.get('about').visible = false;
  13673. this.menus.menus.help.setEnabled(false);
  13674. that.editorUi = this;
  13675. if (that.layoutCode) {
  13676. that.reload();
  13677. }
  13678. };
  13679. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13680. var mxLanguage = 'zh';
  13681. mxResources.loadDefaultBundle = false;
  13682. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13683. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13684. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13685. // Fixes possible asynchronous requests
  13686. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13687. // Adds bundle text to resources
  13688. mxResources.parse(xhr[0].getText());
  13689. // Configures the default graph theme
  13690. var themes = new Object();
  13691. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13692. // Main
  13693. new EditorUi(new Editor(false, themes), dom);
  13694. }, function () {
  13695. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13696. });
  13697. });
  13698. };
  13699. WidgetDesign.prototype.onDestroy = function () {
  13700. var _a;
  13701. try {
  13702. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13703. }
  13704. catch (e) {
  13705. }
  13706. };
  13707. WidgetDesign.prototype.onFileSaveAs = function () {
  13708. var _this = this;
  13709. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13710. .then(function (_a) {
  13711. var code = _a.code, name = _a.name;
  13712. _this.layoutCode = code;
  13713. _this.layoutName = name;
  13714. _this.onSave();
  13715. });
  13716. };
  13717. WidgetDesign.prototype.onSave = function () {
  13718. var _this = this;
  13719. var layoutContent = this.editorUi.getEditBlankXml();
  13720. var layoutCode = this.layoutCode;
  13721. var layoutName = this.layoutName;
  13722. if (!layoutCode || !layoutName) {
  13723. msg$1('图形编号和图形名称必填');
  13724. return;
  13725. }
  13726. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13727. this.setLoading(true);
  13728. saveWhLayout({
  13729. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13730. }).then(function (res) {
  13731. msg$1(res.msg);
  13732. handles$1.whLayout.reload();
  13733. }).finally(function () {
  13734. _this.setLoading(false);
  13735. });
  13736. };
  13737. WidgetDesign.prototype.onFileSave = function () {
  13738. if (!this.layoutCode || !this.layoutName) {
  13739. this.onFileSaveAs();
  13740. }
  13741. else {
  13742. this.onSave();
  13743. }
  13744. };
  13745. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13746. var code = _a.code, name = _a.name;
  13747. return new Promise(function (resolve, reject) {
  13748. var viewModel = new Ext.app.ViewModel({
  13749. data: {
  13750. code: code !== null && code !== void 0 ? code : '',
  13751. name: name !== null && name !== void 0 ? name : '',
  13752. }
  13753. });
  13754. var dlg = Ext.create('Ext.window.Window', {
  13755. title: '保存',
  13756. viewModel: viewModel,
  13757. layout: {
  13758. type: "vbox",
  13759. pack: "start",
  13760. align: "stretch"
  13761. },
  13762. items: [
  13763. {
  13764. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13765. bind: '{code}'
  13766. },
  13767. {
  13768. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13769. bind: '{name}'
  13770. }
  13771. ],
  13772. fbar: [
  13773. {
  13774. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13775. click: function () {
  13776. var code = viewModel.get('code');
  13777. var name = viewModel.get('name');
  13778. resolve({ code: code, name: name });
  13779. dlg.close();
  13780. }
  13781. }
  13782. },
  13783. {
  13784. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13785. click: function () {
  13786. dlg.close();
  13787. }
  13788. }
  13789. },
  13790. ]
  13791. });
  13792. dlg.show();
  13793. });
  13794. };
  13795. return WidgetDesign;
  13796. }(Scope));
  13797. //@ts-ignore
  13798. require.config({
  13799. path: {},
  13800. shim: {}
  13801. });
  13802. // init()
  13803. var Workbench = /** @class */ (function (_super) {
  13804. __extends(Workbench, _super);
  13805. // activeModulePage: ModulePage = null
  13806. function Workbench() {
  13807. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13808. _this.name = "MainWindow";
  13809. _this.modules = [];
  13810. _this.yvgridDesign = null;
  13811. return _this;
  13812. }
  13813. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13814. if (newCard) {
  13815. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13816. }
  13817. else {
  13818. this.viewModel.set('leftTabTitle', '未选中');
  13819. }
  13820. };
  13821. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13822. get: function () {
  13823. var _a;
  13824. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13825. },
  13826. enumerable: true,
  13827. configurable: true
  13828. });
  13829. Workbench.prototype.documentKeydown = function (event) {
  13830. if (event.ctrlKey || event.metaKey) {
  13831. if (event.key.toLowerCase() === 's') {
  13832. eventBus.publish(EventType.SaveCall, {});
  13833. event.stopPropagation();
  13834. event.preventDefault();
  13835. }
  13836. else if (event.key.toLowerCase() === 'z') {
  13837. if (event.shiftKey) {
  13838. eventBus.publish(EventType.Redo, {});
  13839. event.stopPropagation();
  13840. event.preventDefault();
  13841. }
  13842. else {
  13843. eventBus.publish(EventType.Undo, {});
  13844. event.stopPropagation();
  13845. event.preventDefault();
  13846. }
  13847. }
  13848. }
  13849. };
  13850. Workbench.prototype.onLoad = function () {
  13851. var _this = this;
  13852. window["tt"] = this.refs['tt'];
  13853. window["vm"] = this.viewModel;
  13854. $('#loading').remove();
  13855. setMainWindow(this);
  13856. setStatusbar(this.down('statusbar'));
  13857. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13858. var currentProject = getCurrentProject();
  13859. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13860. // handles.fileTree.reload()
  13861. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13862. _this.showModule(rawData);
  13863. });
  13864. eventBus.subscribe(EventType.Undo, function () {
  13865. _this.onUndo();
  13866. });
  13867. eventBus.subscribe(EventType.Redo, function () {
  13868. _this.onRedo();
  13869. });
  13870. eventBus.subscribe(EventType.Cut, function (_a) {
  13871. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13872. _this.onCut(a, b, c, d);
  13873. });
  13874. eventBus.subscribe(EventType.Copy, function (_a) {
  13875. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13876. _this.onCopy(a, b, c, d);
  13877. });
  13878. eventBus.subscribe(EventType.Paste, function (_a) {
  13879. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13880. _this.onPaste(a, b, c, d);
  13881. });
  13882. eventBus.subscribe(EventType.SelectAll, function () {
  13883. _this.onSelectAll();
  13884. });
  13885. eventBus.subscribe(EventType.SelectAll, function () {
  13886. _this.onSelectAll();
  13887. });
  13888. eventBus.subscribe(EventType.RunCheckModule, function () {
  13889. _this.runCheckModule();
  13890. });
  13891. eventBus.subscribe(EventType.StopCheckModule, function () {
  13892. _this.stopCheckModule();
  13893. });
  13894. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13895. _this.onCompoentContextMenu(args);
  13896. });
  13897. this.runCheckModule();
  13898. };
  13899. Workbench.prototype.onCompoentContextMenu = function (args) {
  13900. var _this = this;
  13901. if (!this.yvgridDesign) {
  13902. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13903. this.yvgridDesign.showDialog(null, {}, {});
  13904. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13905. this.yvgridDesign.onDestroy = function () {
  13906. fn_1();
  13907. _this.yvgridDesign = null;
  13908. };
  13909. }
  13910. };
  13911. Workbench.prototype.runCheckModule = function () {
  13912. var _this = this;
  13913. if (this.checkTimer) {
  13914. return;
  13915. }
  13916. this.checkTimer = setInterval(function () {
  13917. var _a;
  13918. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13919. _this.activeModulePage.check();
  13920. }
  13921. }, 5000);
  13922. };
  13923. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13924. var dlg = new WidgetDesign(widgetPath, widgetName);
  13925. dlg.showPage({
  13926. id: 'widget_' + widgetPath,
  13927. path: 'widget_' + widgetPath,
  13928. }, {
  13929. data: {
  13930. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13931. }
  13932. });
  13933. dlg.dialogSuccess = successCallback;
  13934. };
  13935. Workbench.prototype.stopCheckModule = function () {
  13936. clearInterval(this.checkTimer);
  13937. this.checkTimer = null;
  13938. };
  13939. Workbench.prototype.showDataSync = function () {
  13940. var ins = new DbSync();
  13941. ins.showPage({
  13942. id: 'db_sync__',
  13943. path: 'db_sync__',
  13944. }, {
  13945. data: {}
  13946. });
  13947. };
  13948. /**
  13949. * 打开一个项目
  13950. */
  13951. Workbench.prototype.openProject = function (project) {
  13952. setCurrentProject(project);
  13953. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  13954. handles$1.fileTree.reload();
  13955. };
  13956. /**
  13957. * 打开模板开发面板
  13958. */
  13959. Workbench.prototype.showTemplateDev = function () {
  13960. var ins = new TemplateDev();
  13961. ins.showPage({
  13962. id: 'template_dev__',
  13963. path: 'template_dev__',
  13964. }, {
  13965. data: {}
  13966. });
  13967. };
  13968. Workbench.prototype.openScope = function () {
  13969. };
  13970. /**
  13971. * 显示字段域管理器
  13972. */
  13973. Workbench.prototype.showColumnDomain = function () {
  13974. var instance = new DbDomain();
  13975. instance.showPage({
  13976. id: 'domain__',
  13977. path: 'domain__',
  13978. }, {
  13979. data: {}
  13980. });
  13981. };
  13982. /**
  13983. * 显示性能统计
  13984. */
  13985. Workbench.prototype.showPerform = function () {
  13986. // const instance = new PerformStats()
  13987. // instance.showPage({
  13988. // id: 'perform__',
  13989. // path: 'perform__',
  13990. //
  13991. // }, {
  13992. // data: {}
  13993. // })
  13994. };
  13995. /**
  13996. * 显示数据库代码模板库
  13997. */
  13998. Workbench.prototype.showDbCodeTemplate = function () {
  13999. // const instance = new DbCodeTemplate()
  14000. // instance.showPage({
  14001. // id: 'dbcode__',
  14002. // path: 'dbcode__',
  14003. //
  14004. // }, {
  14005. // data: {}
  14006. // })
  14007. };
  14008. /**
  14009. * 显示数据库代码模板库
  14010. */
  14011. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14012. var instance = new ReportDesign();
  14013. instance.showPage({
  14014. id: 'report_' + report_id,
  14015. path: 'report_' + report_id,
  14016. }, {
  14017. data: {
  14018. report_id: report_id,
  14019. report_name: report_name,
  14020. }
  14021. });
  14022. instance.dialogSuccess = success;
  14023. };
  14024. /**
  14025. * 显示报表
  14026. */
  14027. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14028. instance.showPage({
  14029. id: 'REPORT__' + report_id,
  14030. path: 'REPORT__' + report_id,
  14031. }, {
  14032. data: {
  14033. report_id: report_id,
  14034. }
  14035. });
  14036. var reportName = instance.viewModel.get('report_name');
  14037. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14038. };
  14039. /**
  14040. * 显示运维页面
  14041. */
  14042. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14043. // const instance = new DevOpsTerminal()
  14044. // instance.showPage({
  14045. // id: 'ops_' + opsId,
  14046. // path: 'ops_' + opsId,
  14047. //
  14048. // }, {
  14049. // data: {
  14050. // opsId: opsId,
  14051. // name: name,
  14052. // }
  14053. // })
  14054. // instance.dialogSuccess = success
  14055. };
  14056. /**
  14057. * 显示表结构
  14058. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14059. * columnName 可以为空
  14060. */
  14061. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14062. var id = 'tableColumn_' + tableName;
  14063. var isCreateTable = false;
  14064. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14065. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14066. if (!tableName) {
  14067. id = _$2.uniqueId('new_table');
  14068. tableName = id;
  14069. isCreateTable = true;
  14070. }
  14071. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14072. instance.showPage({
  14073. id: id,
  14074. path: id,
  14075. locatPath: locatPath
  14076. }, {
  14077. data: {
  14078. tableName: tableName,
  14079. columnName: columnName
  14080. }
  14081. });
  14082. };
  14083. /**
  14084. * 打开某个模块
  14085. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14086. */
  14087. Workbench.prototype.showModule = function (rawData) {
  14088. var id = rawData.id, path = rawData.path;
  14089. var separator = '/';
  14090. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14091. var module = this.modules[idx];
  14092. var pageId = path.replaceAll('/', '_');
  14093. console.log('open module', module);
  14094. var instance = new ModulePage(id, module);
  14095. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14096. instance.showPage({
  14097. id: 'module_' + pageId,
  14098. path: path,
  14099. title: module.name
  14100. }, {
  14101. data: {}
  14102. });
  14103. };
  14104. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14105. var bpmnDesign = new BpmnDesign();
  14106. bpmnDesign.showPage({}, {
  14107. data: {
  14108. absolutePath: absolutePath,
  14109. id: id,
  14110. text: text
  14111. }
  14112. });
  14113. };
  14114. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14115. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14116. layoutDesign.showPage({}, {
  14117. data: {}
  14118. });
  14119. };
  14120. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14121. var _a;
  14122. // this.activeModulePage = newCard.yvanScope
  14123. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14124. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14125. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14126. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14127. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14128. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14129. eventBus.publish(EventType.MainTabChange, {
  14130. moduleId: newCard.yvanScope.moduleId,
  14131. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14132. from: this.name
  14133. });
  14134. };
  14135. Workbench.prototype.onUndo = function () {
  14136. var _a;
  14137. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14138. };
  14139. Workbench.prototype.onRedo = function () {
  14140. var _a;
  14141. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14142. };
  14143. Workbench.prototype.onCut = function (a, b, c, d) {
  14144. var _a;
  14145. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14146. };
  14147. Workbench.prototype.onCopy = function (a, b, c, d) {
  14148. var _a;
  14149. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14150. };
  14151. Workbench.prototype.onPaste = function (a, b, c, d) {
  14152. var _a;
  14153. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14154. };
  14155. Workbench.prototype.onSelectAll = function () {
  14156. var _a;
  14157. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14158. };
  14159. return Workbench;
  14160. }(Scope));
  14161. //# sourceMappingURL=Workbench.js.map
  14162. (function (FuncDomain) {
  14163. FuncDomain["SCOPE"] = "scope";
  14164. FuncDomain["SYSTEM"] = "system";
  14165. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14166. (function (BizMode) {
  14167. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14168. BizMode[BizMode["query"] = 1] = "query";
  14169. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14170. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14171. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14172. })(exports.BizMode || (exports.BizMode = {}));
  14173. (function (BizFormat) {
  14174. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14175. BizFormat[BizFormat["button"] = 1] = "button";
  14176. BizFormat[BizFormat["progress"] = 2] = "progress";
  14177. BizFormat[BizFormat["date"] = 3] = "date";
  14178. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14179. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14180. })(exports.BizFormat || (exports.BizFormat = {}));
  14181. (function (BizUnique) {
  14182. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14183. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14184. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14185. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14186. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14187. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14188. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14189. })(exports.BizUnique || (exports.BizUnique = {}));
  14190. var ScopeEngine = /** @class */ (function () {
  14191. function ScopeEngine() {
  14192. }
  14193. ScopeEngine.getBizFile = function (director) {
  14194. return new Promise(function (resolve, reject) {
  14195. debugger;
  14196. });
  14197. };
  14198. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14199. return new Promise(function (resolve, reject) {
  14200. var requireArr = [];
  14201. var requireKeyArr = [];
  14202. _$2.forOwn(billFile.domains, function (v, k) {
  14203. requireArr.push(v.domain);
  14204. requireKeyArr.push(k);
  14205. if (v.layout) {
  14206. requireArr.push(v.layout);
  14207. requireKeyArr.push(k + "_layout");
  14208. }
  14209. });
  14210. requireArr.push(billFile.layout);
  14211. requireKeyArr.push("layout");
  14212. requireArr.push(billFile.converter);
  14213. requireKeyArr.push("converter");
  14214. // @ts-ignore
  14215. require(requireArr, function () {
  14216. var requireReArr = [];
  14217. for (var _i = 0; _i < arguments.length; _i++) {
  14218. requireReArr[_i] = arguments[_i];
  14219. }
  14220. if (requireReArr.length <= 0) {
  14221. reject(new Error("没有加载到相关的文件!"));
  14222. }
  14223. var domains = {};
  14224. for (var i = 0; i < requireReArr.length - 2; i++) {
  14225. if (requireKeyArr[i].endsWith("_layout")) {
  14226. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14227. domains[key_d].layout = requireReArr[i].default;
  14228. }
  14229. else {
  14230. domains[requireKeyArr[i]] = requireReArr[i].default;
  14231. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14232. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14233. }
  14234. }
  14235. var bizFile = {
  14236. bill: billFile,
  14237. domains: domains,
  14238. layout: requireReArr[requireReArr.length - 2].default,
  14239. converter: requireReArr[requireReArr.length - 1].default,
  14240. };
  14241. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14242. scope.billSetting = bizFile;
  14243. resolve(scope);
  14244. });
  14245. });
  14246. };
  14247. ScopeEngine.buildScopeFromPath = function (path) {
  14248. return new Promise(function (resolve, reject) {
  14249. // @ts-ignore
  14250. require([path], function (bill) {
  14251. bill = bill.default;
  14252. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14253. resolve(scope);
  14254. }).catch(function (e) {
  14255. reject(e);
  14256. });
  14257. });
  14258. });
  14259. };
  14260. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14261. var controller = {};
  14262. var vjson = {
  14263. layout: 'fit',
  14264. title: bizFile.bill.name,
  14265. items: []
  14266. };
  14267. var model = {};
  14268. if (bizFile.layout.layout === "fit") {
  14269. vjson.items = bizFile.layout.items;
  14270. }
  14271. else if (bizFile.layout.layout === "border") {
  14272. vjson.items = [bizFile.layout];
  14273. }
  14274. var domainsVjson = {};
  14275. _$2.forOwn(bizFile.domains, function (v, k) {
  14276. var domainVjson = null;
  14277. var buttons = bizFile.domains[k].buttons;
  14278. if (bizFile.bill.domains[k].mode === "form") {
  14279. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14280. if (Array.isArray(buttons) && buttons.length > 0) {
  14281. if (bizFile.bill.domains[k].type === "header") {
  14282. vjson.tbar = {
  14283. xtype: 'toolbar',
  14284. items: ScopeEngine.buildButton(controller, buttons)
  14285. };
  14286. }
  14287. else {
  14288. domainVjson.items.push({
  14289. xtype: "cols",
  14290. items: ScopeEngine.buildButton(controller, buttons)
  14291. });
  14292. }
  14293. }
  14294. }
  14295. else if (bizFile.bill.domains[k].mode === "table") {
  14296. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14297. if (Array.isArray(buttons) && buttons.length > 0) {
  14298. if (bizFile.bill.domains[k].type === "header") {
  14299. vjson.tbar = {
  14300. xtype: 'toolbar',
  14301. items: ScopeEngine.buildButton(controller, buttons)
  14302. };
  14303. }
  14304. else {
  14305. domainVjson.tbar = {
  14306. xtype: 'toolbar',
  14307. items: ScopeEngine.buildButton(controller, buttons)
  14308. };
  14309. }
  14310. }
  14311. }
  14312. if (domainVjson) {
  14313. domainsVjson[k] = domainVjson;
  14314. }
  14315. });
  14316. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14317. var scope = new Scope({ model: model, vjson: vjson });
  14318. scope['bill_define'] = bizFile;
  14319. _$2.merge(scope, controller);
  14320. console.log('bill_define', vjson, scope, scope['bill_define']);
  14321. return scope;
  14322. };
  14323. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14324. var fieldGroups = {};
  14325. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14326. var field = bizFile.domains[domainKey].fields[i];
  14327. var item = { sort: field.form_sort };
  14328. item.xtype = field.xtype;
  14329. item.fieldLabel = field.column_desc;
  14330. item.bind = {
  14331. value: "{" + domainKey + "." + field.column_name + "}",
  14332. };
  14333. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14334. // if (field.disabled !== "true" && field.disabled !== "false") {
  14335. // item.bind.disabled = eval(field.disabled)
  14336. // } else {
  14337. // item.disabled = (field.disabled === "true")
  14338. // }
  14339. // if (field.readonly !== "true" && field.readonly !== "false") {
  14340. // item.bind.disabled = eval(field.readonly)
  14341. // } else {
  14342. // item.readonly = (field.readonly === "true")
  14343. // }
  14344. // if (field.required !== "true" && field.required !== "false") {
  14345. // item.bind.required = eval(field.required)
  14346. // } else {
  14347. // item.required = (field.required === "true")
  14348. // }
  14349. // if (field.hide !== "true" && field.hide !== "false") {
  14350. // item.bind.hidden = eval(field.hide)
  14351. // } else {
  14352. // item.hidden = (field.hide === "true")
  14353. // }
  14354. // item.flex = field.
  14355. if (field.dict) {
  14356. item.fix = eval(field.dict);
  14357. }
  14358. // _.set(formModel, "", "")
  14359. item.field = field;
  14360. if (field.form_group) {
  14361. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14362. fieldGroups[field.form_group] = [item];
  14363. }
  14364. else {
  14365. fieldGroups[field.form_group].push(item);
  14366. }
  14367. }
  14368. }
  14369. var formVjson = {
  14370. xtype: "form",
  14371. title: bizFile.domains[domainKey].name,
  14372. items: []
  14373. };
  14374. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14375. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14376. if (items) {
  14377. var fieldsetVjson = {
  14378. xtype: "fieldset",
  14379. title: k,
  14380. items: items
  14381. };
  14382. formVjson.items.push(fieldsetVjson);
  14383. }
  14384. });
  14385. return formVjson;
  14386. };
  14387. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14388. // const vjson = { xtype: "grid", items: []}
  14389. var gridVjson = {
  14390. xtype: "yvgrid",
  14391. columns: [],
  14392. split: true,
  14393. reference: domainKey,
  14394. listeners: {
  14395. itemdblclick: function () {
  14396. },
  14397. },
  14398. };
  14399. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14400. var field = bizFile.domains[domainKey].fields[i];
  14401. gridVjson.columns.push({
  14402. dataIndex: field.column_name,
  14403. header: field.column_desc,
  14404. });
  14405. }
  14406. return gridVjson;
  14407. };
  14408. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14409. var colGroups = [{
  14410. xtype: "cols",
  14411. items: []
  14412. }];
  14413. var colGroup = colGroups[0];
  14414. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14415. for (var i = 0; i < fieldGroup.length; i++) {
  14416. var field = fieldGroup[i];
  14417. if (field.field.form_newline === "true") {
  14418. if (colGroup.items.length > 0) {
  14419. colGroup = {
  14420. xtype: "cols",
  14421. items: [field]
  14422. };
  14423. colGroups.push(colGroup);
  14424. }
  14425. }
  14426. else {
  14427. colGroup.items.push(field);
  14428. }
  14429. delete field.field;
  14430. }
  14431. return colGroups;
  14432. };
  14433. ScopeEngine.buildButton = function (controller, buttons) {
  14434. var buttonsVjson = [];
  14435. var _loop_1 = function (i) {
  14436. var item = buttons[i];
  14437. var button = {
  14438. xtype: "button",
  14439. text: item.btn_name,
  14440. iconCls: item.icon
  14441. };
  14442. if (item.hidden === "true" || item.hidden === "false") {
  14443. button.hidden = (item.hidden === "true");
  14444. }
  14445. if (item.listeners) {
  14446. var listeners_1 = {};
  14447. _$2.forOwn(item.listeners, function (v, k) {
  14448. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14449. listeners_1[k] = v;
  14450. }
  14451. else {
  14452. try {
  14453. listeners_1[k] = eval(v);
  14454. }
  14455. catch (e) {
  14456. throw e;
  14457. }
  14458. }
  14459. });
  14460. button.listeners = listeners_1;
  14461. }
  14462. buttonsVjson.push(button);
  14463. };
  14464. for (var i = 0; i < buttons.length; i++) {
  14465. _loop_1(i);
  14466. }
  14467. return buttonsVjson;
  14468. };
  14469. ScopeEngine.buildListeners = function (controller, item) {
  14470. if (!item.hasOwnProperty("listeners")) {
  14471. return;
  14472. }
  14473. _$2.forOwn(item.listeners, function (v, k) {
  14474. if (v && typeof v === "string") {
  14475. if (v.indexOf(".") > -1) {
  14476. var strArr = v.split(".");
  14477. if (strArr.length != 2) {
  14478. console.error(item.listeners, "语法解析错误,请检查!");
  14479. }
  14480. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14481. switch (funcDomain) {
  14482. case exports.FuncDomain.SCOPE:
  14483. controller[k] = findCustFunc(item, k);
  14484. break;
  14485. case exports.FuncDomain.SYSTEM:
  14486. break;
  14487. default:
  14488. throw new Error("错误的函数域定义");
  14489. }
  14490. }
  14491. else {
  14492. var func = eval(v);
  14493. if (typeof func === 'function') {
  14494. controller[k] = func;
  14495. }
  14496. throw new Error("解析自定义函数出错");
  14497. }
  14498. }
  14499. });
  14500. var findCustFunc = function (item, funcName) {
  14501. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14502. throw new Error("没有找到相关的函数定义");
  14503. }
  14504. var func = eval(item[funcName]);
  14505. if (typeof func === 'function') {
  14506. return func;
  14507. }
  14508. throw new Error("解析自定义函数出错");
  14509. };
  14510. };
  14511. /**
  14512. * 只检索 items 的模式,深度遍历 vjson
  14513. */
  14514. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14515. if (Array.isArray(vjson)) {
  14516. for (var i = 0; i < vjson.length; i++) {
  14517. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14518. }
  14519. }
  14520. else {
  14521. _$2.forOwn(vjson, function (v, k) {
  14522. if (k !== "domain") {
  14523. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14524. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14525. }
  14526. }
  14527. else {
  14528. delete vjson.domain;
  14529. _$2.merge(vjson, domainsVjson[v]);
  14530. }
  14531. });
  14532. }
  14533. };
  14534. return ScopeEngine;
  14535. }());
  14536. //# sourceMappingURL=ScopeEngine.js.map
  14537. function initComponent () {
  14538. var ct = Ext.Component.prototype.constructor;
  14539. Ext.Component.override({
  14540. constructor: function (config) {
  14541. if (!isDesignMode(this, config)) {
  14542. var me_1 = this;
  14543. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14544. _$2.each(baseConfigProcessList, function (process) {
  14545. process.call(me_1, me_1, config);
  14546. });
  14547. }
  14548. ct.call(this, config);
  14549. }
  14550. });
  14551. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14552. Ext.picker.Date.override({
  14553. initComponent: function () {
  14554. var me = this;
  14555. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14556. _initComponent.call(me);
  14557. },
  14558. selectToday: function () {
  14559. var me = this, btn = me.todayBtn, handler = me.handler;
  14560. if (btn && !btn.disabled) {
  14561. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14562. me.fireEvent('select', me, me.value);
  14563. if (handler) {
  14564. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14565. }
  14566. me.onSelect();
  14567. }
  14568. return me;
  14569. },
  14570. });
  14571. }
  14572. //# sourceMappingURL=component.js.map
  14573. function initMainTab () {
  14574. Ext.define('Yvan.MainTab', {
  14575. extend: 'Ext.tab.Panel',
  14576. xtype: 'maintab',
  14577. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14578. closeTabText: '关闭',
  14579. closeOthersTabsText: '关闭其他',
  14580. closeAllTabsText: '关闭所有'
  14581. }),
  14582. constructor: function (config) {
  14583. var me = this;
  14584. var newConfig = _$2.defaultsDeep({
  14585. // 强制属性
  14586. }, config);
  14587. this.superclass.constructor.call(me, newConfig);
  14588. },
  14589. initComponent: function () {
  14590. var me = this;
  14591. this.on({
  14592. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14593. _$2.defer(function () {
  14594. me.changeHash(newCard.id);
  14595. window['cp'] = newCard.yvanScope;
  14596. });
  14597. $$2(window).trigger('tabChange', {
  14598. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14599. });
  14600. },
  14601. afterrender: function () {
  14602. _$2.defer(function () {
  14603. me.tryRestoryPage();
  14604. });
  14605. }
  14606. });
  14607. this.superclass.initComponent.call(me);
  14608. },
  14609. tryRestoryPage: function () {
  14610. var me = this;
  14611. var hash = '' + window.location.hash;
  14612. if (hash && hash.indexOf('page=') > 0) {
  14613. if (hash.startsWith('#')) {
  14614. hash = hash.substr(1);
  14615. }
  14616. if (hash) {
  14617. var page = Qs.parse(hash).page;
  14618. if (page) {
  14619. // this.openScope(page)
  14620. me.fireEvent('restorypage', page);
  14621. }
  14622. }
  14623. }
  14624. },
  14625. changeHash: function (id) {
  14626. window.location.hash = Qs.stringify({ page: id });
  14627. },
  14628. /**
  14629. * 添加一个业务模块实例到选项卡
  14630. * @param scopeInstance 业务对象实例
  14631. * @param config ExtJS配置对象
  14632. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14633. */
  14634. addScope: function (scopeInstance, config, panelInitCallback) {
  14635. scopeInstance.topScope = scopeInstance;
  14636. var me = this;
  14637. if (config.path) {
  14638. for (var i = 0; i < this.items.items.length; i++) {
  14639. // 找到当前 tabs 里有没有已经打开过
  14640. var tab = this.items.items[i];
  14641. if (_$2.isEqual(tab.path, config.path)) {
  14642. // 激活
  14643. this.setActiveTab(tab);
  14644. return tab;
  14645. }
  14646. }
  14647. }
  14648. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14649. if (typeof panelInitCallback === 'function') {
  14650. panelInitCallback(newPanel);
  14651. }
  14652. // 添加业务模块
  14653. var newTab = this.add(newPanel);
  14654. this.setActiveTab(newTab);
  14655. newTab.on({
  14656. destroy: function (sender) {
  14657. me.changeHash('');
  14658. delete window['cp'];
  14659. }
  14660. });
  14661. return newTab;
  14662. }
  14663. });
  14664. }
  14665. //# sourceMappingURL=MainTab.js.map
  14666. /**
  14667. * 构建所有组件的公共属性
  14668. * @param config 原始config
  14669. * @param dragType 组件模式
  14670. * 不填,代表不能在设计时被拖拽
  14671. * row-container 是一个rows容器
  14672. * col-container 是一个cols容器
  14673. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14674. * row-item rows中的一行,比如 tree / grid / panel 等等
  14675. */
  14676. function baseConfig(config, dragType) {
  14677. // if (isDesignMode(config, undefined) && dragType) {
  14678. if (typeof config === 'object') {
  14679. var cc = '';
  14680. switch (dragType) {
  14681. case "cols-container":
  14682. cc = 'design_cols_container';
  14683. break;
  14684. case "col-item":
  14685. cc = 'design_col_item';
  14686. break;
  14687. case "rows-container":
  14688. cc = 'design_rows_container';
  14689. break;
  14690. case "row-item":
  14691. cc = 'design_row_item';
  14692. break;
  14693. }
  14694. if (typeof config.cls === 'string') {
  14695. _$2.extend(config, {
  14696. cls: [config.cls, 'yvan_design', cc]
  14697. });
  14698. }
  14699. else if (_$2.isArray(config.cls)) {
  14700. _$2.extend(config, {
  14701. cls: __spread(config.cls, ['yvan_design', cc])
  14702. });
  14703. }
  14704. else {
  14705. _$2.extend(config, {
  14706. cls: ['yvan_design', cc]
  14707. });
  14708. }
  14709. }
  14710. return config;
  14711. }
  14712. //# sourceMappingURL=base.js.map
  14713. function initPanel () {
  14714. /**
  14715. *
  14716. */
  14717. var ct = Ext.panel.Panel.prototype.constructor;
  14718. Ext.panel.Panel.override({
  14719. constructor: function (config) {
  14720. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14721. ct.call(this, newConfig);
  14722. }
  14723. });
  14724. var ss = Ext.form.FieldContainer.prototype;
  14725. Ext.form.FieldContainer.override({
  14726. config: __assign({}, fieldContainer)
  14727. });
  14728. }
  14729. //# sourceMappingURL=panel.js.map
  14730. function initGridColumn () {
  14731. var ct = Ext.grid.column.Column.prototype.constructor;
  14732. Ext.grid.column.Column.override({
  14733. constructor: function (config) {
  14734. var scope = lookupScope(config.$initParent.$initParent);
  14735. var newConfig = _$2.defaults({}, config, column);
  14736. if (typeof newConfig.summaryRenderer === 'string') {
  14737. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14738. if (typeof newConfig.summaryRenderer === 'function') {
  14739. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14740. }
  14741. }
  14742. if (config.formatter === 'datetime') {
  14743. newConfig.fix = ['system.formatDate()'];
  14744. delete newConfig.formatter;
  14745. }
  14746. // 在 grid.constructor 已经转换过了
  14747. // if (typeof newConfig.renderer === 'string') {
  14748. // newConfig.renderer = lookupFn(scope, config.renderer)
  14749. // if (typeof newConfig.renderer === 'function') {
  14750. // newConfig.renderer = newConfig.renderer.bind(scope)
  14751. // }
  14752. // }
  14753. ct.call(this, newConfig);
  14754. }
  14755. });
  14756. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14757. Ext.grid.column.Action.override({
  14758. constructor: function (config) {
  14759. var scope = lookupScope(config.$initParent.$initParent);
  14760. _$2.forEach(config.items, function (item) {
  14761. if (typeof item.handler === 'string') {
  14762. item.handler = lookupFn(scope, item.handler);
  14763. if (typeof item.handler === 'function') {
  14764. item.handler = item.handler.bind(scope);
  14765. }
  14766. }
  14767. });
  14768. ctAction.call(this, config);
  14769. }
  14770. });
  14771. var ck = Ext.grid.column.Check.prototype.constructor;
  14772. Ext.grid.column.Check.override({
  14773. constructor: function (config) {
  14774. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14775. var grid = sender.view.grid.ownerGrid;
  14776. var column = grid.getColumns()[sender.fullColumnIndex];
  14777. var context = {
  14778. event: e,
  14779. column: column,
  14780. field: sender.dataIndex,
  14781. value: checked,
  14782. record: record,
  14783. rowIdx: rowIndex
  14784. };
  14785. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14786. });
  14787. ck.call(this, config);
  14788. }
  14789. });
  14790. // 227573
  14791. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14792. // Ext.define('Yvan.ColumnOverride', {
  14793. // override: 'Ext.grid.column.Column',
  14794. //
  14795. // config: {
  14796. // enableSortOnClick: false,
  14797. // },
  14798. //
  14799. // // /**@Overrides*/
  14800. // onTitleElClick: function (e, t, sortOnClick) {
  14801. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14802. // if (!$(e.target).is('.x-column-header-trigger')) {
  14803. // // 不是点击菜单的情况下,让列自适应宽度
  14804. // this.autoSize()
  14805. // }
  14806. // return onTitleElClick.call(this, e, t, false)
  14807. // }
  14808. // });
  14809. }
  14810. //# sourceMappingURL=gridcolumn.js.map
  14811. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14812. /**
  14813. * 判断目标字符串与关键字是否重叠
  14814. * @param target 目标字符串
  14815. * @param keyword 搜索关键字
  14816. */
  14817. function pinyinMatch(target, keyword) {
  14818. if (typeof target != 'string' || typeof keyword != 'string') {
  14819. return false;
  14820. }
  14821. if (!keyword || !target) {
  14822. return false;
  14823. }
  14824. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14825. keyword = _$2.toLower(keyword);
  14826. var pos1 = _$2.toLower(target).indexOf(keyword);
  14827. if (pos1 >= 0) {
  14828. return true;
  14829. }
  14830. var len = _$2.intersection(keyword.split('')).length;
  14831. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14832. return true;
  14833. }
  14834. return false;
  14835. }
  14836. /**
  14837. * 对某个表达式进行求值
  14838. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14839. *
  14840. * @example
  14841. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14842. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14843. *
  14844. * @param data 数据环境对象
  14845. * @param express 表达式对象
  14846. */
  14847. function calcExpress(data, express) {
  14848. var result = express;
  14849. if (SIMPLE_RE.test(express)) {
  14850. // '{foo}' 简单表达式
  14851. var path = express.substring(1, express.length - 1);
  14852. var ret = _$2.get(data, path);
  14853. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14854. }
  14855. while (true) {
  14856. var mlist = result.match(/{(.*?)}/);
  14857. if (!mlist) {
  14858. break;
  14859. }
  14860. var pathC = mlist[0]; // {query.a}
  14861. var path = mlist[1]; // query.a
  14862. var value = _$2.get(data, path);
  14863. result = result.replaceAll(pathC, value || '');
  14864. }
  14865. return result;
  14866. }
  14867. /**
  14868. * 对个对象进行表达式求值,不用回调
  14869. * @example
  14870. * 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}'] })
  14871. *
  14872. * {
  14873. * a: '{query.a}',
  14874. * b: {
  14875. * b1: '{query.b1}',
  14876. * b2: '{query.b2}',
  14877. * },
  14878. * c: 'aa',
  14879. * d: [
  14880. * '{query.d1}',
  14881. * '{query.d2}'
  14882. * ]
  14883. * }
  14884. *
  14885. * 计算结果为
  14886. * {
  14887. * a: 'aValue',
  14888. * b: {
  14889. * b1: 'b1Value',
  14890. * b2: 'b2Value'
  14891. * },
  14892. * c: 'aa'
  14893. * d: [
  14894. * '1',
  14895. * '2'
  14896. * ]
  14897. * }
  14898. *
  14899. * @param data
  14900. * @param paramObject
  14901. */
  14902. function calcObjectFlat(data, paramObject) {
  14903. var result = _$2.cloneDeep(paramObject);
  14904. if (typeof paramObject === 'string') {
  14905. return calcExpress(data, paramObject);
  14906. }
  14907. var trav = function (param) {
  14908. _$2.forOwn(param, function (value, key) {
  14909. if (_$2.isPlainObject(value)) {
  14910. // 深度递归,对子对象进行求解
  14911. trav(value);
  14912. }
  14913. else if (_$2.isString(value)) {
  14914. // 字符串直接用 calcExpress 表达式求解
  14915. param[key] = calcExpress(data, param[key]);
  14916. }
  14917. else if (_$2.isArray(value)) {
  14918. // 数组求解
  14919. _$2.each(value, function (v, idx) {
  14920. value[idx] = calcExpress(data, v);
  14921. });
  14922. }
  14923. });
  14924. };
  14925. trav(result);
  14926. return result;
  14927. }
  14928. /**
  14929. * 合併 data 到當前的 ViewModel 對象
  14930. */
  14931. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  14932. var newRow = {};
  14933. if (isFlat == false) {
  14934. newRow = data;
  14935. }
  14936. else {
  14937. flatObject(newRow, '', data);
  14938. }
  14939. if (!propertyName) {
  14940. _$2.forOwn(newRow, function (value, key) {
  14941. viewModel.set(key, value);
  14942. });
  14943. }
  14944. else {
  14945. _$2.forOwn(newRow, function (value, key) {
  14946. viewModel.set(propertyName + "." + key, value);
  14947. });
  14948. }
  14949. }
  14950. /**
  14951. * 转换内联结构的行,到平面结构
  14952. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  14953. *
  14954. * @param array
  14955. * @param flatOption
  14956. * @return {[]}
  14957. */
  14958. function flatRow(array) {
  14959. var ret = [];
  14960. _$2.forEach(array, function (row) {
  14961. var newRow = {};
  14962. flatObject(newRow, '', row);
  14963. ret.push(newRow);
  14964. });
  14965. return ret;
  14966. }
  14967. function flatObject(parentObj, parentProp, obj) {
  14968. _$2.forOwn(obj, function (value, key) {
  14969. var fullKey = parentProp ? parentProp + '_' + key : key;
  14970. if (_$2.isArray(value)) {
  14971. parentObj[fullKey] = _$2.map(value, function (row) {
  14972. var newRow = {};
  14973. flatObject(newRow, '', row);
  14974. return newRow;
  14975. });
  14976. }
  14977. else {
  14978. if (typeof value === 'object') {
  14979. flatObject(parentObj, fullKey, value);
  14980. }
  14981. else {
  14982. parentObj[fullKey] = value;
  14983. }
  14984. }
  14985. });
  14986. }
  14987. /**
  14988. * 替换内部结构中,所有 N/A
  14989. */
  14990. function replaceNA(obj) {
  14991. if (obj === 'N/A') {
  14992. return '';
  14993. }
  14994. if (_$2.isArray(obj)) {
  14995. _$2.forEach(obj, function (value, idx) {
  14996. if (value === 'N/A') {
  14997. obj[idx] = '';
  14998. }
  14999. else {
  15000. replaceNA(value);
  15001. }
  15002. });
  15003. }
  15004. else if (_$2.isPlainObject(obj)) {
  15005. _$2.forOwn(obj, function (value, key) {
  15006. if (value === 'N/A') {
  15007. obj[key] = '';
  15008. }
  15009. else {
  15010. replaceNA(value);
  15011. }
  15012. });
  15013. }
  15014. }
  15015. /**
  15016. * 根据表达式进入写值
  15017. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15018. * express="test-{query.a}" 写值就会失败
  15019. *
  15020. * @example
  15021. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15022. * 写值成功
  15023. *
  15024. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15025. * 写值失败
  15026. *
  15027. * @param viewModel VM对象
  15028. * @param express 表达式对象
  15029. * @param value 目标值
  15030. */
  15031. function tryWriteByExpress(viewModel, express, value) {
  15032. if (SIMPLE_RE.test(express)) {
  15033. // '{foo}' 简单表达式
  15034. express = express.substring(1, express.length - 1);
  15035. viewModel.set(express, value);
  15036. }
  15037. }
  15038. /**
  15039. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15040. * @example
  15041. * 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]})
  15042. *
  15043. * expressObject:
  15044. * {
  15045. * a: '{query.a}',
  15046. * b: {
  15047. * b1: '{query.b1}',
  15048. * b2: '{query.b2}',
  15049. * },
  15050. * c: 'aa',
  15051. * d: [
  15052. * '{query.a}',
  15053. * '{query.b2}'
  15054. * ]
  15055. * }
  15056. *
  15057. * valueObject:
  15058. * {
  15059. * a: 'aValue',
  15060. * b: {
  15061. * b1: 'b1Value',
  15062. * b2: 'b2Value'
  15063. * },
  15064. * c: 'aa'
  15065. * c: [
  15066. * 'aValue',
  15067. * 'b2Value'
  15068. * ]
  15069. * }
  15070. *
  15071. * 系统会尝试回写
  15072. * viewModel.set('query.a', 'aValue')
  15073. * viewModel.set('query.b1', 'b1Value')
  15074. * viewModel.set('query.b2', 'b2Value')
  15075. *
  15076. * @param expressObject 含表达式的对象
  15077. * @param valueObject 表达式计算完成之后的结果对象
  15078. * @param writeFn 写入的方法 (path, value)=>void
  15079. */
  15080. function tryWriteObject(expressObject, valueObject, writeFn) {
  15081. var trav = function (pathPrefix) {
  15082. var parent = expressObject;
  15083. if (_$2.size(pathPrefix) > 1) {
  15084. parent = _$2.get(parent, pathPrefix.substring(1));
  15085. }
  15086. _$2.forOwn(parent, function (value, key) {
  15087. if (_$2.isPlainObject(value)) {
  15088. // 深度递归,对子对象进行求解
  15089. trav(pathPrefix + "." + key);
  15090. }
  15091. else if (_$2.isString(value)) {
  15092. // 字符串直接用 calcExpress 表达式求解
  15093. if (SIMPLE_RE.test(value)) {
  15094. // If we have '{foo}' alone it is a literal 简单表达式
  15095. var targetPath = value.substring(1, value.length - 1);
  15096. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15097. if (!writeFn) {
  15098. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15099. }
  15100. else {
  15101. writeFn(targetPath, targetValue);
  15102. }
  15103. }
  15104. }
  15105. else if (_$2.isArray(value)) {
  15106. _$2.each(value, function (v, idx) {
  15107. if (SIMPLE_RE.test(v)) {
  15108. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15109. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15110. if (!writeFn) {
  15111. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15112. }
  15113. else {
  15114. writeFn(targetPath, targetValue);
  15115. }
  15116. }
  15117. });
  15118. }
  15119. });
  15120. };
  15121. trav("");
  15122. }
  15123. /**
  15124. * 尝试去掉变量两边括号
  15125. * {a} => a
  15126. * a => a
  15127. */
  15128. function tryVarSimple(value) {
  15129. if (SIMPLE_RE.test(value)) {
  15130. // If we have '{foo}' alone it is a literal 简单表达式
  15131. return value.substring(1, value.length - 1);
  15132. }
  15133. return value;
  15134. }
  15135. /**
  15136. * 对多个表达式进行求值. 异步回调的方式返回
  15137. * {
  15138. * a: 1,
  15139. * b: '{someBind}',
  15140. * c: ['a', 'b', 'c'],
  15141. * d: ['a', 'b', '{someBind}'],
  15142. * e: {
  15143. * y: 1,
  15144. * z: 2
  15145. * },
  15146. * f: {
  15147. * y: 1,
  15148. * z: '{someBind}'
  15149. * }
  15150. * }
  15151. *
  15152. * // Will produce
  15153. * {
  15154. * b: value,
  15155. * d: ['a', 'b', value],
  15156. * f: {
  15157. * y: 1,
  15158. * z: value
  15159. * }
  15160. * }
  15161. * @param viewModel scope.viewModel对象
  15162. * @param paramObject 求值对象
  15163. */
  15164. function calcObject(viewModel, paramObject) {
  15165. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15166. return new Promise(function (resolve) {
  15167. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15168. schedule.destroy();
  15169. // 从 Ext.data.Model 对象转换为 js-object 对象
  15170. ret = toPlainObject(ret);
  15171. resolve(ret);
  15172. }, viewModel, { single: true });
  15173. });
  15174. }
  15175. /**
  15176. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15177. * @param config 组件构造函数传入的 config 配置文件
  15178. */
  15179. function getParentGrid(config) {
  15180. var _a;
  15181. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15182. }
  15183. /**
  15184. * 解析
  15185. * {
  15186. * condition: "{skuId}",
  15187. * errorMsg: "无法编辑",
  15188. * notice: 'msg'
  15189. * }
  15190. */
  15191. function tryEnable(data, enableSetting) {
  15192. if (!enableSetting) {
  15193. // 没有这一段配置,可以编辑
  15194. return true;
  15195. }
  15196. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15197. if (!evalFunction(data, condition)) {
  15198. // 没有达成 condition 条件
  15199. // 计算 msg 消息内容
  15200. var msgContent = calcExpress(data, errorMsg);
  15201. if (msgContent) {
  15202. if (!notice || notice === 'msg') {
  15203. // 进行提示
  15204. msg$1(msgContent);
  15205. }
  15206. }
  15207. return false;
  15208. }
  15209. return true;
  15210. }
  15211. /**
  15212. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15213. * @param sender 目标对象
  15214. * @param config 目标对象的配置(在构造函数之前也可以)
  15215. * @param getDictFn 获取字典的方法
  15216. * @param bizKey 传入字典的参数
  15217. * @param multiValueSeparator 多个字典值的分割符号
  15218. */
  15219. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15220. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15221. // sender 和 config为空的时候获取值、
  15222. if (_$2.isArray(getDictFn)) {
  15223. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15224. var realArray_1 = getDictFn;
  15225. getDictFn = function () {
  15226. return realArray_1;
  15227. };
  15228. }
  15229. if (!sender) {
  15230. return new Promise(function (resolve, reject) {
  15231. getDictFn(bizKey, function (r) {
  15232. resolve({ config: config, r: r });
  15233. });
  15234. });
  15235. }
  15236. if (sender.xtype === 'combotree') {
  15237. getDictFn(bizKey, function (r) {
  15238. if (sender.store) {
  15239. // 异步回传
  15240. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15241. }
  15242. else {
  15243. // 同步回传
  15244. config.store = new Ext.data.TreeStore({ root: r });
  15245. }
  15246. });
  15247. return;
  15248. }
  15249. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15250. getDictFn(bizKey, function (r) {
  15251. var _a, _b;
  15252. if (sender.store) {
  15253. // 异步回传
  15254. sender.setStore(new Ext.data.Store(r));
  15255. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15256. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15257. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15258. if (typeof realValue !== 'undefined') {
  15259. sender.setValue(realValue);
  15260. }
  15261. }
  15262. else {
  15263. // 同步回传
  15264. config.store = new Ext.data.Store(r);
  15265. }
  15266. });
  15267. return;
  15268. }
  15269. else if (sender.xtype === 'gridcolumn') {
  15270. var grid = getParentGrid(config);
  15271. var editor_1 = config.editor, renderer = config.renderer;
  15272. getDictFn(bizKey, function (r) {
  15273. if (sender.store) {
  15274. // 已经渲染出来了, 用方法进行修改
  15275. var editor_2 = sender.getEditor();
  15276. if (editor_2 && editor_2.xtype === 'combo') {
  15277. var valueField_1 = r.field[0];
  15278. var displayField_1 = r.field[1];
  15279. editor_2.valueField = valueField_1;
  15280. editor_2.setDisplayField(displayField_1);
  15281. editor_2.setStore(new Ext.data.Store(r));
  15282. }
  15283. sender.setFilter({
  15284. type: 'list',
  15285. options: _$2.map(r.data, function (r) { return ({
  15286. id: '' + r.id,
  15287. text: r.text,
  15288. }); })
  15289. });
  15290. }
  15291. else {
  15292. // 没有渲染之前,修改 config 即可
  15293. if (editor_1 && editor_1.xtype === 'combo') {
  15294. // 带编辑模式
  15295. editor_1.store = new Ext.data.Store(r);
  15296. }
  15297. config.filter = {
  15298. type: 'list',
  15299. options: _$2.map(r.data, function (r) { return ({
  15300. id: '' + r.id,
  15301. text: r.text,
  15302. }); })
  15303. };
  15304. }
  15305. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15306. var renderer = function (value, metaData) {
  15307. if (metaData === void 0) { metaData = false; }
  15308. if (!value && value != 0) {
  15309. return '';
  15310. }
  15311. var valueField = r.field[metaData === true ? 1 : 0];
  15312. var displayField = r.field[metaData === true ? 0 : 1];
  15313. var separator = multiValueSeparator;
  15314. if (separator) {
  15315. var arr = value.split(separator);
  15316. var displayValue_1 = "";
  15317. var _loop_1 = function (i) {
  15318. var itv = arr[i];
  15319. if (i > 0) {
  15320. displayValue_1 += separator;
  15321. }
  15322. _$2.each(r.data, function (row) {
  15323. // 从 valueField 找到要显示的 displayField
  15324. if (row[valueField] == itv) {
  15325. displayValue_1 += row[displayField];
  15326. return false;
  15327. }
  15328. else {
  15329. if (i >= r.data.length - 1) {
  15330. displayValue_1 += itv;
  15331. }
  15332. }
  15333. });
  15334. };
  15335. for (var i = 0; i < arr.length; i++) {
  15336. _loop_1(i);
  15337. }
  15338. return displayValue_1;
  15339. }
  15340. _$2.each(r.data, function (row) {
  15341. // 从 valueField 找到要显示的 displayField
  15342. if (row[valueField] == value) {
  15343. value = row[displayField];
  15344. return false;
  15345. }
  15346. });
  15347. return value;
  15348. };
  15349. var dictForExcel = {};
  15350. var valueField = r.field[0];
  15351. var displayField = r.field[1];
  15352. _$2.each(r.data, function (row) {
  15353. // 从 valueField 找到要显示的 displayField
  15354. var key = row[valueField];
  15355. if (key != '' && typeof key != "undefined" && key != null) {
  15356. dictForExcel[key] = row[displayField];
  15357. }
  15358. });
  15359. if (sender.rendered) {
  15360. // 已经渲染出来了, 对列进行渲染
  15361. sender.renderer = renderer;
  15362. sender.dictForExcel = dictForExcel;
  15363. sender.getView().refresh();
  15364. }
  15365. else {
  15366. sender.renderer = renderer;
  15367. sender.dictForExcel = dictForExcel;
  15368. config.renderer = renderer;
  15369. config.dictForExcel = dictForExcel;
  15370. }
  15371. });
  15372. return;
  15373. }
  15374. throw new TypeError("无法识别的组件类型");
  15375. }
  15376. /**
  15377. * 调用服务器 Ajax
  15378. */
  15379. function invokeServer$1(url) {
  15380. var args = [];
  15381. for (var _i = 1; _i < arguments.length; _i++) {
  15382. args[_i - 1] = arguments[_i];
  15383. }
  15384. // @ts-ignore
  15385. return ajax.func({
  15386. url: url,
  15387. method: 'invoke',
  15388. args: args
  15389. });
  15390. }
  15391. function clearViewModelValues(viewModel, propertyName) {
  15392. if (!propertyName) {
  15393. var dd_1 = viewModel.getData();
  15394. _$2.forOwn(dd_1, function (value, key) {
  15395. viewModel.set(key, '');
  15396. });
  15397. return;
  15398. }
  15399. var dd = _$2.get(viewModel.getData(), propertyName);
  15400. _$2.forOwn(dd, function (value, key) {
  15401. viewModel.set(propertyName + '.' + key, '');
  15402. });
  15403. }
  15404. function reloadGrid(scope, gridRefName) {
  15405. var _a;
  15406. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15407. }
  15408. /**
  15409. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15410. */
  15411. function toPlainObject(obj) {
  15412. if (obj.isModel) {
  15413. obj = obj.data;
  15414. }
  15415. _$2.forOwn(obj, function (v, k) {
  15416. // Ext.data.Model.constructor
  15417. if (!v) {
  15418. return;
  15419. }
  15420. if (v.isModel) {
  15421. v = v.data;
  15422. }
  15423. if (typeof v === 'object') {
  15424. obj[k] = toPlainObject(v);
  15425. }
  15426. else {
  15427. obj[k] = v;
  15428. }
  15429. });
  15430. return obj;
  15431. }
  15432. function confirm(msg, sender) {
  15433. return new Promise(function (resolve) {
  15434. var _a, _b;
  15435. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15436. var config = {
  15437. title: '请确认',
  15438. modal: true,
  15439. animateTarget: sender,
  15440. // resizable: false,
  15441. // constrainHeader: true,
  15442. // constrain: true,
  15443. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15444. layout: {
  15445. type: 'hbox',
  15446. pack: 'start',
  15447. align: 'stretch'
  15448. },
  15449. items: [
  15450. {
  15451. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15452. border: false,
  15453. },
  15454. {
  15455. flex: 1,
  15456. border: false,
  15457. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(msg) + "</div>"
  15458. }
  15459. ],
  15460. buttons: [
  15461. {
  15462. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15463. handler: function () {
  15464. resolve();
  15465. win.close();
  15466. }
  15467. },
  15468. {
  15469. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15470. handler: function () {
  15471. win.close();
  15472. }
  15473. }
  15474. ],
  15475. keyMapEnabled: true,
  15476. keyMap: {
  15477. ENTER: function () {
  15478. resolve();
  15479. win.close();
  15480. }
  15481. }
  15482. };
  15483. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15484. config.constrain = true;
  15485. }
  15486. var win = new Ext.Window(config);
  15487. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15488. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15489. }
  15490. win.show();
  15491. });
  15492. }
  15493. /**
  15494. * 任何符号字符串都替换成下换线
  15495. */
  15496. function normId(value) {
  15497. return _$2.replace(value, /[^\w]/g, '_');
  15498. }
  15499. /**
  15500. *
  15501. * @param sender
  15502. * @param propertyName
  15503. * @param gridRefName
  15504. */
  15505. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15506. var _a, _b;
  15507. var scope = lookupScope(sender);
  15508. clearViewModelValues(scope.viewModel, propertyName);
  15509. if (!gridRefName) {
  15510. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15511. }
  15512. else {
  15513. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15514. }
  15515. }
  15516. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15517. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15518. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15519. var value = _$2.trim(sender.rawValue);
  15520. raiseClick(eOpts.handle);
  15521. }
  15522. }, 150);
  15523. function saveGridRow(grid1) {
  15524. var _a;
  15525. var config = grid1.config;
  15526. var scope = lookupScope(grid1);
  15527. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15528. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15529. // "表格保存"的相关配置
  15530. var dbSaveConfig = {
  15531. columns: [],
  15532. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15533. saveRowValues: saveRowValues,
  15534. path: scope.originalVjson.__custom_path,
  15535. };
  15536. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15537. if (err) {
  15538. // 如果有异常就不保存
  15539. return;
  15540. }
  15541. // 构建"表格保存"的相关配置
  15542. for (var i = 0; i < config.columns.length; i++) {
  15543. var c = config.columns[i];
  15544. var v = {
  15545. dataIndex: c.dataIndex,
  15546. header: c.header,
  15547. dbColumn: c.dbColumn,
  15548. serverCreateValue: c.serverCreateValue,
  15549. dbIsDeleteKey: c.dbIsDeleteKey,
  15550. dbIsUpdateKey: c.dbIsUpdateKey,
  15551. dbUpdateEnable: c.dbUpdateEnable,
  15552. serverValueConvert: c.dbUpdateEnable,
  15553. };
  15554. if (c.editor) {
  15555. v.editor = {
  15556. xtype: c.editor.xtype,
  15557. required: c.editor.required,
  15558. };
  15559. }
  15560. dbSaveConfig.columns.push(v);
  15561. }
  15562. // 进行业务上的逻辑校验
  15563. var hasError = false;
  15564. _$2.forEach(rows, function (row, i) {
  15565. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15566. var c = config.columns[i_1];
  15567. var value = row[c.dataIndex];
  15568. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15569. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15570. hasError = true;
  15571. return false;
  15572. }
  15573. if (c.xtype === 'checkcolumn') {
  15574. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15575. row[c.dataIndex] = c.uncheckedValue;
  15576. }
  15577. if (value === true && typeof c.checkedValue !== 'undefined') {
  15578. row[c.dataIndex] = c.checkedValue;
  15579. }
  15580. }
  15581. }
  15582. });
  15583. if (hasError) {
  15584. return;
  15585. }
  15586. // 设置当前界面为 "保存中..." 状态
  15587. grid1.setLoading(true);
  15588. invokeServer$1('/Dev@batchSave', {
  15589. newRows: newRows,
  15590. modifyRows: modifyRows,
  15591. removeRecords: removeRecords,
  15592. config: dbSaveConfig,
  15593. }).then(function (res) {
  15594. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15595. msg$1(res.msg);
  15596. grid1.reload();
  15597. }).catch(function (e) {
  15598. console.error(e);
  15599. showErrorDialog$1(_$2.toString(e));
  15600. }).finally(function () {
  15601. // 无论正常异常,关闭 "保存中..." 状态
  15602. grid1.setLoading(false);
  15603. });
  15604. }
  15605. function insertGridRow(grid1) {
  15606. var config = grid1.config;
  15607. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15608. var insertRow = {};
  15609. _$2.forEach(config.columns, function (c) {
  15610. var fn = c.createValue;
  15611. if (_$2.startsWith(fn, 'scope.') ||
  15612. _$2.startsWith(fn, 'system.')) {
  15613. var scope = lookupScope(grid1);
  15614. var fn2 = lookupFn(scope, fn, c);
  15615. if (_$2.isFunction(fn2)) {
  15616. var newValue = fn2();
  15617. if (!_$2.isUndefined(newValue)) {
  15618. insertRow[c.dataIndex] = newValue;
  15619. }
  15620. }
  15621. }
  15622. else if (_$2.isString(fn) && fn) {
  15623. insertRow[c.dataIndex] = fn;
  15624. }
  15625. });
  15626. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15627. }
  15628. function commitMe(sender) {
  15629. var window = sender.up('window');
  15630. var scope = lookupScope(sender);
  15631. if (typeof scope['commit'] === 'function') {
  15632. scope['commit']().then(function (res) {
  15633. window.close();
  15634. });
  15635. }
  15636. }
  15637. function removeGridRow(grid1) {
  15638. var _a;
  15639. var config = grid1.config;
  15640. var rows = [];
  15641. if (grid1.selModel.selType === "rowmodel") {
  15642. rows.push(grid1.selection);
  15643. }
  15644. else {
  15645. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15646. rows.push(r);
  15647. });
  15648. }
  15649. if (rows.length > 1) {
  15650. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15651. if (_$2.isUndefined(batchRemoveConfirm)) {
  15652. //不需要提示
  15653. _$2.forEach(rows, function (r) {
  15654. grid1.getStore().remove(r);
  15655. });
  15656. }
  15657. else {
  15658. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15659. confirm(tip).then(function () {
  15660. _$2.forEach(rows, function (r) {
  15661. grid1.getStore().remove(r);
  15662. });
  15663. });
  15664. }
  15665. }
  15666. else if (rows.length === 1) {
  15667. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15668. if (_$2.isUndefined(singleRemoveConfirm)) {
  15669. //不需要提示
  15670. grid1.getStore().remove(rows[0]);
  15671. }
  15672. else {
  15673. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15674. _$2.forEach(config.columns, function (c) {
  15675. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15676. });
  15677. confirm(tip_1).then(function () {
  15678. grid1.getStore().remove(rows[0]);
  15679. });
  15680. }
  15681. }
  15682. else {
  15683. msg$1('请选择要删除的数据!');
  15684. }
  15685. }
  15686. function moveUpGridRow(grid) {
  15687. grid.rowMoveUp();
  15688. }
  15689. function moveDownGridRow(grid) {
  15690. grid.rowMoveDown();
  15691. }
  15692. var SystemEventFu = /** @class */ (function () {
  15693. function SystemEventFu() {
  15694. }
  15695. SystemEventFu.prototype.moveUpGridRow = function () {
  15696. return function (sender) {
  15697. var grid1 = sender.up('yvgrid');
  15698. moveUpGridRow(grid1);
  15699. };
  15700. };
  15701. SystemEventFu.prototype.commitMe = function () {
  15702. return function (sender) {
  15703. commitMe(sender);
  15704. };
  15705. };
  15706. SystemEventFu.prototype.moveDownGridRow = function () {
  15707. return function (sender) {
  15708. var grid1 = sender.up('yvgrid');
  15709. moveDownGridRow(grid1);
  15710. };
  15711. };
  15712. SystemEventFu.prototype.saveGridRow = function () {
  15713. return function (sender) {
  15714. var grid1 = sender.up('yvgrid');
  15715. saveGridRow(grid1);
  15716. };
  15717. };
  15718. SystemEventFu.prototype.insertGridRow = function () {
  15719. return function (sender) {
  15720. var grid1 = sender.up('yvgrid');
  15721. insertGridRow(grid1);
  15722. };
  15723. };
  15724. SystemEventFu.prototype.removeGridRow = function () {
  15725. return function (sender) {
  15726. var grid1 = sender.up('yvgrid');
  15727. removeGridRow(grid1);
  15728. };
  15729. };
  15730. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15731. return function (sender, config) {
  15732. if (!config.listeners) {
  15733. config.listeners = {};
  15734. }
  15735. config.listeners.afterrender = function (sender) {
  15736. var scope = lookupScope(sender);
  15737. // $(sender.el.dom).on('keydown', (e) => {
  15738. // const xtype = Ext.fly(e.target).component.xtype
  15739. // if (xtype === 'textfield' && e.keyCode === 13) {
  15740. // Ext.defer(() => {
  15741. // raiseClick(scope.refs[btnReferenceName])
  15742. // })
  15743. // e.preventDefault()
  15744. // e.stopPropagation()
  15745. // return false
  15746. // }
  15747. // })
  15748. $(sender.el.dom).on('keyup', function (e) {
  15749. var tt = Ext.fly(e.target).component;
  15750. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15751. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15752. ![10, 13, 20, 40].includes(e.keyCode)) {
  15753. return;
  15754. }
  15755. e.preventDefault();
  15756. e.stopPropagation();
  15757. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15758. return;
  15759. });
  15760. };
  15761. };
  15762. };
  15763. SystemEventFu.prototype.confirm = function (text, fn) {
  15764. return function (sender) {
  15765. var scope = lookupScope(sender);
  15766. var msg = calcExpress(scope.viewModel.data, text);
  15767. confirm(msg, sender).then(function () {
  15768. fn.call(scope, sender);
  15769. });
  15770. };
  15771. };
  15772. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15773. return function (sender) {
  15774. var scope = lookupScope(sender);
  15775. var grid = scope.refs[gridRefName];
  15776. if (grid) {
  15777. var records = grid.getSelectionModel().getLastSelected();
  15778. grid.store.remove(records);
  15779. }
  15780. };
  15781. };
  15782. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15783. //可以是 scope.XX / system.XX / string / lookup表达式
  15784. writeTarget) {
  15785. return function (sender) {
  15786. if (!invokeUrl) {
  15787. return;
  15788. }
  15789. var scope = lookupScope(sender);
  15790. scope.setLoading(true);
  15791. var data = scope.viewModel.data;
  15792. if (invokeParam) {
  15793. data = calcObjectFlat(data, invokeParam);
  15794. }
  15795. invokeServer$1(invokeUrl, data).then(function (res) {
  15796. if (res.success) {
  15797. if (typeof writeTarget === "string") {
  15798. _$2.forOwn(res.data, function (v, k) {
  15799. scope.viewModel.set(writeTarget + "." + k, v);
  15800. });
  15801. }
  15802. else if (typeof writeTarget === 'function') {
  15803. writeTarget.call(scope, res.data);
  15804. }
  15805. else if (typeof writeTarget === 'object') {
  15806. var ret = calcObjectFlat(res.data, writeTarget);
  15807. _$2.forOwn(ret, function (v, k) {
  15808. scope.viewModel.set(k, v);
  15809. });
  15810. }
  15811. }
  15812. else {
  15813. showErrorDialog$1(res.msg || '未知错误', sender);
  15814. }
  15815. }).catch(function (e) {
  15816. var _a, _b;
  15817. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15818. showErrorDialog$1(msg || e.toString(), sender);
  15819. }).finally(function () {
  15820. scope.setLoading(false);
  15821. });
  15822. };
  15823. };
  15824. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15825. return function (sender) {
  15826. var scope = lookupScope(sender);
  15827. scope.setLoading(true);
  15828. var data = scope.viewModel.data;
  15829. if (arg0) {
  15830. data = calcObjectFlat(data, arg0);
  15831. }
  15832. invokeServer$1(groovyUrl, data).then(function (res) {
  15833. if (res.success) {
  15834. if (res.msg) {
  15835. msg(res.msg);
  15836. }
  15837. if (typeof successCallback === 'function') {
  15838. successCallback.call(scope, sender, res.data);
  15839. }
  15840. }
  15841. else {
  15842. showErrorDialog$1(res.msg || '未知错误', sender);
  15843. }
  15844. }).catch(function (e) {
  15845. var _a, _b;
  15846. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15847. showErrorDialog$1(msg || e.toString(), sender);
  15848. }).finally(function () {
  15849. scope.setLoading(false);
  15850. });
  15851. };
  15852. };
  15853. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15854. return function (sender) {
  15855. var scope = lookupScope(sender);
  15856. var form = scope.down('form');
  15857. if (form) {
  15858. // 如果下级有表单,就做表单校验
  15859. var valid = form.isValid();
  15860. if (!valid) {
  15861. return;
  15862. }
  15863. }
  15864. scope.setLoading(true);
  15865. var data = scope.viewModel.data;
  15866. if (arg0) {
  15867. data = calcObjectFlat(data, arg0);
  15868. }
  15869. invokeServer$1(groovyUrl, data).then(function (res) {
  15870. if (res.success) {
  15871. if (res.msg) {
  15872. msg(res.msg);
  15873. }
  15874. scope.dialogSuccess(res);
  15875. }
  15876. else {
  15877. showErrorDialog$1(res.msg || '未知错误', sender);
  15878. }
  15879. }).catch(function (e) {
  15880. var _a, _b;
  15881. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15882. showErrorDialog$1(msg || e.toString(), sender);
  15883. }).finally(function () {
  15884. scope.setLoading(false);
  15885. });
  15886. };
  15887. };
  15888. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  15889. return function (sender) {
  15890. var scope = lookupScope(sender);
  15891. if (lookupObject) {
  15892. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  15893. }
  15894. else {
  15895. scope.dialogSuccess();
  15896. }
  15897. };
  15898. };
  15899. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  15900. return function (sender) {
  15901. var scope = lookupScope(sender);
  15902. clearViewModelValues(scope.viewModel, propertyName);
  15903. };
  15904. };
  15905. SystemEventFu.prototype.getGrid = function (url) {
  15906. return function (sender, config) {
  15907. if (config.xtype == "combogridmulti") {
  15908. // @ts-ignore
  15909. require([url], function (grid) {
  15910. _$2.forOwn(grid.default, function (v, k) {
  15911. sender[k] = v;
  15912. sender.config[k] = v;
  15913. if (sender.rendered) {
  15914. // 已经渲染出来了,重新调用 reload 强制刷新
  15915. sender.reload();
  15916. }
  15917. });
  15918. });
  15919. }
  15920. else {
  15921. // @ts-ignore
  15922. require([url], function (grid) {
  15923. sender.grid = grid.default;
  15924. config.grid = grid.default;
  15925. });
  15926. }
  15927. };
  15928. };
  15929. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  15930. return function (sender) {
  15931. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  15932. };
  15933. };
  15934. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  15935. return function (sender) {
  15936. var _a, _b;
  15937. var scope = lookupScope(sender);
  15938. if (!gridRefName) {
  15939. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15940. }
  15941. else {
  15942. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15943. }
  15944. };
  15945. };
  15946. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  15947. return function (sender) {
  15948. var scope = lookupScope(sender);
  15949. var data = scope.viewModel.data;
  15950. var param = calcObjectFlat(data, lookupForData);
  15951. // @ts-ignore
  15952. require([url], function (module) {
  15953. var ScopeClass = module.default;
  15954. var scope = new ScopeClass();
  15955. scope.success = successCallback;
  15956. scope.showDialog(sender, {}, { data: param });
  15957. });
  15958. };
  15959. };
  15960. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  15961. return function (sender, queryValue) {
  15962. showWidget(widgetUrl, lookup, sender, queryValue);
  15963. };
  15964. };
  15965. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  15966. return function (sender) {
  15967. clearViewModelByLookup(sender, lookup);
  15968. };
  15969. };
  15970. SystemEventFu.prototype.closeMe = function (callBack) {
  15971. return function (sender) {
  15972. var scope = lookupScope(sender);
  15973. scope.close();
  15974. if (callBack) {
  15975. callBack.call(sender);
  15976. }
  15977. };
  15978. };
  15979. // 未完成
  15980. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  15981. return function (sender) {
  15982. var scope = lookupScope(sender);
  15983. var data = scope.viewModel.data;
  15984. var billSetting = scope.billSetting;
  15985. var param = calcObjectFlat(data, lookupForData);
  15986. return new Promise(function (resolve, reject) {
  15987. var sf = function (scope) {
  15988. scope.success = function (dlgScope, dlgSender, reData) {
  15989. };
  15990. scope.showDialog(sender, {}, { data: param });
  15991. };
  15992. // @ts-ignore
  15993. require([url], function (module) {
  15994. // 业务描述文件
  15995. if (url.endsWith(".bill")) {
  15996. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  15997. sf(scope);
  15998. });
  15999. }
  16000. else { //原生yvanui文件
  16001. var ScopeClass = module.default;
  16002. var scope_1 = new ScopeClass();
  16003. sf(scope_1);
  16004. }
  16005. });
  16006. });
  16007. };
  16008. };
  16009. __decorate([
  16010. Lib({
  16011. title: '为某个表格,上移行',
  16012. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16013. }),
  16014. __metadata("design:type", Function),
  16015. __metadata("design:paramtypes", []),
  16016. __metadata("design:returntype", void 0)
  16017. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16018. __decorate([
  16019. Lib({
  16020. title: '为某个表格,上移行',
  16021. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16022. }),
  16023. __metadata("design:type", Function),
  16024. __metadata("design:paramtypes", []),
  16025. __metadata("design:returntype", void 0)
  16026. ], SystemEventFu.prototype, "commitMe", null);
  16027. __decorate([
  16028. Lib({
  16029. title: '为某个表格,下移行',
  16030. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16031. }),
  16032. __metadata("design:type", Function),
  16033. __metadata("design:paramtypes", []),
  16034. __metadata("design:returntype", void 0)
  16035. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16036. __decorate([
  16037. Lib({
  16038. title: '为某个表格,批量保存至数据库',
  16039. author: '罗一帆',
  16040. createAt: '2022-07-19',
  16041. updateAt: '2022-07-19',
  16042. type: 'system',
  16043. category: '表格',
  16044. }),
  16045. __metadata("design:type", Function),
  16046. __metadata("design:paramtypes", []),
  16047. __metadata("design:returntype", void 0)
  16048. ], SystemEventFu.prototype, "saveGridRow", null);
  16049. __decorate([
  16050. Lib({
  16051. title: '为某个表格插入数据行',
  16052. author: '罗一帆',
  16053. createAt: '2022-07-19',
  16054. updateAt: '2022-07-19',
  16055. type: 'system',
  16056. category: '表格',
  16057. }),
  16058. __metadata("design:type", Function),
  16059. __metadata("design:paramtypes", []),
  16060. __metadata("design:returntype", void 0)
  16061. ], SystemEventFu.prototype, "insertGridRow", null);
  16062. __decorate([
  16063. Lib({
  16064. title: '为某个表格删除所选数据行',
  16065. author: '罗一帆',
  16066. createAt: '2022-07-19',
  16067. updateAt: '2022-07-19',
  16068. type: 'system',
  16069. category: '表格',
  16070. }),
  16071. __metadata("design:type", Function),
  16072. __metadata("design:paramtypes", []),
  16073. __metadata("design:returntype", void 0)
  16074. ], SystemEventFu.prototype, "removeGridRow", null);
  16075. __decorate([
  16076. Lib({
  16077. title: '按下回车键之后默认是否按下某个按钮',
  16078. author: '罗一帆',
  16079. createAt: '2021-07-02',
  16080. updateAt: '2021-07-02',
  16081. type: 'system',
  16082. category: '字典',
  16083. }),
  16084. __metadata("design:type", Function),
  16085. __metadata("design:paramtypes", [Object]),
  16086. __metadata("design:returntype", void 0)
  16087. ], SystemEventFu.prototype, "enterToClick", null);
  16088. __decorate([
  16089. Lib({
  16090. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16091. author: '罗一帆',
  16092. createAt: '2021-07-06',
  16093. updateAt: '2021-07-06',
  16094. type: 'system',
  16095. category: '对话框',
  16096. }),
  16097. __param(0, LibParam('对话框的确认文字', 'string')),
  16098. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16099. __metadata("design:type", Function),
  16100. __metadata("design:paramtypes", [Object, Object]),
  16101. __metadata("design:returntype", void 0)
  16102. ], SystemEventFu.prototype, "confirm", null);
  16103. __decorate([
  16104. Lib({
  16105. title: '删除表格当前的选中行(前端删除)',
  16106. author: '罗一帆',
  16107. createAt: '2021-07-08',
  16108. updateAt: '2021-07-08',
  16109. type: 'system',
  16110. category: '表格',
  16111. }),
  16112. __param(0, LibParam('表格引用名', 'refs')),
  16113. __metadata("design:type", Function),
  16114. __metadata("design:paramtypes", [Object]),
  16115. __metadata("design:returntype", void 0)
  16116. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16117. __decorate([
  16118. Lib({
  16119. title: '查询表单,如果 url 为空值,就取消查询',
  16120. author: '罗一帆',
  16121. createAt: '2021-07-06',
  16122. updateAt: '2021-07-06',
  16123. type: 'system',
  16124. category: '表单',
  16125. }),
  16126. __param(0, LibParam('后端服务路径', 'string')),
  16127. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16128. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16129. __metadata("design:type", Function),
  16130. __metadata("design:paramtypes", [String, Object, Object]),
  16131. __metadata("design:returntype", void 0)
  16132. ], SystemEventFu.prototype, "loadForm", null);
  16133. __decorate([
  16134. Lib({
  16135. title: '提交(不做校验、不关闭窗体)',
  16136. author: '罗一帆',
  16137. createAt: '2021-07-02',
  16138. updateAt: '2021-07-02',
  16139. type: 'system',
  16140. category: '表单',
  16141. }),
  16142. __param(0, LibParam('后端服务路径', 'string')),
  16143. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16144. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16145. __metadata("design:type", Function),
  16146. __metadata("design:paramtypes", [String, Object, Object]),
  16147. __metadata("design:returntype", void 0)
  16148. ], SystemEventFu.prototype, "commit", null);
  16149. __decorate([
  16150. Lib({
  16151. title: '提交表单',
  16152. author: '罗一帆',
  16153. createAt: '2021-07-02',
  16154. updateAt: '2021-07-02',
  16155. type: 'system',
  16156. category: '表单',
  16157. }),
  16158. __param(0, LibParam('后端服务路径', 'string')),
  16159. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16160. __metadata("design:type", Function),
  16161. __metadata("design:paramtypes", [String, Object]),
  16162. __metadata("design:returntype", void 0)
  16163. ], SystemEventFu.prototype, "formCommit", null);
  16164. __decorate([
  16165. Lib({
  16166. title: '对话框成功回调',
  16167. author: '罗一帆',
  16168. createAt: '2021-07-02',
  16169. updateAt: '2021-07-02',
  16170. type: 'system',
  16171. category: '对话框',
  16172. }),
  16173. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16174. __metadata("design:type", Function),
  16175. __metadata("design:paramtypes", [Object]),
  16176. __metadata("design:returntype", void 0)
  16177. ], SystemEventFu.prototype, "dialogSuccess", null);
  16178. __decorate([
  16179. Lib({
  16180. title: '清空 viewModel 某个属性',
  16181. author: '罗一帆',
  16182. createAt: '2021-07-02',
  16183. updateAt: '2021-07-02',
  16184. type: 'system',
  16185. category: '表单',
  16186. }),
  16187. __param(0, LibParam('属性路径', 'viewModel', true)),
  16188. __metadata("design:type", Function),
  16189. __metadata("design:paramtypes", [String]),
  16190. __metadata("design:returntype", void 0)
  16191. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16192. __decorate([
  16193. Lib({
  16194. title: '从其他资源获取表格设置',
  16195. author: '罗一帆',
  16196. createAt: '2021-07-02',
  16197. updateAt: '2021-07-02',
  16198. type: 'system',
  16199. category: '表单',
  16200. }),
  16201. __param(0, LibParam('定义文件', 'module')),
  16202. __metadata("design:type", Function),
  16203. __metadata("design:paramtypes", [Object]),
  16204. __metadata("design:returntype", void 0)
  16205. ], SystemEventFu.prototype, "getGrid", null);
  16206. __decorate([
  16207. Lib({
  16208. title: '清空 viewModel 某个属性,并刷新表格',
  16209. author: '罗一帆',
  16210. createAt: '2021-07-02',
  16211. updateAt: '2021-07-02',
  16212. type: 'system',
  16213. category: '表单',
  16214. }),
  16215. __param(0, LibParam('清空的属性', 'viewModel')),
  16216. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16217. __metadata("design:type", Function),
  16218. __metadata("design:paramtypes", [String, String]),
  16219. __metadata("design:returntype", void 0)
  16220. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16221. __decorate([
  16222. Lib({
  16223. title: '刷新表格',
  16224. author: '罗一帆',
  16225. createAt: '2021-07-02',
  16226. updateAt: '2021-07-02',
  16227. type: 'system',
  16228. category: '表单',
  16229. }),
  16230. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16231. __metadata("design:type", Function),
  16232. __metadata("design:paramtypes", [String]),
  16233. __metadata("design:returntype", void 0)
  16234. ], SystemEventFu.prototype, "reloadGrid", null);
  16235. __decorate([
  16236. Lib({
  16237. title: '显示对话框',
  16238. author: '罗一帆',
  16239. createAt: '2021-07-02',
  16240. updateAt: '2021-07-02',
  16241. type: 'system',
  16242. category: '对话框',
  16243. }),
  16244. __param(0, LibParam('业务模块名', 'module')),
  16245. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16246. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16247. __metadata("design:type", Function),
  16248. __metadata("design:paramtypes", [String, Object, Object]),
  16249. __metadata("design:returntype", void 0)
  16250. ], SystemEventFu.prototype, "showDialog", null);
  16251. __decorate([
  16252. Lib({
  16253. title: '弹出查找框(不借助 search)',
  16254. author: '罗一帆',
  16255. createAt: '2021-07-02',
  16256. updateAt: '2021-07-02',
  16257. type: 'system',
  16258. category: '对话框',
  16259. }),
  16260. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16261. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16262. __metadata("design:type", Function),
  16263. __metadata("design:paramtypes", [Object, Object]),
  16264. __metadata("design:returntype", void 0)
  16265. ], SystemEventFu.prototype, "showWidget", null);
  16266. __decorate([
  16267. Lib({
  16268. title: '根据 lookup 清空 viewModel',
  16269. author: '罗一帆',
  16270. createAt: '2021-07-05',
  16271. updateAt: '2021-07-05',
  16272. type: 'system',
  16273. category: '表单',
  16274. }),
  16275. __param(0, LibParam('设值表达式', 'lookup')),
  16276. __metadata("design:type", Function),
  16277. __metadata("design:paramtypes", [Object]),
  16278. __metadata("design:returntype", void 0)
  16279. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16280. __decorate([
  16281. Lib({
  16282. title: '关闭对话框',
  16283. author: '罗一帆',
  16284. createAt: '2021-07-05',
  16285. updateAt: '2021-07-05',
  16286. type: 'system',
  16287. category: '对话框',
  16288. }),
  16289. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16290. __metadata("design:type", Function),
  16291. __metadata("design:paramtypes", [Object]),
  16292. __metadata("design:returntype", void 0)
  16293. ], SystemEventFu.prototype, "closeMe", null);
  16294. __decorate([
  16295. Lib({
  16296. title: '打开对话框并返回数据',
  16297. author: '余亮',
  16298. createAt: '2022-07-07',
  16299. updateAt: '2022-07-07',
  16300. type: 'system',
  16301. category: '对话框',
  16302. }),
  16303. __param(0, LibParam('业务模块名', 'module')),
  16304. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16305. __param(2, LibParam('结果映射关系', 'string', true)),
  16306. __metadata("design:type", Function),
  16307. __metadata("design:paramtypes", [String, Object, Object]),
  16308. __metadata("design:returntype", void 0)
  16309. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16310. return SystemEventFu;
  16311. }());
  16312. /**
  16313. * 清空 viewmodel 里下属的所有属性
  16314. * @param viewModel VM对象
  16315. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16316. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16317. */
  16318. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16319. var data = viewModel.data;
  16320. if (propertyKey) {
  16321. data = _$2.get(data, propertyKey);
  16322. }
  16323. _$2.forOwn(data, function (value, key) {
  16324. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16325. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16326. return;
  16327. }
  16328. viewModel.set(targetKey, '');
  16329. });
  16330. }
  16331. function clearViewModelByLookup(sender, lookup) {
  16332. if (_$2.isPlainObject(lookup)) {
  16333. var parentScope_1 = lookupScope(sender);
  16334. _$2.forOwn(lookup, function (value, key) {
  16335. if (SIMPLE_RE.test(value)) {
  16336. // '{foo}' 简单表达式
  16337. var path = value.substring(1, value.length - 1);
  16338. if (path !== 'queryValue') {
  16339. parentScope_1.viewModel.set(path, '');
  16340. }
  16341. }
  16342. });
  16343. }
  16344. }
  16345. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16346. if (vjson === void 0) { vjson = {}; }
  16347. var parentScope = lookupScope(sender);
  16348. var me = sender;
  16349. // @ts-ignore
  16350. require([widgetUrl], function (widgetScope) {
  16351. var WidgetScopeClass = widgetScope.default;
  16352. widgetScope = new WidgetScopeClass();
  16353. // 传递进 widget.model 的数据
  16354. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16355. widgetScope.parentScope = parentScope;
  16356. widgetScope.searchWidgetSuccess = function (data) {
  16357. if (typeof lookup === 'string') {
  16358. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16359. me.setValue(data[lookup]);
  16360. return;
  16361. }
  16362. /**
  16363. * lookup: {
  16364. * // 扩展到 viewModel 的值做更改
  16365. * WH_CODE: "{queryValue}",
  16366. * WH_NAME: "{query.WH_NAME}",
  16367. * }
  16368. */
  16369. if (_$2.isPlainObject(lookup)) {
  16370. var parentScope_2 = lookupScope(sender);
  16371. tryWriteObject(lookup, data, function (path, value) {
  16372. if (path === 'queryValue') {
  16373. me.setValue(value);
  16374. }
  16375. else {
  16376. parentScope_2.viewModel.set(path, value);
  16377. }
  16378. });
  16379. }
  16380. return true;
  16381. };
  16382. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16383. });
  16384. }
  16385. /**
  16386. * 停止事件的默认行为
  16387. * @param e
  16388. */
  16389. function stopEvent(e) {
  16390. e.preventDefault();
  16391. e.stopPropagation();
  16392. // @ts-ignore
  16393. window.event.cancelBubble = true;
  16394. e.returnValue = false;
  16395. e.cancelBubble = true;
  16396. }
  16397. /**
  16398. * 屏幕中央显示一个黑框提示
  16399. */
  16400. function msg$1(content) {
  16401. msg(content);
  16402. }
  16403. /**
  16404. * 错误对话框的强提醒
  16405. */
  16406. function showErrorDialog$1(msg, sender) {
  16407. showErrorDialog(msg, sender);
  16408. }
  16409. /**
  16410. * 错误对话框的强提醒
  16411. */
  16412. function showInfoDialog(msg, sender) {
  16413. showInfoDialogSimple(msg, sender);
  16414. }
  16415. /**
  16416. * 错误对话框的强提醒
  16417. */
  16418. function prompt$2(message, defaultValue, multiLine) {
  16419. if (defaultValue === void 0) { defaultValue = ""; }
  16420. if (multiLine === void 0) { multiLine = false; }
  16421. return prompt$1(message, defaultValue, multiLine);
  16422. }
  16423. /**
  16424. * 用于计算 express 表达式
  16425. */
  16426. function evalFunction(data, express) {
  16427. var keys = [];
  16428. var values = [];
  16429. _$2.forOwn(data, function (value, key) {
  16430. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16431. if (match) {
  16432. key = key.substring(0, match.index);
  16433. }
  16434. keys.push(key);
  16435. values.push(value);
  16436. });
  16437. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16438. try {
  16439. return func.apply(void 0, __spread(values));
  16440. }
  16441. catch (e) {
  16442. return;
  16443. }
  16444. }
  16445. /**
  16446. * 获取表格编辑的行数据
  16447. */
  16448. function getGridEditRows(grid) {
  16449. return grid.getGridEditRows();
  16450. }
  16451. //# sourceMappingURL=systemLib.js.map
  16452. var SystemLib = /*#__PURE__*/Object.freeze({
  16453. __proto__: null,
  16454. SIMPLE_RE: SIMPLE_RE,
  16455. pinyinMatch: pinyinMatch,
  16456. calcExpress: calcExpress,
  16457. calcObjectFlat: calcObjectFlat,
  16458. mergeViewModel: mergeViewModel,
  16459. flatRow: flatRow,
  16460. replaceNA: replaceNA,
  16461. tryWriteByExpress: tryWriteByExpress,
  16462. tryWriteObject: tryWriteObject,
  16463. tryVarSimple: tryVarSimple,
  16464. calcObject: calcObject,
  16465. getParentGrid: getParentGrid,
  16466. tryEnable: tryEnable,
  16467. setComboStore: setComboStore,
  16468. invokeServer: invokeServer$1,
  16469. clearViewModelValues: clearViewModelValues,
  16470. reloadGrid: reloadGrid,
  16471. toPlainObject: toPlainObject,
  16472. confirm: confirm,
  16473. normId: normId,
  16474. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16475. saveGridRow: saveGridRow,
  16476. insertGridRow: insertGridRow,
  16477. commitMe: commitMe,
  16478. removeGridRow: removeGridRow,
  16479. moveUpGridRow: moveUpGridRow,
  16480. moveDownGridRow: moveDownGridRow,
  16481. SystemEventFu: SystemEventFu,
  16482. clearViewModel: clearViewModel,
  16483. clearViewModelByLookup: clearViewModelByLookup,
  16484. showWidget: showWidget,
  16485. stopEvent: stopEvent,
  16486. msg: msg$1,
  16487. showErrorDialog: showErrorDialog$1,
  16488. showInfoDialog: showInfoDialog,
  16489. prompt: prompt$2,
  16490. evalFunction: evalFunction,
  16491. getGridEditRows: getGridEditRows
  16492. });
  16493. function initTree () {
  16494. Ext.define('Yvan.Tree', {
  16495. extend: 'Ext.tree.Panel',
  16496. alias: 'widget.yvtree',
  16497. xtype: 'yvtree',
  16498. constructor: function (config) {
  16499. var newConfig = _$2.defaultsDeep({
  16500. // 强制性属性
  16501. }, baseConfig(config, 'row-item'), config, tree);
  16502. _$2.assign(newConfig, {
  16503. tbar: [
  16504. {
  16505. xtype: 'textfield',
  16506. // triggerCls: 'x-form-clear-trigger',
  16507. flex: 1,
  16508. emptyText: '搜索过滤',
  16509. enableKeyEvents: true,
  16510. listeners: {
  16511. change: function (sender) {
  16512. var tree = sender.up("treepanel");
  16513. tree.filterByText(this.getRawValue());
  16514. },
  16515. keyup: function (sender, e) {
  16516. var tree = sender.up("treepanel");
  16517. if (e.ESC === e.getKey()) {
  16518. sender.setValue('');
  16519. tree.filterByText('');
  16520. }
  16521. }
  16522. }
  16523. },
  16524. ],
  16525. });
  16526. if (!newConfig.hideRefresh) {
  16527. newConfig.tbar.push({
  16528. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16529. listeners: {
  16530. click: function (sender) {
  16531. var scope = sender.up("yvtree");
  16532. scope.reload();
  16533. }
  16534. }
  16535. });
  16536. }
  16537. if (!newConfig.hideExpand) {
  16538. newConfig.tbar.push({
  16539. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16540. listeners: {
  16541. click: function (sender) {
  16542. var scope = sender.up("yvtree");
  16543. scope.expandAll();
  16544. }
  16545. }
  16546. });
  16547. }
  16548. if (!newConfig.hideCollapse) {
  16549. newConfig.tbar.push({
  16550. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16551. listeners: {
  16552. click: function (sender) {
  16553. var scope = sender.up("yvtree");
  16554. scope.collapseAll();
  16555. }
  16556. }
  16557. });
  16558. }
  16559. this.superclass.constructor.call(this, newConfig);
  16560. },
  16561. /**
  16562. * 在根节点上增加一个节点,会触发 addNode 事件
  16563. * @param props
  16564. */
  16565. addRoot: function (props) {
  16566. var me = this;
  16567. var tableNode = me.getRootNode();
  16568. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16569. if (_$2.isFunction(props)) {
  16570. props = props.call(this, parent);
  16571. }
  16572. _$2.forOwn(props, function (value, key) {
  16573. fieldNode.set(key, value);
  16574. });
  16575. var node = tableNode.appendChild(fieldNode);
  16576. me.ensureVisible(node);
  16577. me.setSelection(node);
  16578. me.fireEvent('addNode', me, {
  16579. parent: tableNode,
  16580. node: node,
  16581. });
  16582. },
  16583. addLast: function (props) {
  16584. var me = this;
  16585. var sel = me.selModel.getSelection();
  16586. if (!sel || sel.length <= 0) {
  16587. msg('请选择一个要添加的同级节点路径');
  16588. return;
  16589. }
  16590. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16591. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16592. if (_$2.isFunction(props)) {
  16593. props = props.call(this, parent);
  16594. }
  16595. _$2.forOwn(props, function (value, key) {
  16596. fieldNode.set(key, value);
  16597. });
  16598. var node = parent.appendChild(fieldNode);
  16599. me.ensureVisible(node);
  16600. me.setSelection(node);
  16601. me.fireEvent('addNode', me, {
  16602. parent: parent,
  16603. node: node,
  16604. });
  16605. },
  16606. addChildren: function (props) {
  16607. var me = this;
  16608. var sel = me.selModel.getSelection();
  16609. if (!sel || sel.length <= 0) {
  16610. msg('请选择一个要添加子节点的路径');
  16611. return;
  16612. }
  16613. var parent = sel[0];
  16614. if (_$2.isFunction(props)) {
  16615. props = props.call(this, parent);
  16616. }
  16617. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16618. _$2.forOwn(props, function (value, key) {
  16619. fieldNode.set(key, value);
  16620. });
  16621. var node = parent.appendChild(fieldNode);
  16622. parent.expand();
  16623. me.ensureVisible(node);
  16624. me.setSelection(node);
  16625. me.fireEvent('addNode', me, {
  16626. parent: parent,
  16627. node: node,
  16628. });
  16629. },
  16630. initComponent: function () {
  16631. var me = this;
  16632. var config = me.config;
  16633. var scope = lookupScope(this);
  16634. if (!isDesignMode(scope, config)) {
  16635. // 转换 dataSource 属性
  16636. convertDataSource(me, scope, config);
  16637. }
  16638. this.superclass.initComponent.call(this);
  16639. this.on({
  16640. afterrender: function (sender) {
  16641. var me = this;
  16642. var config = this.config;
  16643. var dataSource = config.dataSource;
  16644. if (config.autoLoad) {
  16645. if (config.dataSourceCallbackFn) {
  16646. me.reload();
  16647. }
  16648. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16649. me.reload();
  16650. }
  16651. }
  16652. }
  16653. });
  16654. },
  16655. _setDataReal: function (value) {
  16656. var me = this;
  16657. // me.setStore(new Ext.data.TreeStore({
  16658. // root: {
  16659. // expanded: true,
  16660. // // children: value
  16661. // children: [
  16662. // {
  16663. // id: '1', text: 'A',
  16664. // children: [
  16665. // {id: '1', text: 'A',},
  16666. // {id: '2', text: 'B'},
  16667. // ]
  16668. // },
  16669. // {id: '2', text: 'B'},
  16670. // ]
  16671. // }
  16672. // }))
  16673. me.store.setRoot({
  16674. expanded: true,
  16675. children: value
  16676. });
  16677. // me.store = new Ext.data.TreeStore({
  16678. // root: {
  16679. // expanded: true,
  16680. // // children: value
  16681. // children: [
  16682. // {
  16683. // id: '1', text: 'A',
  16684. // children: [
  16685. // {id: '1', text: 'A',},
  16686. // {id: '2', text: 'B'},
  16687. // ]
  16688. // },
  16689. // {id: '2', text: 'B'},
  16690. // ]
  16691. // }
  16692. // })
  16693. },
  16694. /**
  16695. * 重新载入数据(重新计算参数)
  16696. */
  16697. reload: function (reloadParams) {
  16698. if (reloadParams === void 0) { reloadParams = {}; }
  16699. var me = this;
  16700. var config = me.config;
  16701. if (config.dataSourceCallbackFn) {
  16702. // 函数请求刷新
  16703. var scope_1 = lookupScope(this);
  16704. // me.setLoading(true)
  16705. config.dataSourceCallbackFn.call(scope_1, me, {
  16706. successCallback: function (value) {
  16707. me._setDataReal(value);
  16708. // me.setLoading(false)
  16709. me.fireEvent('dataLoadComplete', me, true, value);
  16710. },
  16711. failCallback: function (error) {
  16712. // me.setLoading(false)
  16713. me.fireEvent('dataLoadComplete', me, false, error);
  16714. }
  16715. });
  16716. return;
  16717. }
  16718. var scope = lookupScope(me);
  16719. var dataSource = config.dataSource;
  16720. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16721. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16722. me.setLoading(true);
  16723. invokeServer$1(dataSource.url, params)
  16724. .then(function (res) {
  16725. me._setDataReal(res.data);
  16726. me.fireEvent('dataLoadComplete', me, res);
  16727. })
  16728. .finally(function () {
  16729. me.setLoading(false);
  16730. });
  16731. }
  16732. },
  16733. filterByText: function (text) {
  16734. this._filterText = text;
  16735. this._filterBy(this, text, 'text');
  16736. },
  16737. _filterBy: _$2.debounce(function (me, text, by) {
  16738. var view = me.getView();
  16739. me.store.clearFilter();
  16740. if (!me._filterText) {
  16741. // 没有筛选内容,还原状态
  16742. var selections = me.getSelection();
  16743. var selectionPaths_1 = [];
  16744. _$2.forEach(me.getSelection(), function (item) {
  16745. selectionPaths_1.push(item.getPath());
  16746. });
  16747. me.collapseAll();
  16748. _$2.forEach(selectionPaths_1, function (path) {
  16749. me.expandPath(path);
  16750. });
  16751. me.setSelection(selections);
  16752. return;
  16753. }
  16754. // 递归查找所有需要可见的节点 id 数组
  16755. var nodesAndParents = [];
  16756. var expandPaths = [];
  16757. me.getRootNode().cascadeBy(function (tree, view) {
  16758. var currNode = this;
  16759. currNode.collapse();
  16760. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16761. // 展开到匹配的路径
  16762. // me.expandPath(currNode.getPath());
  16763. expandPaths.push(currNode.getPath());
  16764. // 沿途父节点全部设定为可见
  16765. while (currNode.parentNode) {
  16766. nodesAndParents.push(currNode.id);
  16767. currNode = currNode.parentNode;
  16768. }
  16769. }
  16770. }, null, [me, view]);
  16771. me.store.filterBy(function (r) {
  16772. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16773. });
  16774. _$2.forEach(expandPaths, function (path) {
  16775. me.expandPath(path);
  16776. });
  16777. }, 1000),
  16778. });
  16779. }
  16780. function convertDataSource(sender, scope, newConfig) {
  16781. if (typeof newConfig.store !== 'undefined') {
  16782. // 有 store 属性的情况下,不做任何事
  16783. return;
  16784. }
  16785. if (typeof newConfig.dataSource === 'undefined') {
  16786. // 没有定义 dataSource 的情况下,不做任何事
  16787. return;
  16788. }
  16789. var dataSource = newConfig.dataSource;
  16790. if (typeof dataSource === 'string') {
  16791. // dataSource 是字符串的情况下,找到成员函数
  16792. dataSource = lookupFn(scope, dataSource);
  16793. }
  16794. if (typeof dataSource === 'function') {
  16795. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16796. newConfig.store = new Ext.data.TreeStore({
  16797. root: {
  16798. expanded: true,
  16799. children: []
  16800. }
  16801. });
  16802. newConfig.dataSourceCallbackFn = dataSource;
  16803. return;
  16804. }
  16805. // throw new TypeError('无法识别的调用方法')
  16806. }
  16807. //# sourceMappingURL=yvtree.js.map
  16808. /**
  16809. * 构建一个 grid 支持的 dataSource
  16810. */
  16811. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16812. if (reloadParams === void 0) { reloadParams = {}; }
  16813. if (isExcelExport === void 0) { isExcelExport = false; }
  16814. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16815. var _a;
  16816. var me = grid;
  16817. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16818. var storeOption = {};
  16819. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16820. if (dataSource.sqlId) {
  16821. dataSource.method = 'invoke';
  16822. dataSource.url = '/Dev@executeSQL';
  16823. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16824. // sqlId 是 @ 开头,代表直接带中文名
  16825. var scope_1 = lookupScope(grid);
  16826. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16827. params.sqlId = dataSource.sqlId.substring(1);
  16828. }
  16829. else {
  16830. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16831. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16832. params.path = path;
  16833. params.sqlId = sqlId;
  16834. }
  16835. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16836. }
  16837. var fields_1 = [];
  16838. _$2.forEach(grid.columns, function (col) {
  16839. var c = {};
  16840. if (col.dataIndex) {
  16841. c.name = col.dataIndex;
  16842. fields_1.push(c);
  16843. }
  16844. if (col.dataType) {
  16845. c.type = col.dataType;
  16846. }
  16847. });
  16848. // 默认支持 gridInvoke
  16849. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16850. //@ts-ignore
  16851. storeOption = {
  16852. fields: fields_1,
  16853. remoteSort: config.remoteSort,
  16854. remoteFilter: config.remoteFilter,
  16855. autoLoad: true,
  16856. pageSize: me.store.pageSize || config.pageSize,
  16857. proxy: {
  16858. type: 'jsonAjax',
  16859. $owner: me,
  16860. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16861. extraParams: extraParams,
  16862. reader: {
  16863. type: 'json',
  16864. rootProperty: 'data',
  16865. totalProperty: 'pagination.total',
  16866. successProperty: 'success',
  16867. messageProperty: 'msg',
  16868. transform: function (data) {
  16869. if (typeof window['ajaxProcess'] === 'function') {
  16870. window['ajaxProcess'](data);
  16871. }
  16872. if (typeof grid._transform === 'function') {
  16873. // 系统转换函数
  16874. grid._transform(data.data);
  16875. }
  16876. if (grid.dataTransform) {
  16877. if (typeof grid.dataTransform === 'string') {
  16878. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  16879. }
  16880. return grid.dataTransform.call(scope, grid, data);
  16881. }
  16882. return data;
  16883. }
  16884. }
  16885. },
  16886. listeners: {
  16887. load: function (store, records, successful, operation) {
  16888. var _a, _b, _c;
  16889. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  16890. if (rep.pagination) {
  16891. grid.dbInfo = rep.pagination.dbInfo;
  16892. grid.exportDataSql = rep.pagination.exportDataSql;
  16893. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  16894. }
  16895. 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;
  16896. if (isExcelExport) {
  16897. if (typeof excelExportCallBack === 'function') {
  16898. excelExportCallBack(rep);
  16899. }
  16900. else if (excelExportCallBack) {
  16901. console.error("导出回调方法错误!");
  16902. }
  16903. me.fireEvent('excelDataLoadComplete', me, successful, records);
  16904. }
  16905. else {
  16906. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  16907. // 自动选中第一行
  16908. var data = grid.getStore().data;
  16909. if (data.length > 0) {
  16910. grid.setSelection(data.items[0]);
  16911. }
  16912. }
  16913. me.fireEvent('dataLoadComplete', me, successful, records);
  16914. }
  16915. }
  16916. }
  16917. };
  16918. }
  16919. else if (exports.apiConvert) {
  16920. // 外部扩展的 apiConvert
  16921. //@ts-ignore
  16922. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams);
  16923. }
  16924. else {
  16925. throw new TypeError("不支持的 API 请求方式");
  16926. }
  16927. if (isExcelExport) {
  16928. var excelStore = new Ext.data.Store(storeOption);
  16929. excelStore.load();
  16930. }
  16931. else {
  16932. if (me.groupField) {
  16933. console.log('groupField', storeOption.groupField);
  16934. storeOption.groupField = me.groupField;
  16935. }
  16936. me.setStore(new Ext.data.Store(storeOption));
  16937. }
  16938. }
  16939. function initStores () {
  16940. Ext.define('Yvan.JsonAjaxProxy', {
  16941. extend: 'Ext.data.proxy.Ajax',
  16942. alias: 'proxy.jsonAjax',
  16943. actionMethods: {
  16944. create: "POST",
  16945. read: "POST",
  16946. update: "POST",
  16947. destroy: "POST"
  16948. },
  16949. timeout: storeAjax.timeout,
  16950. buildRequest: function (operation) {
  16951. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  16952. var me = this;
  16953. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  16954. var scope = lookupScope($owner);
  16955. var gridParam = me.getParams(operation);
  16956. var customParam = {};
  16957. // 提取 srot 元素
  16958. if (gridParam.sort) {
  16959. var sort = JSON.parse(gridParam.sort);
  16960. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  16961. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  16962. customParam.sortModel = [];
  16963. _$2.forEach(sort, function (s) {
  16964. customParam.sortModel.push({
  16965. colId: s.property,
  16966. sort: _$2.toLower(s.direction)
  16967. });
  16968. });
  16969. delete gridParam.sort;
  16970. }
  16971. // 提取筛选元素
  16972. if (gridParam.filter) {
  16973. var filter = JSON.parse(gridParam.filter);
  16974. console.log('gridParam.filter', gridParam.filter);
  16975. // "[{"operator":"like","value":"1","property":"id"}]"
  16976. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  16977. customParam.filterModel = {};
  16978. _$2.forEach(filter, function (s) {
  16979. var newFilterItem = {};
  16980. if (s.operator === 'like') {
  16981. newFilterItem.filterType = 'text';
  16982. newFilterItem.type = 'contains';
  16983. newFilterItem.filter = s.value;
  16984. }
  16985. else {
  16986. // 无法识别的筛选类型
  16987. newFilterItem.filterType = 'dict';
  16988. newFilterItem.type = 'in';
  16989. newFilterItem.filter = s.value;
  16990. }
  16991. customParam.filterModel[s.property] = newFilterItem;
  16992. });
  16993. delete gridParam.filter;
  16994. }
  16995. // 被 grid.constructor 作为方法存在
  16996. var extraParams = _$2.cloneDeep(me.getExtraParams());
  16997. var params = _$2.defaultsDeep(gridParam, extraParams);
  16998. // var request = this.superclass.buildRequest.apply(this, arguments);
  16999. var request = new Ext.data.Request({
  17000. params: {},
  17001. action: operation.getAction(),
  17002. records: operation.getRecords(),
  17003. url: me.buildUrl(),
  17004. jsonData: __assign({ args: [
  17005. params
  17006. ] }, customParam),
  17007. proxy: me
  17008. });
  17009. operation.setRequest(request);
  17010. return request;
  17011. },
  17012. afterRequest: function (req, res) {
  17013. // Extend.afterExtRequest(req, res)
  17014. }
  17015. });
  17016. Ext.define('Ext.ux.data.MyReader', {
  17017. extend: 'Ext.data.reader.Json',
  17018. xtype: 'yvgridreader',
  17019. useSimpleAccessors: false,
  17020. });
  17021. }
  17022. //# sourceMappingURL=stores.js.map
  17023. function initBehaviorEdit(config) {
  17024. var _a, _b, _c;
  17025. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17026. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17027. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17028. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17029. if (dbTableName) {
  17030. // 生成增删查改
  17031. var tbar = [
  17032. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17033. click: 'system.saveGridRow()'
  17034. }, bind: {
  17035. disabled: '{!' + config.reference + '.ischanged}'
  17036. } }, saveButtonConfig),
  17037. '-',
  17038. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17039. click: 'system.insertGridRow()'
  17040. } }, addButtonConfig),
  17041. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17042. click: 'system.removeGridRow()'
  17043. } }, deleteButtonConfig),
  17044. ];
  17045. if (_$2.isArray(config.tbar)) {
  17046. config.tbar = __spread(tbar, [
  17047. '-'
  17048. ], config.tbar);
  17049. }
  17050. else if (_$2.isPlainObject(config.tbar)) {
  17051. config.tbar = {
  17052. border: false,
  17053. layout: {
  17054. type: 'vbox',
  17055. align: 'stretch'
  17056. },
  17057. items: [
  17058. {
  17059. xtype: 'toolbar',
  17060. border: false,
  17061. items: tbar
  17062. },
  17063. config.tbar,
  17064. ]
  17065. };
  17066. }
  17067. else if (_$2.isUndefined(config.tbar)) {
  17068. config.tbar = tbar;
  17069. }
  17070. else {
  17071. console.error("can't build tbar property!", config.tbar);
  17072. }
  17073. }
  17074. }
  17075. //# sourceMappingURL=grid_behavior.js.map
  17076. function initGridDialog(config) {
  17077. var detailDialog = _$2.get(config, 'detailDialog');
  17078. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17079. if (_$2.isPlainObject(detailDialog)) {
  17080. var tbar = [
  17081. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17082. click: 'system.showGridRowDetail()',
  17083. }, bind: {
  17084. disabled: '{!' + config.reference + '.selection}'
  17085. } }, detailButtonConfig)
  17086. ];
  17087. if (_$2.isArray(config.tbar)) {
  17088. config.tbar = __spread(config.tbar, [
  17089. '-'
  17090. ], tbar);
  17091. }
  17092. else if (_$2.isPlainObject(config.tbar)) {
  17093. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17094. config.tbar.items = __spread(config.tbar.items);
  17095. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17096. if (!toolbar) {
  17097. config.tbar.items = __spread(config.tbar.items, [
  17098. {
  17099. xtype: 'toolbar',
  17100. border: false,
  17101. items: tbar
  17102. },
  17103. ]);
  17104. }
  17105. else {
  17106. toolbar.items = __spread(toolbar.items, [
  17107. '-'
  17108. ], tbar);
  17109. }
  17110. }
  17111. else {
  17112. config.tbar = {
  17113. border: false,
  17114. layout: {
  17115. type: 'vbox',
  17116. align: 'stretch'
  17117. },
  17118. items: [
  17119. {
  17120. xtype: 'toolbar',
  17121. border: false,
  17122. items: tbar
  17123. },
  17124. config.tbar,
  17125. ]
  17126. };
  17127. }
  17128. }
  17129. else if (_$2.isUndefined(config.tbar)) {
  17130. config.tbar = tbar;
  17131. }
  17132. else {
  17133. console.error("can't build tbar property!", config.tbar);
  17134. }
  17135. }
  17136. }
  17137. var SystemEventFu$1 = /** @class */ (function () {
  17138. function SystemEventFu() {
  17139. }
  17140. SystemEventFu.prototype.showGridRowDetail = function () {
  17141. return function (sender) {
  17142. var grid1 = sender.up('yvgrid');
  17143. showGridRowDetail(grid1);
  17144. };
  17145. };
  17146. __decorate([
  17147. Lib({
  17148. title: '为某个表格所选数据行, 显示其对话框',
  17149. author: '罗一帆',
  17150. createAt: '2022-07-27',
  17151. updateAt: '2022-07-27',
  17152. type: 'system',
  17153. category: '表格',
  17154. }),
  17155. __metadata("design:type", Function),
  17156. __metadata("design:paramtypes", []),
  17157. __metadata("design:returntype", void 0)
  17158. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17159. return SystemEventFu;
  17160. }());
  17161. function showGridRowDetail(grid1, isEdit) {
  17162. if (isEdit === void 0) { isEdit = true; }
  17163. var _a, _b, _c;
  17164. if (!grid1.selection) {
  17165. msg$1('请选中要展示的数据行!');
  17166. return;
  17167. }
  17168. var record = grid1.selection;
  17169. if (_$2.isArray(record)) {
  17170. record = record[0];
  17171. }
  17172. if (!record) {
  17173. msg$1('请选中要展示的数据行!');
  17174. return;
  17175. }
  17176. var config = grid1._originVJson;
  17177. var detailDialog = config.detailDialog;
  17178. var vjson = {};
  17179. var parentScope = lookupScope(grid1);
  17180. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17181. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17182. _$2.defaultsDeep(vjson, {
  17183. // 强制属性
  17184. layout: 'fit',
  17185. __custom_path: __custom_path,
  17186. __custom_version: __custom_version,
  17187. fbar: __spread([
  17188. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17189. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17190. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17191. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17192. }, detailDialog, {
  17193. // 默认属性
  17194. width: 800,
  17195. height: 450,
  17196. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17197. });
  17198. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17199. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17200. vjson.items.push(tabpanel);
  17201. if (tabpanel) {
  17202. // 有多个选项卡,按每个选项卡进行过滤
  17203. _$2.forEach(tabpanel.items, function (tab) {
  17204. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17205. if (tabColumns.length > 0) {
  17206. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17207. _$2.extend(tab, tabVjson);
  17208. }
  17209. });
  17210. }
  17211. }
  17212. else {
  17213. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17214. }
  17215. var model = {
  17216. data: {
  17217. _edit: isEdit,
  17218. _editType: isEdit ? '编辑' : '添加',
  17219. }
  17220. };
  17221. _$2.forOwn(record.data, function (value, key) {
  17222. if (key === 'id') {
  17223. // 忽略 ID 属性
  17224. return;
  17225. }
  17226. if (_$2.startsWith(key, '_')) {
  17227. // 忽略 _ 开头的所有属性
  17228. return;
  17229. }
  17230. model.data[key] = value;
  17231. });
  17232. console.log(vjson);
  17233. var scope = new Scope({ vjson: vjson, model: model, });
  17234. //@ts-ignore
  17235. scope.commit = function () {
  17236. return new Promise(function (resolve) {
  17237. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17238. if (_$2.startsWith(key, '_')) {
  17239. // _origin 等属性可以被忽略
  17240. return;
  17241. }
  17242. if (key === 'id') {
  17243. // id 属性被忽略
  17244. return;
  17245. }
  17246. record.set(key, value);
  17247. });
  17248. resolve();
  17249. });
  17250. };
  17251. scope.showDialog(grid1, {}, {});
  17252. }
  17253. function buildForm(columns, tabpanel, detailDialog) {
  17254. var vjson = __assign({ border: false, layout: {
  17255. type: 'vbox',
  17256. pack: 'start',
  17257. align: 'stretch'
  17258. }, defaults: {
  17259. border: false,
  17260. anchor: '100%',
  17261. margin: '5',
  17262. }, scrollable: true, items: [] }, detailDialog.form);
  17263. var emptyFieldset = [];
  17264. var fieldsetList = [];
  17265. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17266. _$2.forEach(columns, function (c) {
  17267. var fieldset = _$2.get(c, 'form.fieldset');
  17268. if (fieldset) {
  17269. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17270. if (idx < 0) {
  17271. fieldsetList.push({
  17272. fieldset: fieldset,
  17273. columns: [c]
  17274. });
  17275. }
  17276. else {
  17277. fieldsetList[idx].columns.push(c);
  17278. }
  17279. }
  17280. else {
  17281. emptyFieldset.push(c);
  17282. }
  17283. });
  17284. _$2.forEach(fieldsetList, function (fs) {
  17285. var fieldSetVjson = {
  17286. xtype: 'fieldset',
  17287. title: fs.fieldset,
  17288. items: []
  17289. };
  17290. buildFieldItems(fieldSetVjson.items, fs.columns);
  17291. vjson.items.push(fieldSetVjson);
  17292. });
  17293. buildFieldItems(vjson.items, emptyFieldset);
  17294. return vjson;
  17295. }
  17296. // 构建字段组
  17297. function buildFieldItems(items, columns) {
  17298. var _a, _b, _c, _d, _e;
  17299. var row = {
  17300. xtype: 'cols',
  17301. items: []
  17302. };
  17303. for (var i = 0; i < columns.length; i++) {
  17304. var column = columns[i];
  17305. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17306. delete row.xtype;
  17307. row.layout = column.form.rowlayout;
  17308. }
  17309. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17310. row.items.push({ border: false, flex: column.form.prefix });
  17311. }
  17312. var fieldVjson = buildField(column, row.items.length);
  17313. if (!fieldVjson) {
  17314. continue;
  17315. }
  17316. row.items.push(fieldVjson);
  17317. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17318. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17319. }
  17320. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17321. items.push(row);
  17322. row = {
  17323. xtype: 'cols',
  17324. items: []
  17325. };
  17326. }
  17327. }
  17328. if (row.items.length > 0) {
  17329. items.push(row);
  17330. }
  17331. }
  17332. // 构建字段
  17333. function buildField(column, colIdx) {
  17334. var ret;
  17335. if (column.xtype === 'checkcolumn') {
  17336. ret = _$2.defaultsDeep({
  17337. xtype: 'checkbox',
  17338. uncheckedValue: column.uncheckedValue,
  17339. checkedValue: column.checkedValue,
  17340. boxLabel: column.header,
  17341. bind: {
  17342. value: '{' + column.dataIndex + '}'
  17343. }
  17344. }, column.form);
  17345. if (colIdx == 0) {
  17346. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17347. ret.margin = '0 0 0 85';
  17348. }
  17349. }
  17350. else {
  17351. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17352. fieldLabel: column.header,
  17353. bind: {
  17354. value: '{' + column.dataIndex + '}'
  17355. },
  17356. });
  17357. }
  17358. if (!ret.xtype) {
  17359. return;
  17360. }
  17361. if (!ret.dict && ret.xtype === 'combo') {
  17362. ret.dict = column.dict;
  17363. }
  17364. // 删除辅助属性
  17365. delete ret.order;
  17366. delete ret.wrap;
  17367. return ret;
  17368. }
  17369. //# sourceMappingURL=grid_dialog.js.map
  17370. var model$c = {
  17371. data: {}
  17372. };
  17373. //# sourceMappingURL=GridColumnCustom.model.js.map
  17374. var vjson$c = {
  17375. title: '自定义表格属性',
  17376. layout: 'fit',
  17377. width: 980,
  17378. height: 500,
  17379. fbar: [
  17380. {
  17381. xtype: "button",
  17382. text: "保存",
  17383. iconCls: 'x-fa fa-save',
  17384. listeners: {
  17385. click: 'scope.commit',
  17386. }
  17387. },
  17388. {
  17389. xtype: "button",
  17390. text: "关闭",
  17391. iconCls: 'x-fa fa-times',
  17392. listeners: {
  17393. click: 'system.closeMe()',
  17394. }
  17395. },
  17396. ],
  17397. items: [
  17398. {
  17399. region: 'center',
  17400. xtype: 'tabpanel',
  17401. items: [
  17402. {
  17403. title: '基本信息', reference: 'basic',
  17404. layout: {
  17405. type: 'vbox',
  17406. pack: 'start',
  17407. align: 'stretch'
  17408. },
  17409. defaults: {
  17410. border: false,
  17411. anchor: '100%',
  17412. margin: '5',
  17413. },
  17414. scrollable: true,
  17415. items: [
  17416. {
  17417. xtype: 'cols',
  17418. items: [
  17419. {
  17420. fieldLabel: '路径',
  17421. bind: { value: '{__custom_path}' },
  17422. xtype: 'textfield',
  17423. flex: 2,
  17424. },
  17425. {
  17426. fieldLabel: '版本',
  17427. bind: { value: '{__custom_version}' },
  17428. xtype: 'textfield',
  17429. },
  17430. ]
  17431. },
  17432. {
  17433. xtype: 'cols',
  17434. items: [
  17435. {
  17436. fieldLabel: '配置点',
  17437. bind: { value: '{__custom_point}' },
  17438. xtype: 'textfield',
  17439. },
  17440. {
  17441. fieldLabel: 'reference',
  17442. bind: { value: '{reference}' },
  17443. xtype: 'textfield',
  17444. },
  17445. {
  17446. fieldLabel: '编辑模式',
  17447. bind: { value: '{_mode}' },
  17448. xtype: 'combo',
  17449. dict: 'GRID_MODE',
  17450. },
  17451. ]
  17452. },
  17453. {
  17454. layout: 'hbox',
  17455. defaults: {
  17456. margin: '0 0 0 15',
  17457. },
  17458. items: [
  17459. {
  17460. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17461. bind: {
  17462. value: "{hideFootbar}"
  17463. }
  17464. },
  17465. {
  17466. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17467. bind: {
  17468. value: "{hideRefresh}"
  17469. }
  17470. },
  17471. {
  17472. boxLabel: '隐藏导出', xtype: 'checkbox',
  17473. bind: {
  17474. value: "{hideExport}"
  17475. }
  17476. },
  17477. {
  17478. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17479. bind: {
  17480. value: "{hideAutoSize}"
  17481. }
  17482. },
  17483. {
  17484. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17485. bind: {
  17486. value: "{hideClearFilter}"
  17487. }
  17488. },
  17489. {
  17490. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17491. bind: {
  17492. value: "{hideSaveGridUIConfig}"
  17493. }
  17494. },
  17495. {
  17496. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17497. bind: {
  17498. value: "{hideClearGridUIConfig}"
  17499. }
  17500. },
  17501. ]
  17502. },
  17503. {
  17504. layout: 'hbox',
  17505. defaults: {
  17506. margin: '0 0 0 15',
  17507. },
  17508. items: [
  17509. {
  17510. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17511. bind: { value: '{autoLoad}' },
  17512. margin: '0 0 0 85',
  17513. },
  17514. {
  17515. boxLabel: '分页模式', xtype: 'checkbox',
  17516. bind: { value: '{pagination}' },
  17517. },
  17518. {
  17519. boxLabel: '显示行序号', xtype: 'checkbox',
  17520. bind: { value: '{show_rownum}' },
  17521. },
  17522. {
  17523. boxLabel: '后端排序', xtype: 'checkbox',
  17524. bind: {
  17525. value: "{remoteSort}"
  17526. }
  17527. },
  17528. {
  17529. boxLabel: '后端过滤', xtype: 'checkbox',
  17530. bind: {
  17531. value: "{remoteFilter}"
  17532. }
  17533. },
  17534. {
  17535. boxLabel: '隐藏', xtype: 'checkbox',
  17536. bind: {
  17537. value: "{hidden}"
  17538. }
  17539. },
  17540. ]
  17541. },
  17542. {
  17543. layout: 'hbox',
  17544. defaults: {
  17545. margin: '0 0 0 15',
  17546. },
  17547. items: [
  17548. {
  17549. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17550. bind: {
  17551. value: "{enableColumnHide}"
  17552. }
  17553. },
  17554. {
  17555. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17556. bind: {
  17557. value: "{enableColumnMove}"
  17558. }
  17559. },
  17560. {
  17561. boxLabel: '自定义筛选', xtype: 'checkbox',
  17562. bind: {
  17563. value: "{gridfilters}"
  17564. }
  17565. },
  17566. {
  17567. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17568. bind: {
  17569. value: "{enableColumnResize}"
  17570. }
  17571. },
  17572. {
  17573. boxLabel: '点击列头排序', xtype: 'checkbox',
  17574. bind: {
  17575. value: "{sortOnClick}"
  17576. }
  17577. },
  17578. ]
  17579. },
  17580. {
  17581. xtype: 'cols',
  17582. items: [
  17583. {
  17584. fieldLabel: 'dbTableName',
  17585. labelWidth: 110,
  17586. bind: { value: '{behavior.dbTableName}' },
  17587. xtype: 'textfield',
  17588. },
  17589. {
  17590. fieldLabel: 'theid',
  17591. bind: { value: '{theid}' },
  17592. xtype: 'textfield',
  17593. },
  17594. {
  17595. fieldLabel: '添加行聚焦',
  17596. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17597. xtype: 'textfield',
  17598. },
  17599. ]
  17600. },
  17601. {
  17602. xtype: 'cols',
  17603. items: [
  17604. {
  17605. fieldLabel: '批量删除提示',
  17606. labelWidth: 110,
  17607. bind: { value: '{behavior.batchRemoveConfirm}' },
  17608. xtype: 'textfield',
  17609. },
  17610. {
  17611. fieldLabel: '删除提示',
  17612. bind: { value: '{behavior.singleRemoveConfirm}' },
  17613. xtype: 'textfield',
  17614. },
  17615. {
  17616. fieldLabel: '触发刷新',
  17617. labelWidth: 110,
  17618. bind: { value: '{behavior.selectToReload}' },
  17619. xtype: 'textfield',
  17620. },
  17621. ]
  17622. },
  17623. ]
  17624. },
  17625. {
  17626. title: '字段', reference: 'grid1',
  17627. xtype: 'yvgrid',
  17628. pagination: false,
  17629. _mode: 'edit',
  17630. listeners: {
  17631. buttonclick: 'scope.grid1Buttonclick',
  17632. },
  17633. hideFootbar: true,
  17634. tbar: [
  17635. {
  17636. xtype: 'button',
  17637. text: '添加',
  17638. iconCls: 'x-fa fa-plus-circle',
  17639. listeners: {
  17640. click: 'scope.addField'
  17641. }
  17642. },
  17643. {
  17644. xtype: 'button',
  17645. text: '删除',
  17646. iconCls: 'x-fa fa-minus-circle',
  17647. listeners: {
  17648. click: 'scope.removeField'
  17649. }
  17650. },
  17651. '-',
  17652. {
  17653. xtype: 'button',
  17654. text: '自动分析',
  17655. iconCls: 'x-fa fa-code-fork',
  17656. listeners: {
  17657. click: 'scope.calcField'
  17658. }
  17659. },
  17660. {
  17661. xtype: 'button',
  17662. text: '上移',
  17663. iconCls: 'x-fa fa-arrow-up',
  17664. listeners: {
  17665. click: 'scope.moveUp'
  17666. }
  17667. },
  17668. {
  17669. xtype: 'button',
  17670. text: '下移',
  17671. iconCls: 'x-fa fa-arrow-down',
  17672. listeners: {
  17673. click: 'scope.moveDown'
  17674. }
  17675. },
  17676. ],
  17677. store: {},
  17678. columns: [
  17679. {
  17680. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17681. editor: { xtype: 'textfield' }
  17682. },
  17683. {
  17684. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17685. editor: { xtype: 'textfield' }
  17686. },
  17687. {
  17688. dataIndex: 'header', header: '中文', width: 140,
  17689. editor: { xtype: 'textfield' }
  17690. },
  17691. {
  17692. dataIndex: 'dict', header: '字典', width: 110,
  17693. editor: { xtype: 'combogrid' }
  17694. },
  17695. {
  17696. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17697. editor: { xtype: 'combogrid' }, hidden: true,
  17698. },
  17699. {
  17700. dataIndex: 'width', header: '宽度', width: 80,
  17701. editor: { xtype: 'numberfield' }, hidden: true,
  17702. },
  17703. {
  17704. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17705. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17706. },
  17707. {
  17708. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17709. editor: { xtype: 'textfield' },
  17710. },
  17711. {
  17712. dataIndex: 'createValue', text: '客户端新创建值',
  17713. editor: { xtype: 'textfield' },
  17714. },
  17715. {
  17716. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17717. resizable: false, sortable: false, menuDisabled: true,
  17718. checkedValue: true, uncheckedValue: false,
  17719. },
  17720. {
  17721. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17722. resizable: false, sortable: false, menuDisabled: true,
  17723. checkedValue: true, uncheckedValue: false,
  17724. },
  17725. {
  17726. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17727. resizable: false, sortable: false, menuDisabled: true,
  17728. checkedValue: true, uncheckedValue: false,
  17729. },
  17730. {
  17731. dataIndex: 'formatter', header: '格式化', width: 110,
  17732. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17733. },
  17734. {
  17735. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17736. resizable: false, sortable: false, menuDisabled: true,
  17737. checkedValue: true, uncheckedValue: false, hidden: true,
  17738. },
  17739. {
  17740. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17741. resizable: false, sortable: false, menuDisabled: true,
  17742. hidden: true,
  17743. },
  17744. {
  17745. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17746. resizable: false, sortable: false, menuDisabled: true,
  17747. checkedValue: true, uncheckedValue: false, hidden: true,
  17748. },
  17749. {
  17750. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17751. resizable: false, sortable: false, menuDisabled: true,
  17752. },
  17753. {
  17754. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17755. resizable: false, sortable: false, menuDisabled: true,
  17756. checkedValue: true, uncheckedValue: false, hidden: true,
  17757. },
  17758. {
  17759. dataIndex: 'form_order', text: '对话框序号',
  17760. editor: { xtype: 'numberfield' },
  17761. },
  17762. {
  17763. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17764. resizable: false, sortable: false, menuDisabled: true,
  17765. checkedValue: true, uncheckedValue: false,
  17766. },
  17767. {
  17768. dataIndex: 'form_xtype', text: '对话框编辑器',
  17769. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17770. },
  17771. {
  17772. dataIndex: 'form_fieldset', text: '对话框字段组',
  17773. editor: { xtype: 'textfield' }, hidden: true,
  17774. },
  17775. {
  17776. dataIndex: 'form_tab', text: '对话框选项卡',
  17777. editor: { xtype: 'textfield' }, hidden: true,
  17778. },
  17779. {
  17780. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17781. resizable: false, sortable: false, menuDisabled: true,
  17782. checkedValue: true, uncheckedValue: false, hidden: true,
  17783. },
  17784. ],
  17785. },
  17786. {
  17787. title: 'SQL和查询条件', reference: 'sql',
  17788. layout: 'border',
  17789. border: false,
  17790. items: [
  17791. {
  17792. region: 'north',
  17793. height: 200,
  17794. border: false,
  17795. split: true,
  17796. xtype: 'yvgrid',
  17797. reference: 'gridCondition',
  17798. pagination: false,
  17799. hideFootbar: true,
  17800. _mode: 'edit',
  17801. listeners: {
  17802. buttonclick: 'scope.conditionButtonclick',
  17803. },
  17804. store: {},
  17805. tbar: {
  17806. xtype: 'toolbar',
  17807. border: false,
  17808. items: [
  17809. {
  17810. xtype: 'button',
  17811. text: '添加条件',
  17812. iconCls: 'x-fa fa-plus-circle',
  17813. listeners: {
  17814. click: 'scope.addCondition'
  17815. }
  17816. },
  17817. {
  17818. xtype: 'button',
  17819. text: '删除条件',
  17820. iconCls: 'x-fa fa-minus-circle',
  17821. listeners: {
  17822. click: 'scope.removeCondition'
  17823. }
  17824. },
  17825. '-',
  17826. {
  17827. xtype: 'button',
  17828. text: '自动分析条件变量',
  17829. iconCls: 'x-fa fa-code-fork',
  17830. listeners: {
  17831. click: 'scope.calcCondition'
  17832. }
  17833. },
  17834. {
  17835. xtype: 'button',
  17836. text: '上移',
  17837. iconCls: 'x-fa fa-arrow-up',
  17838. listeners: {
  17839. click: 'scope.moveUpCondition'
  17840. }
  17841. },
  17842. {
  17843. xtype: 'button',
  17844. text: '下移',
  17845. iconCls: 'x-fa fa-arrow-down',
  17846. listeners: {
  17847. click: 'scope.moveDownCondition'
  17848. }
  17849. },
  17850. ]
  17851. },
  17852. columns: [
  17853. {
  17854. text: '条件变量',
  17855. dataIndex: 'param_name',
  17856. width: 140,
  17857. sortable: false,
  17858. menuDisabled: true,
  17859. editor: {
  17860. selectOnFocus: true
  17861. },
  17862. },
  17863. {
  17864. text: '中文标题',
  17865. dataIndex: 'fieldLabel',
  17866. width: 120,
  17867. sortable: false,
  17868. menuDisabled: true,
  17869. editor: {
  17870. selectOnFocus: true
  17871. },
  17872. },
  17873. {
  17874. text: '编辑类型',
  17875. dataIndex: 'xtype',
  17876. width: 80,
  17877. sortable: false,
  17878. menuDisabled: true,
  17879. editor: {
  17880. xtype: 'combo',
  17881. typeAhead: true,
  17882. triggerAction: 'all',
  17883. selectOnFocus: true,
  17884. store: [
  17885. ['textfield', 'textfield'],
  17886. ['combo', 'combo'],
  17887. ['datefield', 'datefield'],
  17888. ['datetimefield', 'datetimefield'],
  17889. ['numberfield', 'numberfield'],
  17890. ['multiplesearch', 'multiplesearch'],
  17891. ]
  17892. }
  17893. },
  17894. {
  17895. text: '权重',
  17896. dataIndex: 'conditionFieldFlex',
  17897. align: 'right',
  17898. width: 60,
  17899. sortable: false,
  17900. menuDisabled: true,
  17901. editor: {
  17902. xtype: 'numberfield',
  17903. selectOnFocus: false,
  17904. minValue: 0,
  17905. maxValue: 10
  17906. },
  17907. },
  17908. {
  17909. text: '字典',
  17910. dataIndex: 'conditionFieldDict',
  17911. width: 160,
  17912. sortable: false,
  17913. menuDisabled: true,
  17914. editor: {
  17915. selectOnFocus: false
  17916. },
  17917. },
  17918. {
  17919. xtype: 'checkcolumn',
  17920. dataIndex: "conditionFieldWrap", header: "换行",
  17921. width: 65,
  17922. sortable: false,
  17923. menuDisabled: true,
  17924. },
  17925. {
  17926. text: '扩展参数',
  17927. dataIndex: 'conditionFieldExtend',
  17928. sortable: false,
  17929. menuDisabled: true,
  17930. editor: {
  17931. selectOnFocus: false
  17932. },
  17933. },
  17934. ]
  17935. },
  17936. {
  17937. region: 'center',
  17938. xtype: 'sqleditor',
  17939. layout: 'fit',
  17940. reference: 'sqlEditor',
  17941. split: true,
  17942. },
  17943. ]
  17944. },
  17945. {
  17946. title: '详情对话框',
  17947. layout: {
  17948. type: 'vbox',
  17949. pack: 'start',
  17950. align: 'stretch'
  17951. },
  17952. defaults: {
  17953. border: false,
  17954. anchor: '100%',
  17955. margin: '5',
  17956. },
  17957. scrollable: true,
  17958. items: [
  17959. {
  17960. xtype: 'cols',
  17961. items: [
  17962. {
  17963. fieldLabel: '对话框标题',
  17964. bind: { value: '{detailDialog.title}' },
  17965. xtype: 'textfield',
  17966. flex: 2,
  17967. },
  17968. {
  17969. fieldLabel: '宽度',
  17970. bind: { value: '{detailDialog.width}' },
  17971. xtype: 'numberfield',
  17972. },
  17973. {
  17974. fieldLabel: '高度',
  17975. bind: { value: '{detailDialog.height}' },
  17976. xtype: 'numberfield',
  17977. },
  17978. ]
  17979. },
  17980. ]
  17981. },
  17982. {
  17983. title: '界面源码',
  17984. xtype: 'jseditor',
  17985. reference: 'jseditor'
  17986. }
  17987. ]
  17988. }
  17989. ]
  17990. };
  17991. //# sourceMappingURL=GridColumnCustom.view.js.map
  17992. var GridColumnCustom = /** @class */ (function (_super) {
  17993. __extends(GridColumnCustom, _super);
  17994. function GridColumnCustom() {
  17995. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  17996. }
  17997. GridColumnCustom.prototype.commit = function () {
  17998. };
  17999. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18000. };
  18001. GridColumnCustom.prototype.conditionButtonclick = function () {
  18002. };
  18003. GridColumnCustom.prototype.addField = function () {
  18004. };
  18005. GridColumnCustom.prototype.removeField = function () {
  18006. };
  18007. GridColumnCustom.prototype.calcField = function () {
  18008. };
  18009. GridColumnCustom.prototype.moveUp = function () {
  18010. };
  18011. GridColumnCustom.prototype.moveDown = function () {
  18012. };
  18013. GridColumnCustom.prototype.addCondition = function () {
  18014. };
  18015. GridColumnCustom.prototype.removeCondition = function () {
  18016. };
  18017. GridColumnCustom.prototype.calcCondition = function () {
  18018. };
  18019. GridColumnCustom.prototype.moveUpCondition = function () {
  18020. };
  18021. GridColumnCustom.prototype.moveDownCondition = function () {
  18022. };
  18023. return GridColumnCustom;
  18024. }(Scope));
  18025. //# sourceMappingURL=GridColumnCustom.js.map
  18026. function initGridCode(grid, newConfig, buttons) {
  18027. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18028. buttons.push({
  18029. xtype: 'button',
  18030. tooltip: '定义表格属性',
  18031. iconCls: 'x-fa fa-codepen',
  18032. handler: function (btn) {
  18033. var customWindow = new GridColumnCustom();
  18034. customWindow.showDialog(btn, {}, {});
  18035. }
  18036. });
  18037. buttons.push({
  18038. xtype: 'button',
  18039. tooltip: '定义表格数据源',
  18040. iconCls: 'x-fa fa-database',
  18041. handler: function () {
  18042. // showCustomGridDataSource(grid)
  18043. }
  18044. });
  18045. }
  18046. }
  18047. //# sourceMappingURL=grid_code.js.map
  18048. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18049. var hexToString = function (hex) {
  18050. var arr = hex.split("");
  18051. var out = "";
  18052. for (var i = 0; i < arr.length / 2; i++) {
  18053. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18054. // @ts-ignore
  18055. var charValue = String.fromCharCode(tmp);
  18056. out += charValue;
  18057. }
  18058. return out;
  18059. };
  18060. var defaultGrid = grid;
  18061. function initGrid () {
  18062. Ext.define('Yvan.Grid', {
  18063. extend: 'Ext.grid.Panel',
  18064. xtype: 'yvgrid',
  18065. __suspendReload: false,
  18066. _originVJson: {},
  18067. constructor: function (config) {
  18068. var _this = this;
  18069. var _a, _b, _c, _d, _e, _f;
  18070. var me = this;
  18071. var dataSource = config.dataSource;
  18072. 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);
  18073. me._originVJson = config;
  18074. if (!isDesignMode(scope, config)) {
  18075. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18076. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18077. var cacheData = this.getColumnConfigCache();
  18078. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18079. var newColumns = [];
  18080. for (var j = 0; j < cacheData.length; j++) {
  18081. var itData = cacheData[j];
  18082. for (var i = 0; i < config.columns.length; i++) {
  18083. var column = config.columns[i];
  18084. if (itData.dataIndex === column.dataIndex) {
  18085. if (itData.width) {
  18086. column.width = itData.width;
  18087. }
  18088. column.hidden = itData.hidden;
  18089. column.locked = itData.locked;
  18090. newColumns.push(column);
  18091. break;
  18092. }
  18093. }
  18094. }
  18095. config.columns = newColumns;
  18096. }
  18097. }
  18098. }
  18099. var newConfig = _$2.defaultsDeep({
  18100. // 强制性属性 bug.
  18101. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18102. // enableLocking: false,
  18103. // syncRowHeight: false,
  18104. }, baseConfig(config, 'row-item'), config, grid);
  18105. // 在面板上的组件
  18106. // const scope = newConfig.$initParent?.yvanScope ||
  18107. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18108. // config.$vmParent?.yvanScope ||
  18109. // newConfig.$vmParent?._parent?.yvanScope;
  18110. var buttons = [];
  18111. var getRowClass = newConfig.getRowClass;
  18112. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18113. _$2.startsWith(getRowClass, "system."))) {
  18114. var fn = lookupFn(scope, getRowClass);
  18115. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18116. }
  18117. if (!newConfig.hideExport) {
  18118. buttons.push({
  18119. xtype: 'button',
  18120. tooltip: '导出Excel',
  18121. iconCls: 'x-fa fa-download',
  18122. listeners: {
  18123. click: this.exportExcel
  18124. },
  18125. });
  18126. }
  18127. if (!newConfig.hideAutoSize) {
  18128. buttons.push({
  18129. xtype: 'button',
  18130. iconCls: 'x-fa fa-text-width',
  18131. tooltip: '自适应宽度',
  18132. listeners: {
  18133. click: this.autoSizeColumns
  18134. }
  18135. });
  18136. }
  18137. if (!newConfig.hideClearFilter) {
  18138. buttons.push({
  18139. xtype: 'button',
  18140. tooltip: '清空筛选',
  18141. iconCls: 'x-fa fa-filter',
  18142. handler: this.clearFilter
  18143. });
  18144. }
  18145. if (!newConfig.hideSaveGridUIConfig) {
  18146. buttons.push({
  18147. xtype: 'button',
  18148. tooltip: '保存布局',
  18149. iconCls: 'x-fa fa-cogs',
  18150. handler: this.saveGridUIConfig
  18151. });
  18152. }
  18153. if (!newConfig.hideClearGridUIConfig) {
  18154. buttons.push({
  18155. xtype: 'button',
  18156. tooltip: '还原布局',
  18157. iconCls: 'x-fa fa-reply-all',
  18158. handler: this.clearGridUIConfig
  18159. });
  18160. }
  18161. initGridCode(me, newConfig, buttons);
  18162. if (!newConfig.hideFootbar) {
  18163. if (newConfig.pagination) {
  18164. newConfig.bbar = new Ext.PagingToolbar({
  18165. // pageSize: newConfig.pageSize, 这个值是无效的
  18166. displayInfo: true,
  18167. store: this.store,
  18168. emptyMsg: '没有记录',
  18169. cls: 'grid-bbar',
  18170. items: __spread([
  18171. {
  18172. xtype: 'combobox',
  18173. tooltip: '分页',
  18174. queryMode: 'local',
  18175. editable: false,
  18176. allowBlank: true,
  18177. labelAlign: 'right',
  18178. width: 90,
  18179. // labelWidth: 30,
  18180. listConfig: {
  18181. minWidth: null
  18182. },
  18183. value: 50,
  18184. valueField: undefined,
  18185. displayField: undefined,
  18186. hideClear: true,
  18187. store: newConfig.pageSizeOption,
  18188. listeners: {
  18189. change: function (sender, nv, ov) {
  18190. _this.store.pageSize = nv;
  18191. _this.store.loadPage(1);
  18192. }
  18193. }
  18194. }
  18195. ], buttons),
  18196. doRefresh: function () {
  18197. me.reload();
  18198. }
  18199. });
  18200. }
  18201. else {
  18202. newConfig.bbar = {
  18203. xtype: 'toolbar', overflowHandler: 'menu',
  18204. cls: 'grid-bbar',
  18205. items: __spread([
  18206. {
  18207. xtype: 'button',
  18208. tooltip: '刷新',
  18209. iconCls: 'x-fa fa-refresh',
  18210. handler: function () {
  18211. _this.reload();
  18212. }
  18213. },
  18214. '-'
  18215. ], buttons)
  18216. };
  18217. if (newConfig.hideRefresh) {
  18218. newConfig.bbar.items.splice(0, 1);
  18219. }
  18220. }
  18221. }
  18222. if (_$2.isArray(newConfig.condition)) {
  18223. // 带查询条件
  18224. var conditionRows_1 = [];
  18225. var newRow_1 = false;
  18226. var currentRow_1 = { xtype: 'cols', items: [], };
  18227. conditionRows_1.push(currentRow_1);
  18228. _$2.forEach(newConfig.condition, function (item) {
  18229. var _a;
  18230. if (newRow_1) {
  18231. currentRow_1 = { xtype: 'cols', items: [], };
  18232. conditionRows_1.push(currentRow_1);
  18233. }
  18234. var vj = _$2.cloneDeep(item);
  18235. if (vj.xtype) {
  18236. if (item.xtype === 'combo' && item.dict) {
  18237. vj.fix = ['system.getDict("' + item.dict + '")'];
  18238. }
  18239. if (item.xtype === 'datetimefield') {
  18240. _$2.defer(function () {
  18241. //@ts-ignore
  18242. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18243. });
  18244. }
  18245. else if (item.xtype === 'datefield') {
  18246. _$2.defer(function () {
  18247. //@ts-ignore
  18248. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18249. });
  18250. }
  18251. else {
  18252. scope.viewModel.set(item.param_name, '');
  18253. }
  18254. }
  18255. else {
  18256. // 没有组件类型,是个空占位符
  18257. vj.border = false;
  18258. }
  18259. if (item.param_name) {
  18260. vj.bind = {
  18261. value: '{' + item.param_name + '}'
  18262. };
  18263. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18264. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18265. }
  18266. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18267. currentRow_1.items.push(vj);
  18268. });
  18269. newConfig.tbar = {
  18270. xtype: 'form',
  18271. border: false,
  18272. items: conditionRows_1,
  18273. defaults: {
  18274. margin: '8 0 8 0'
  18275. },
  18276. };
  18277. console.log('newConfig', newConfig);
  18278. }
  18279. _$2.each(newConfig.columns, function (c) {
  18280. var renderer = c.renderer, formatter = c.formatter;
  18281. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18282. _$2.startsWith(renderer, "system."))) {
  18283. if (newConfig.$initParent) {
  18284. if (scope) {
  18285. var rendererFn = lookupFn(scope, renderer);
  18286. c.renderer = rendererFn.bind(scope);
  18287. }
  18288. }
  18289. }
  18290. if (c.dict) {
  18291. c.fix = ['system.getDict("' + c.dict + '")'];
  18292. if (c.editor && c.editor.xtype === 'combo') {
  18293. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18294. c.editor.typeAhead = true;
  18295. c.editor.triggerAction = 'all';
  18296. c.editor.selectOnFocus = false;
  18297. c.editor.listConfig = {
  18298. minWidth: 200
  18299. };
  18300. }
  18301. }
  18302. if (formatter === 'button') {
  18303. c.tdCls = 'td-btn';
  18304. if (!c.listeners) {
  18305. c.listeners = {};
  18306. }
  18307. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18308. if ($(event.target).is('input')) {
  18309. me.fireEvent('buttonclick', me, this, record);
  18310. }
  18311. };
  18312. }
  18313. else if (formatter === 'percentRenderer') {
  18314. c.tdCls = 'td-percent';
  18315. }
  18316. });
  18317. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18318. // 强制为编辑模式
  18319. newConfig.selModel = {
  18320. type: 'spreadsheet',
  18321. columnSelect: true,
  18322. pruneRemoved: false,
  18323. extensible: 'y'
  18324. };
  18325. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18326. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18327. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18328. }
  18329. else {
  18330. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18331. }
  18332. }
  18333. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18334. // 强制为勾选模式
  18335. newConfig.selModel = {
  18336. type: 'checkboxmodel',
  18337. mode: 'MULTI',
  18338. };
  18339. }
  18340. else if (newConfig._mode === 'checkonly') {
  18341. newConfig.selModel = {
  18342. type: 'checkboxmodel',
  18343. mode: 'MULTI',
  18344. checkOnly: true,
  18345. };
  18346. }
  18347. else if (newConfig._mode === 'select') {
  18348. // 强制为选择模式
  18349. newConfig.selModel = {
  18350. selType: 'rowmodel',
  18351. mode: 'SINGLE',
  18352. };
  18353. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18354. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18355. }
  18356. }
  18357. initBehaviorEdit(newConfig);
  18358. initGridDialog(newConfig);
  18359. this.superclass.constructor.call(this, newConfig);
  18360. this.store.pageSize = newConfig.pageSize;
  18361. },
  18362. setData: function (value) {
  18363. var me = this;
  18364. me._setDataReal(value);
  18365. },
  18366. /**
  18367. * 添加行,并进入编辑状态
  18368. * @param record 新行的属性集
  18369. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18370. */
  18371. appendEditRow: function (record, editRowCol) {
  18372. var records = this.getStore().add(record);
  18373. var recNew = records[0];
  18374. this.setSelection(records);
  18375. if (typeof editRowCol === 'string' && editRowCol) {
  18376. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18377. }
  18378. if (typeof editRowCol === 'number') {
  18379. var ce = this.findPlugin('cellediting');
  18380. this.editingPlugin = ce;
  18381. ce.startEdit(recNew, editRowCol);
  18382. }
  18383. },
  18384. beginEdit: function (record, editRowCol) {
  18385. if (typeof record === 'number') {
  18386. record = this.store.data.getAt(record);
  18387. }
  18388. if (record.isEntity === true) {
  18389. this.setSelection([record]);
  18390. if (typeof editRowCol === 'string' && editRowCol) {
  18391. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18392. }
  18393. if (typeof editRowCol === 'number') {
  18394. var ce = this.findPlugin('cellediting');
  18395. this.editingPlugin = ce;
  18396. ce.startEdit(record, editRowCol);
  18397. }
  18398. }
  18399. },
  18400. /**
  18401. * 移除行
  18402. * @param record 如果记录传空,就是当前选中的行
  18403. */
  18404. removeEditRow: function (record) {
  18405. if (!record) {
  18406. record = this.selection;
  18407. }
  18408. if (!record) {
  18409. msg('请选中要删除的行');
  18410. return;
  18411. }
  18412. this.getStore().remove(record);
  18413. },
  18414. /**
  18415. * 获取全部原始数据
  18416. */
  18417. getDataRows: function () {
  18418. return this.getStore().data.items.map(function (r) { return r.data; });
  18419. },
  18420. /**
  18421. * 获取全部原始数据, 不带 id/ 不带 origin
  18422. */
  18423. getDataRowsOnlyData: function () {
  18424. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18425. delete r.id;
  18426. delete r._origin;
  18427. return r;
  18428. });
  18429. },
  18430. rowMoveUp: function () {
  18431. var grid = this;
  18432. if (!grid.selection) {
  18433. msg('无法对多行进行移动');
  18434. return;
  18435. }
  18436. var record = grid.selection;
  18437. if (_$2.isArray(record)) {
  18438. record = record[0];
  18439. }
  18440. if (!record) {
  18441. msg('无法对多行进行移动');
  18442. return;
  18443. }
  18444. // const records = grid.selModel.getSelection()
  18445. // if (records.length !== 1) {
  18446. // msg('无法对多行进行移动')
  18447. // return
  18448. // }
  18449. //
  18450. // const [record] = records
  18451. var index = grid.store.indexOf(record);
  18452. if (index > 0) {
  18453. grid.store.removeAt(index);
  18454. grid.store.insert(index - 1, record);
  18455. grid.getView().refresh();
  18456. grid.selModel.select([record]);
  18457. }
  18458. },
  18459. rowMoveDown: function () {
  18460. var grid = this;
  18461. // const records = grid.selModel.getSelection()
  18462. // if (records.length !== 1) {
  18463. // msg('无法对多行进行移动')
  18464. // return
  18465. // }
  18466. if (!grid.selection) {
  18467. msg('无法对多行进行移动');
  18468. return;
  18469. }
  18470. var record = grid.selection;
  18471. if (_$2.isArray(record)) {
  18472. record = record[0];
  18473. }
  18474. if (!record) {
  18475. msg('无法对多行进行移动');
  18476. return;
  18477. }
  18478. var index = grid.store.indexOf(record);
  18479. if (index < grid.store.getCount() - 1) {
  18480. grid.store.removeAt(index);
  18481. grid.store.insert(index + 1, record);
  18482. grid.getView().refresh();
  18483. grid.selModel.select([record]);
  18484. }
  18485. },
  18486. getEditRecord: function () {
  18487. var _a, _b;
  18488. var me = this;
  18489. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18490. 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;
  18491. var record;
  18492. if (typeof rowIdx === 'undefined') {
  18493. record = me.getSelectionModel().getLastSelected();
  18494. }
  18495. else {
  18496. record = me.store.getAt(rowIdx);
  18497. }
  18498. return record;
  18499. },
  18500. getEditRow: function () {
  18501. var _a;
  18502. var me = this;
  18503. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18504. },
  18505. setEditRow: function (rowValues) {
  18506. var me = this;
  18507. var record = me.getEditRecord();
  18508. if (record) {
  18509. _$2.forOwn(rowValues, function (v, k) {
  18510. record.set(k, v);
  18511. });
  18512. }
  18513. },
  18514. _transform: function (data) {
  18515. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18516. _$2.forEach(data, function (row) {
  18517. row._origin = _$2.clone(row);
  18518. });
  18519. },
  18520. _setDataReal: function (value) {
  18521. var me = this;
  18522. this._transform(value);
  18523. var storeOpt = {
  18524. fields: getFileds(this),
  18525. data: value,
  18526. };
  18527. if (this.groupField) {
  18528. storeOpt.groupField = this.groupField;
  18529. }
  18530. var store = new Ext.data.Store(storeOpt);
  18531. me.setStore(store);
  18532. },
  18533. setStore: function (store) {
  18534. var me = this;
  18535. if (_$2.isArray(store)) {
  18536. var value = store;
  18537. this._transform(value);
  18538. var storeOpt = {
  18539. fields: getFileds(this),
  18540. data: value,
  18541. };
  18542. if (this.groupField) {
  18543. storeOpt.groupField = this.groupField;
  18544. }
  18545. store = new Ext.data.Store(storeOpt);
  18546. }
  18547. me.superclass.setStore.call(this, store);
  18548. var reference = this.reference;
  18549. if (reference) {
  18550. var scope = lookupScope(this);
  18551. scope.viewModel.set(reference + '.ischanged', false);
  18552. scope.viewModel.set(reference + '.theid', null);
  18553. scope.viewModel.set(reference + '.theid2', null);
  18554. scope.viewModel.set(reference + '.theid3', null);
  18555. }
  18556. if (store) {
  18557. store.on({
  18558. add: function (store, records, index, eOpts) {
  18559. me._raiseChange(store, 'add');
  18560. },
  18561. remove: function (store, records, index, isMove, eOpts) {
  18562. me._raiseChange(store, 'remove');
  18563. },
  18564. datachanged: function (sender, opt) {
  18565. me._raiseChange(store, 'datachanged');
  18566. }
  18567. });
  18568. }
  18569. },
  18570. _raiseChange: function (store, type) {
  18571. var _a, _b;
  18572. var reference = this.reference;
  18573. if (reference && store) {
  18574. var ischanged = false;
  18575. if (store.getModifiedRecords().length > 0 ||
  18576. store.getNewRecords().length > 0 ||
  18577. store.getRemovedRecords().length > 0) {
  18578. ischanged = true;
  18579. }
  18580. else {
  18581. ischanged = false;
  18582. }
  18583. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18584. }
  18585. },
  18586. /**
  18587. * 轻量级刷新
  18588. */
  18589. refreshData: function () {
  18590. var store = this.getStore();
  18591. if (store) {
  18592. store.reload();
  18593. }
  18594. },
  18595. /**
  18596. * 为表格强制设置焦点
  18597. * @param seq 顺序号
  18598. */
  18599. focusRow: function (seq) {
  18600. this.setSelection(this.store.getAt(seq));
  18601. this.getView().focusRow(seq);
  18602. },
  18603. /**
  18604. * 重新载入数据(重新计算参数)
  18605. */
  18606. reload: function (reloadParams) {
  18607. if (reloadParams === void 0) { reloadParams = {}; }
  18608. var me = this;
  18609. var config = me.config;
  18610. if (config.dataSourceCallbackFn) {
  18611. // 函数请求刷新
  18612. var scope_1 = lookupScope(this);
  18613. _$2.defer(function () {
  18614. me.setLoading(true);
  18615. });
  18616. config.dataSourceCallbackFn.call(scope_1, me, {
  18617. successCallback: function (value) {
  18618. me._setDataReal(value);
  18619. _$2.defer(function () {
  18620. me.setLoading(false);
  18621. });
  18622. // 自动选中第一行
  18623. var data = me.getStore().data;
  18624. if (data.length > 0) {
  18625. me.setSelection(data.items[0]);
  18626. }
  18627. me.fireEvent('dataLoadComplete', me, true, value);
  18628. },
  18629. failCallback: function (error) {
  18630. _$2.defer(function () {
  18631. me.setLoading(false);
  18632. });
  18633. me.fireEvent('dataLoadComplete', me, false, error);
  18634. }
  18635. });
  18636. return;
  18637. }
  18638. // if (this.store) {
  18639. // this.store.reload({aaaa: 1, bbbb: 2})
  18640. // }
  18641. var dataSource = config.dataSource;
  18642. var scope = lookupScope(me);
  18643. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18644. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18645. }
  18646. },
  18647. exportCurrentExcelClick: function () {
  18648. var _a;
  18649. var me = this;
  18650. var config = me.config;
  18651. var scope = lookupScope(me);
  18652. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18653. if (excelFileName.endsWith(".xlsx")) {
  18654. excelFileName = excelFileName.split(".xlsx")[0];
  18655. }
  18656. excelFileName += ".xlsx";
  18657. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18658. var excelData = me.makeExcelData(rowsAll);
  18659. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18660. },
  18661. exportExcelClick: function (excelExportParams) {
  18662. var me = this;
  18663. var config = me.config;
  18664. excelExportParams.isExcelExport = true;
  18665. var scope = lookupScope(me);
  18666. var dataSource = config.dataSource;
  18667. scope.setLoading(true);
  18668. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18669. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18670. var _a, _b, _c, _d;
  18671. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || 1;
  18672. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18673. 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;
  18674. me.exportExcelCurrentPage = page;
  18675. me.exportExcelPageSize = size;
  18676. me.exportExcelTotal = total;
  18677. if (excelFileName.endsWith(".xlsx")) {
  18678. excelFileName = excelFileName.split(".xlsx")[0];
  18679. }
  18680. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18681. excelFileName += ".xlsx";
  18682. var excelData = me.makeExcelData(responseData.data);
  18683. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18684. if (page < total / size) {
  18685. page++;
  18686. me.exportExcelCurrentPage = page;
  18687. }
  18688. scope.setLoading(false);
  18689. });
  18690. },
  18691. exportBigExcelClick: function () {
  18692. var _a;
  18693. var me = this;
  18694. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18695. showErrorDialog('当前表格不支持大批量导出');
  18696. return;
  18697. }
  18698. var config = me.config;
  18699. var scope = lookupScope(me);
  18700. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18701. var head = [];
  18702. var dict = {};
  18703. _$2.forEach(me.columns, function (column) {
  18704. if (column.isHidden())
  18705. return;
  18706. if (!column.dataIndex)
  18707. return;
  18708. if (!column.text)
  18709. return;
  18710. head.push({ field: column.dataIndex, name: column.text });
  18711. if (column.dictForExcel) {
  18712. dict[column.dataIndex] = column.dictForExcel;
  18713. }
  18714. });
  18715. // 判断是否需要解密
  18716. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18717. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18718. me.dbInfo.password = hexToString(me.dbInfo.password);
  18719. me.dbInfo.username = hexToString(me.dbInfo.username);
  18720. }
  18721. scope.setLoading(true);
  18722. Ext.Ajax.request({
  18723. timeout: 15000,
  18724. url: window["EXPORT_DATA_HOST"],
  18725. method: "POST",
  18726. jsonData: {
  18727. file: excelFileName,
  18728. dbInfo: me.dbInfo,
  18729. exportDataSql: me.exportDataSql,
  18730. exportDataSqlParams: me.exportDataSqlParams,
  18731. head: head,
  18732. dict: dict,
  18733. },
  18734. }).then(function () {
  18735. scope.setLoading(false);
  18736. msg('请求成功');
  18737. }).catch(function () {
  18738. scope.setLoading(false);
  18739. showErrorDialog('请求失败,请确认是否已安装客户端');
  18740. });
  18741. },
  18742. makeExcelData: function (jsonData) {
  18743. var me = this;
  18744. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18745. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18746. return;
  18747. }
  18748. var data = [];
  18749. // 获取表格的列定义
  18750. var headerTextArr = [];
  18751. var headers = [];
  18752. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18753. var header = me.headerCt.getGridColumns()[i];
  18754. if (!header.isHidden()) {
  18755. var textStr = _$2.trim(header.text);
  18756. var dataIndexStr = _$2.trim(header.dataIndex);
  18757. if (dataIndexStr) {
  18758. if (textStr === '') {
  18759. headerTextArr.push(dataIndexStr);
  18760. }
  18761. else {
  18762. headerTextArr.push(textStr);
  18763. }
  18764. headers.push(header);
  18765. }
  18766. }
  18767. }
  18768. if (headers.length === 0) {
  18769. return;
  18770. }
  18771. data.push(headerTextArr);
  18772. for (var i = 0; i < jsonData.length; i++) {
  18773. var dataRow = jsonData[i];
  18774. var row = [];
  18775. for (var j = 0; j < headers.length; j++) {
  18776. var key = headers[j].dataIndex;
  18777. var value = dataRow[key];
  18778. if (!value && value !== 0) {
  18779. value = '';
  18780. }
  18781. var oValue = value;
  18782. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18783. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18784. try {
  18785. value = headers[j].renderer(value);
  18786. if (!value && value !== 0) {
  18787. value = oValue;
  18788. }
  18789. }
  18790. catch (e) {
  18791. value = oValue;
  18792. }
  18793. }
  18794. row.push(value);
  18795. }
  18796. data.push(row);
  18797. }
  18798. return data;
  18799. },
  18800. initComponent: function () {
  18801. var _this = this;
  18802. var _a;
  18803. var me = this;
  18804. var config = me.config;
  18805. var scope = lookupScope(this);
  18806. if (isDesignMode(scope, config)) {
  18807. this.superclass.initComponent.call(this);
  18808. return;
  18809. }
  18810. // 转换 dataSource 属性
  18811. convertDataSource$1(me, scope, config);
  18812. this.on({
  18813. afterrender: function (sender) {
  18814. var me = this;
  18815. var config = this.config;
  18816. var dataSource = config.dataSource;
  18817. if (config.autoLoad) {
  18818. if (config.dataSourceCallbackFn) {
  18819. me.reload();
  18820. }
  18821. else if (_$2.isPlainObject(dataSource)) {
  18822. me.reload();
  18823. }
  18824. }
  18825. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18826. var vm = this.lookupViewModel();
  18827. this.contextMenu = this.add(new Ext.menu.Menu({
  18828. viewModel: vm,
  18829. items: _$2.map(config.tbar, function (item) {
  18830. var menuItem = __assign({}, item);
  18831. if (menuItem.xtype === 'button') {
  18832. delete menuItem.xtype;
  18833. }
  18834. return menuItem;
  18835. })
  18836. }));
  18837. }
  18838. else if (_$2.isPlainObject(config.contextMenu)) {
  18839. this.contextMenu = this.add(config.contextMenu);
  18840. }
  18841. var $dom = $(sender.el.dom);
  18842. $dom.on('keydown', function (e) {
  18843. me.fireEvent('keydown', me, e);
  18844. }).on('keyup', function (e) {
  18845. me.fireEvent('keyup', me, e);
  18846. });
  18847. // 默认显示提示
  18848. if (this.cellTip) {
  18849. this.tip = Ext.create('Ext.tip.ToolTip', {
  18850. target: this.el,
  18851. delegate: '.x-grid-cell-inner',
  18852. trackMouse: true,
  18853. ancor: 'top',
  18854. style: 'background-color: #0D6EFD;',
  18855. listeners: {
  18856. beforeshow: function (tip) {
  18857. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18858. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18859. return false;
  18860. }
  18861. tip.update(tipText);
  18862. }
  18863. }
  18864. });
  18865. }
  18866. },
  18867. itemcontextmenu: function (view, rec, node, index, e) {
  18868. if (this.contextMenu) {
  18869. e.stopEvent();
  18870. this.contextMenu.show().setLocalXY(e.getXY());
  18871. return false;
  18872. }
  18873. },
  18874. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  18875. // this.setColumnConfigCache()
  18876. // },
  18877. // columnhide(sender, column, eOpts) {
  18878. // this.setColumnConfigCache()
  18879. // },
  18880. // columnshow(sender, column, eOpts) {
  18881. // this.setColumnConfigCache()
  18882. // },
  18883. // columnresize(sender, column, width, eOpts) {
  18884. // this.setColumnConfigCache()
  18885. // },
  18886. destory: function () {
  18887. },
  18888. selectionchange: function (sender, param) {
  18889. var record = undefined;
  18890. if (_$2.isArray(param)) {
  18891. record = param[0];
  18892. }
  18893. else if (_$2.isObject(param)) {
  18894. record = _$2.get(param, 'endCell.record');
  18895. }
  18896. itemselectFun(this, sender, record);
  18897. },
  18898. itemclick: function (sender, record) {
  18899. itemselectFun(this, sender, record);
  18900. },
  18901. show: function (sender) {
  18902. if (sender.__suspendReload) {
  18903. sender.__suspendReload = false;
  18904. sender.reload();
  18905. }
  18906. }
  18907. });
  18908. _$2.defer(function () {
  18909. var ce = _this.findPlugin('cellediting');
  18910. ce.on({
  18911. beforeedit: function (editor, context, eOpts) {
  18912. me.fireEvent('editbefore', me, editor, context, eOpts);
  18913. },
  18914. canceledit: function (editor, context, eOpts) {
  18915. me.fireEvent('editcancel', me, editor, context, eOpts);
  18916. },
  18917. edit: function (editor, context, eOpts) {
  18918. me.fireEvent('editfinish', me, editor, context, eOpts);
  18919. },
  18920. validateedit: function (editor, context, eOpts) {
  18921. me.fireEvent('editvalidate', me, editor, context, eOpts);
  18922. },
  18923. });
  18924. });
  18925. var itemselectFun = _$2.debounce(function (me, sender, record) {
  18926. var reference = me.reference;
  18927. var scope = lookupScope(me);
  18928. var theid = _$2.get(config, 'behavior.theid');
  18929. if (theid && reference) {
  18930. if (!record) {
  18931. scope.viewModel.set(reference + '.theid', null);
  18932. }
  18933. else {
  18934. scope.viewModel.set(reference + '.theid', record.get(theid));
  18935. }
  18936. }
  18937. var theid2 = _$2.get(config, 'behavior.theid2');
  18938. if (theid2 && reference) {
  18939. if (!record) {
  18940. scope.viewModel.set(reference + '.theid2', null);
  18941. }
  18942. else {
  18943. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  18944. }
  18945. }
  18946. var theid3 = _$2.get(config, 'behavior.theid3');
  18947. if (theid3 && reference) {
  18948. if (!record) {
  18949. scope.viewModel.set(reference + '.theid3', null);
  18950. }
  18951. else {
  18952. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  18953. }
  18954. }
  18955. me.fireEvent('itemselect', sender, record);
  18956. }, 50);
  18957. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  18958. // 为 stores.proxy.buildRequest 做准备
  18959. this.store.proxy.$owner = this;
  18960. }
  18961. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  18962. if (selectToReload) {
  18963. // 点击后触发某个目标表格刷新
  18964. this.on({
  18965. itemselect: function (sender) {
  18966. if (_$2.isArray(selectToReload)) {
  18967. _$2.forEach(selectToReload, function (ref) {
  18968. if (ref) {
  18969. var ctlTarget = scope.refs[ref];
  18970. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  18971. if (ctlTarget.isVisible()) {
  18972. ctlTarget.reload();
  18973. }
  18974. else {
  18975. ctlTarget.__suspendReload = true;
  18976. }
  18977. }
  18978. }
  18979. });
  18980. }
  18981. else if (_$2.isString(selectToReload)) {
  18982. var ctlTarget = scope.refs[selectToReload];
  18983. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  18984. ctlTarget.reload();
  18985. }
  18986. }
  18987. }
  18988. });
  18989. }
  18990. this.superclass.initComponent.call(this);
  18991. },
  18992. // 生成列自定义的缓存key
  18993. makeColumnConfigCacheKey: function (config) {
  18994. var _a, _b, _c, _d, _e, _f;
  18995. 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);
  18996. var key = "gridColumnCache-" + scope.scopeKey + "-";
  18997. if (config.reference) {
  18998. key += config.reference;
  18999. }
  19000. else {
  19001. var subKey = "";
  19002. for (var i = 0; i < config.columns.length; i++) {
  19003. var column = config.columns[i];
  19004. if (column.dataIndex) {
  19005. subKey += column.dataIndex;
  19006. }
  19007. }
  19008. key += subKey;
  19009. }
  19010. return key;
  19011. },
  19012. getColumnConfigCache: function () {
  19013. var key = this.columnConfigCacheKey;
  19014. var dataStr = localStorage.getItem(key);
  19015. if (dataStr) {
  19016. return JSON.parse(dataStr);
  19017. }
  19018. return "";
  19019. },
  19020. setColumnConfigCache: function () {
  19021. var key = this.columnConfigCacheKey;
  19022. var cacheData = [];
  19023. var columns = this.headerCt.getGridColumns();
  19024. var index = 0;
  19025. for (var i = 0; i < columns.length; i++) {
  19026. var column = columns[i];
  19027. if (column.dataIndex) {
  19028. cacheData.push({
  19029. dataIndex: column.dataIndex,
  19030. width: column.width,
  19031. hidden: column.hidden,
  19032. locked: column.locked,
  19033. index: index
  19034. });
  19035. index++;
  19036. }
  19037. }
  19038. localStorage.setItem(key, JSON.stringify(cacheData));
  19039. },
  19040. autoSizeColumns: function (sender) {
  19041. var grid = sender ? sender.up('grid') : this;
  19042. // const columns = grid.columns;
  19043. // for (let i = 0; i < columns.length; i++) {
  19044. // const column = columns[i];
  19045. // grid.getView().autoSizeColumn(column);
  19046. // column.setWidth(column.getWidth() + 5);
  19047. // }
  19048. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19049. grid.headerCt.getGridColumns()[i].autoSize(i);
  19050. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19051. }
  19052. },
  19053. clearFilter: function (sender) {
  19054. var grid = sender.up('grid');
  19055. grid.filters.clearFilters();
  19056. grid.getStore().sorters.removeAll();
  19057. // grid.getStore().reload()
  19058. },
  19059. saveGridUIConfig: function (sender) {
  19060. var grid = sender.up('grid');
  19061. grid.setColumnConfigCache();
  19062. msg('保存设置成功!');
  19063. },
  19064. clearGridUIConfig: function (sender) {
  19065. var grid = sender.up('grid');
  19066. var key = grid.columnConfigCacheKey;
  19067. localStorage.setItem(key, "");
  19068. msg('清空设置成功,重新打开后生效!');
  19069. },
  19070. setLoading: function (value) {
  19071. if (value) {
  19072. this.mask('读取中');
  19073. }
  19074. else {
  19075. this.unmask();
  19076. }
  19077. },
  19078. exportExcel: function (sender) {
  19079. var rect = sender.btnEl.dom.getBoundingClientRect();
  19080. var scope = lookupScope(this);
  19081. var grid = sender.up('grid');
  19082. var treeMenu = new Ext.menu.Menu({
  19083. xtype: 'menu',
  19084. floated: false,
  19085. width: 300,
  19086. docked: 'left',
  19087. items: [
  19088. {
  19089. text: '大批量导出 (需要客户端支持!)',
  19090. iconCls: 'x-fa fa-download',
  19091. listeners: {
  19092. click: function (sender, value) {
  19093. // @ts-ignore
  19094. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19095. .then(function (res) {
  19096. grid.exportBigExcelClick();
  19097. });
  19098. }
  19099. }
  19100. },
  19101. '-',
  19102. {
  19103. text: '导出当前数据',
  19104. iconCls: 'x-fa fa-download',
  19105. listeners: {
  19106. click: function (sender, value) {
  19107. grid.exportCurrentExcelClick();
  19108. }
  19109. }
  19110. },
  19111. {
  19112. xtype: "textfield",
  19113. fieldLabel: '当前导出页',
  19114. maskRe: /[0-9]/,
  19115. value: grid.exportExcelCurrentPage,
  19116. listeners: {
  19117. render: function (sender) {
  19118. grid.exportExcelCurrentPageCmp = sender;
  19119. },
  19120. change: function (sender, value) {
  19121. var v = parseInt(value);
  19122. if (isNaN(v) || v === 0) {
  19123. window['system'].msg("页码不能为0");
  19124. v = 1;
  19125. sender.setValue(v);
  19126. }
  19127. var size = parseInt(grid.exportExcelPageSize);
  19128. var total = parseInt(grid.exportExcelTotal);
  19129. if (v > total / size) {
  19130. v = parseInt(total / size + "");
  19131. }
  19132. grid.exportExcelCurrentPage = v + "";
  19133. }
  19134. }
  19135. },
  19136. {
  19137. xtype: "textfield",
  19138. fieldLabel: '导出页大小',
  19139. maskRe: /[0-9]/,
  19140. value: grid.exportExcelPageSize,
  19141. listeners: {
  19142. render: function (sender) {
  19143. grid.exportExcelPageSizeCmp = sender;
  19144. },
  19145. change: function (sender, value) {
  19146. var v = parseInt(value);
  19147. if (isNaN(v) || v === 0) {
  19148. window['system'].msg("导出页大小不能为0");
  19149. v = defaultGrid.exportExcelPageSize;
  19150. sender.setValue(v);
  19151. }
  19152. if (v > 10000) {
  19153. window['system'].msg("导出页大小不能大于10000");
  19154. v = 10000;
  19155. sender.setValue(v);
  19156. }
  19157. var page = parseInt(grid.exportExcelCurrentPage);
  19158. var total = parseInt(grid.exportExcelTotal);
  19159. if (page > total / v) {
  19160. page = parseInt(total / v + "") + 1;
  19161. grid.exportExcelCurrentPageCmp.setValue(page);
  19162. }
  19163. grid.exportExcelPageSize = v + "";
  19164. }
  19165. }
  19166. },
  19167. {
  19168. xtype: "textfield",
  19169. fieldLabel: '总条数',
  19170. value: grid.exportExcelTotal,
  19171. readOnly: true
  19172. },
  19173. {
  19174. text: '导出',
  19175. iconCls: 'x-fa fa-download',
  19176. listeners: {
  19177. click: function (sender, value) {
  19178. grid.exportExcelClick({
  19179. exportExcelPageSize: grid.exportExcelPageSize,
  19180. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19181. });
  19182. }
  19183. }
  19184. },
  19185. ]
  19186. });
  19187. treeMenu.showAt(rect.left, rect.top - 120);
  19188. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19189. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19190. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19191. // }
  19192. },
  19193. /**
  19194. * 获取表格编辑的行数据
  19195. */
  19196. getGridEditRows: function () {
  19197. var grid = this;
  19198. var store = grid.getStore();
  19199. var rows = [];
  19200. var modifyRows = [];
  19201. var newRows = [];
  19202. var err = "";
  19203. var records = store.getModifiedRecords();
  19204. var newRecords = store.getNewRecords();
  19205. var removeRecords = [];
  19206. _$2.forEach(store.getRemovedRecords(), function (row) {
  19207. removeRecords.push(row.data);
  19208. });
  19209. _$2.forEach(records, function (record) {
  19210. var colums = grid.columns;
  19211. var errFunc = undefined;
  19212. _$2.forEach(colums, function (col) {
  19213. var name = col.dataIndex;
  19214. var value = record.data[name];
  19215. var colIndex = col.getIndex(); //获得列号
  19216. var rowIndex = store.indexOfId(record.id); //获得行号
  19217. var editor = col.getEditor(); //使用的编辑器
  19218. var tmpErrFunc = function () {
  19219. var text = col.text || col.name;
  19220. msg(text + ' 校验失败, 请确保输入的数据正确');
  19221. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19222. };
  19223. if (editor && !editor.allowBlank && isEmpty(value)) {
  19224. errFunc = tmpErrFunc;
  19225. return false;
  19226. }
  19227. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19228. errFunc = tmpErrFunc;
  19229. return false;
  19230. }
  19231. });
  19232. if (typeof errFunc === 'function') {
  19233. err = "1";
  19234. _$2.remove(rows, function (n) {
  19235. return true;
  19236. });
  19237. //@ts-ignore
  19238. errFunc();
  19239. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19240. return false;
  19241. }
  19242. else {
  19243. if (_$2.findIndex(newRecords, function (item) {
  19244. return item === record;
  19245. }) >= 0) {
  19246. newRows.push(record.data);
  19247. }
  19248. else {
  19249. modifyRows.push(record.data);
  19250. }
  19251. rows.push(record.data);
  19252. }
  19253. });
  19254. return {
  19255. rows: rows,
  19256. newRows: newRows,
  19257. modifyRows: modifyRows,
  19258. removeRecords: removeRecords,
  19259. err: err
  19260. };
  19261. }
  19262. // reload() {
  19263. // dataSourceReload(this)
  19264. // },
  19265. });
  19266. }
  19267. /**
  19268. * 获取 columns 中所有的 dataIndex
  19269. */
  19270. function getFileds(newConfig) {
  19271. var fields = [];
  19272. _$2.forEach(newConfig.columns, function (c) {
  19273. if (c.dataIndex) {
  19274. fields.push(c.dataIndex);
  19275. }
  19276. });
  19277. return fields;
  19278. }
  19279. function convertDataSource$1(sender, scope, newConfig) {
  19280. if (typeof newConfig.store !== 'undefined') {
  19281. // 有 store 属性的情况下,不做任何事
  19282. return;
  19283. }
  19284. if (typeof newConfig.dataSource === 'undefined') {
  19285. // 没有定义 dataSource 的情况下,不做任何事
  19286. return;
  19287. }
  19288. if (_$2.isArray(newConfig.data)) {
  19289. // 有 data 属性赋值的情况下
  19290. newConfig.store = {
  19291. fields: getFileds(newConfig),
  19292. data: newConfig.data
  19293. };
  19294. delete newConfig.data;
  19295. return;
  19296. }
  19297. var dataSource = newConfig.dataSource;
  19298. if (typeof dataSource === 'string') {
  19299. // dataSource 是字符串的情况下,找到成员函数
  19300. dataSource = lookupFn(scope, dataSource);
  19301. }
  19302. if (typeof dataSource === 'function') {
  19303. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19304. newConfig.store = new Ext.data.Store({
  19305. fields: getFileds(newConfig),
  19306. // data: [],
  19307. autoLoad: true,
  19308. proxy: {
  19309. type: 'memory',
  19310. data: [],
  19311. }
  19312. });
  19313. newConfig.dataSourceCallbackFn = dataSource;
  19314. return;
  19315. }
  19316. // throw new TypeError('无法识别的调用方法')
  19317. }
  19318. //# sourceMappingURL=grid.js.map
  19319. function initTextfield () {
  19320. var cc = Ext.form.field.Text.prototype.constructor;
  19321. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19322. Ext.form.field.Text.override({
  19323. constructor: function (config) {
  19324. var newConfig = _$2.defaultsDeep({
  19325. // 强制属性
  19326. triggers: {
  19327. clear: {
  19328. weight: -1,
  19329. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19330. hidden: true,
  19331. handler: 'onClearClick',
  19332. },
  19333. }
  19334. }, baseConfig(config, 'col-item'), config, text);
  19335. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19336. newConfig.enableKeyEvents = true;
  19337. }
  19338. cc.call(this, newConfig);
  19339. },
  19340. /**
  19341. * 清空所有值
  19342. */
  19343. onClearClick: function (sender, e) {
  19344. var me = this;
  19345. me.setValue('');
  19346. },
  19347. /**
  19348. * 尝试获取下一个要获取焦点的控件
  19349. */
  19350. _raiseNextFocus: function (sender) {
  19351. var config = sender.config;
  19352. var scope = lookupScope(sender);
  19353. if (typeof config.nextFocus === 'function') {
  19354. config.nextFocus(sender);
  19355. }
  19356. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19357. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19358. var fn = lookupFn(scope, config.nextFocus);
  19359. if (typeof fn === 'function') {
  19360. var nextCtlReference = fn(sender);
  19361. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19362. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19363. if (ctl) {
  19364. if (typeof ctl.focus2 === 'function') {
  19365. ctl.focus2();
  19366. }
  19367. else {
  19368. ctl.focus();
  19369. }
  19370. }
  19371. }
  19372. }
  19373. }
  19374. else {
  19375. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19376. if (ctl) {
  19377. if (typeof ctl.focus2 === 'function') {
  19378. ctl.focus2();
  19379. }
  19380. else {
  19381. ctl.focus();
  19382. }
  19383. }
  19384. }
  19385. }
  19386. },
  19387. initComponent: function () {
  19388. /**
  19389. * 改变必填项之前加星号
  19390. */
  19391. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19392. // this.beforeLabelTextTpl = [
  19393. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19394. // ];
  19395. this.afterLabelTextTpl = [
  19396. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19397. ];
  19398. }
  19399. var me = this;
  19400. this.on({
  19401. change: function (sender, newVal) {
  19402. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19403. if (hideTrigger || disabled || readOnly || hideClear) {
  19404. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19405. return;
  19406. }
  19407. var value = newVal;
  19408. if (value) {
  19409. me.getTrigger('clear').show();
  19410. me.updateLayout();
  19411. }
  19412. else {
  19413. me.getTrigger('clear').hide();
  19414. me.updateLayout();
  19415. }
  19416. },
  19417. afterrender: function (sender) {
  19418. var _this = this;
  19419. var _a;
  19420. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19421. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19422. $$2(sender.inputEl.dom).on('click', function (e) {
  19423. sender.fireEvent('click', _this, e);
  19424. });
  19425. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19426. var _a, _b, _c, _d;
  19427. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19428. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19429. if (sender.isExpanded === true) {
  19430. // 弹开下拉框的基础上,不干预上下选择
  19431. return;
  19432. }
  19433. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19434. var grid = sender.ownerCt.up('grid');
  19435. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19436. if (editingPlugin) {
  19437. 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;
  19438. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19439. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19440. // editingPlugin
  19441. var targetRecord = void 0;
  19442. if (e.code === 'ArrowDown') {
  19443. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19444. }
  19445. else {
  19446. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19447. }
  19448. if (targetRecord) {
  19449. grid.setSelection([targetRecord]);
  19450. editingPlugin.startEdit(targetRecord, column);
  19451. }
  19452. e.stopPropagation();
  19453. e.preventDefault();
  19454. }
  19455. }
  19456. }
  19457. }
  19458. });
  19459. }
  19460. var config = sender.config;
  19461. if (config.ff && config.ff > 0) {
  19462. setTimeout(function () {
  19463. if (typeof sender.focus2 === 'function') {
  19464. sender.focus2();
  19465. }
  19466. else {
  19467. sender.focus();
  19468. }
  19469. }, config.ff);
  19470. }
  19471. }
  19472. });
  19473. var config = this.config;
  19474. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19475. this.on({
  19476. keyup: function (sender, e) {
  19477. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19478. sender._raiseNextFocus(sender);
  19479. }
  19480. }
  19481. });
  19482. }
  19483. var that = this;
  19484. this.on({
  19485. keyup: function (sender, e, eOpts) {
  19486. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19487. return;
  19488. }
  19489. that.keydown_fun_item(sender, e, eOpts);
  19490. }
  19491. });
  19492. initComponent.call(this);
  19493. },
  19494. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19495. var that = sender;
  19496. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19497. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19498. var value = _$2.trim(sender.rawValue);
  19499. var r = that.fireEvent('scancode', that, value, event);
  19500. if (r === 'OK') {
  19501. // 停止事件的默认处理程序,停止事件的冒泡
  19502. // event.stopEvent();
  19503. event.preventDefault();
  19504. event.stopPropagation();
  19505. }
  19506. }
  19507. }, 100)
  19508. });
  19509. }
  19510. //# sourceMappingURL=textfield.js.map
  19511. function initTbFill () {
  19512. /**
  19513. *
  19514. */
  19515. var ct = Ext.toolbar.Fill.prototype.constructor;
  19516. Ext.toolbar.Fill.override({
  19517. constructor: function (config) {
  19518. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19519. ct.call(this, newConfig);
  19520. }
  19521. });
  19522. }
  19523. //# sourceMappingURL=tbfill.js.map
  19524. function initTbSeparator () {
  19525. /**
  19526. *
  19527. */
  19528. var ct = Ext.toolbar.Separator.prototype.constructor;
  19529. Ext.toolbar.Separator.override({
  19530. constructor: function (config) {
  19531. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19532. ct.call(this, newConfig);
  19533. }
  19534. });
  19535. }
  19536. //# sourceMappingURL=tbseparator.js.map
  19537. function initToolbar () {
  19538. /**
  19539. *
  19540. */
  19541. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19542. Ext.toolbar.Toolbar.override({
  19543. constructor: function (config) {
  19544. var newConfig = _$2.defaultsDeep({
  19545. // 强制性属性
  19546. }, baseConfig(config, 'cols-container'), config, toolbar);
  19547. ct.call(this, newConfig);
  19548. }
  19549. });
  19550. initTbFill();
  19551. initTbSeparator();
  19552. }
  19553. //# sourceMappingURL=toolbar.js.map
  19554. function initSplitter () {
  19555. var ct = Ext.resizer.Splitter.prototype.constructor;
  19556. Ext.resizer.Splitter.override({
  19557. constructor: function (config) {
  19558. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19559. ct.call(this, newConfig);
  19560. }
  19561. });
  19562. }
  19563. //# sourceMappingURL=splitter.js.map
  19564. /**
  19565. * 通用 dataSource 解析,
  19566. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19567. */
  19568. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19569. var config = ctl.config;
  19570. return new Promise(function (resolve, reject) {
  19571. if (!config.dataSource) {
  19572. // 没有设置数据源,直接置空
  19573. return Promise.resolve();
  19574. }
  19575. var option = {
  19576. extraParam: extraParam,
  19577. _successCb: _successCb,
  19578. successCallback: function (value) {
  19579. if (typeof successCallback === "function") {
  19580. successCallback(value);
  19581. }
  19582. else {
  19583. ctl.setData(value);
  19584. }
  19585. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19586. ctl.setLoading(false);
  19587. resolve(value);
  19588. },
  19589. failCallback: function (error) {
  19590. if (typeof failCallback === "function") {
  19591. failCallback(error);
  19592. }
  19593. ctl.fireEvent('dataLoadComplete', ctl, false);
  19594. ctl.setLoading(false);
  19595. reject(error);
  19596. }
  19597. };
  19598. // 请求前要求确认一下
  19599. var isCanceled = false;
  19600. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19601. isCanceled = true;
  19602. } }, option));
  19603. if (!isCanceled) {
  19604. // 请求没有被取消
  19605. // 调用异步接口返回 Promise
  19606. return _innerReload(ctl, option);
  19607. }
  19608. return reject();
  19609. });
  19610. }
  19611. function _innerReload(ctl, option) {
  19612. var config = ctl.config;
  19613. ctl.setLoading(true);
  19614. var scope = lookupScope(ctl);
  19615. var dataSource = config.dataSource;
  19616. if (typeof dataSource == 'string') {
  19617. dataSource = lookupFn(scope, config.dataSource);
  19618. }
  19619. if (typeof dataSource === 'function') {
  19620. // @ts-ignore
  19621. dataSource.call(scope, ctl, option);
  19622. return;
  19623. }
  19624. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19625. if (!ajax.func) {
  19626. console.error("没有配置 ajax");
  19627. return;
  19628. }
  19629. var params_1 = {};
  19630. var sortModel = null;
  19631. var filterModel = null;
  19632. if (option.extraParam && option.extraParam.filterModel) {
  19633. filterModel = option.extraParam.filterModel;
  19634. }
  19635. if (option.extraParam && option.extraParam.sortModel) {
  19636. sortModel = option.extraParam.sortModel;
  19637. }
  19638. _$2.forOwn(option.extraParam, function (v, key) {
  19639. if (key != "filterModel" && key != "sortModel") {
  19640. if (typeof v === 'function') {
  19641. params_1[key] = v();
  19642. }
  19643. else {
  19644. params_1[key] = v;
  19645. }
  19646. }
  19647. });
  19648. var ds = dataSource;
  19649. _$2.forOwn(ds.params, function (v, key) {
  19650. if (typeof v === 'function') {
  19651. params_1[key] = v();
  19652. }
  19653. else {
  19654. params_1[key] = v;
  19655. }
  19656. });
  19657. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19658. // @ts-ignore
  19659. ajax.func({
  19660. method: dataSource.method,
  19661. url: ds.url,
  19662. data: params_1,
  19663. filterModel: filterModel,
  19664. sortModel: sortModel,
  19665. }).then(function (res) {
  19666. if (res.success) {
  19667. option.successCallback(res.data);
  19668. }
  19669. else {
  19670. option.failCallback(res.msg);
  19671. }
  19672. }).catch(function (e) {
  19673. option.failCallback(e);
  19674. });
  19675. }
  19676. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19677. var ds_1 = ctl.dataSource;
  19678. // @ts-ignore
  19679. Extend.ajax.func({
  19680. url: ds_1.sqlId,
  19681. data: params_1,
  19682. db: ds_1.db,
  19683. method: 'sql',
  19684. filterModel: filterModel,
  19685. sortModel: sortModel,
  19686. }).then(function (res) {
  19687. if (res.success) {
  19688. option.successCallback(res.data);
  19689. }
  19690. else {
  19691. option.failCallback(res.msg);
  19692. }
  19693. }).catch(function (e) {
  19694. option.failCallback(e);
  19695. }).finally(function () {
  19696. ctl.loading = false;
  19697. });
  19698. return;
  19699. }
  19700. else {
  19701. console.error("非法的 dataSource", ctl.dataSource);
  19702. debugger;
  19703. throw new Error("非法的 dataSource");
  19704. }
  19705. }
  19706. }
  19707. //# sourceMappingURL=DataSourceHelper.js.map
  19708. function initCombo () {
  19709. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19710. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19711. Ext.form.field.ComboBox.override({
  19712. constructor: function (config) {
  19713. var newConfig = _$2.defaultsDeep({
  19714. // 强制性属性
  19715. }, baseConfig(config, 'col-item'), config, combo);
  19716. if (typeof config.dict === 'string') {
  19717. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19718. }
  19719. else if (typeof newConfig.store == 'undefined') {
  19720. if (_$2.isArray(newConfig.data)) {
  19721. // ExtJS 无法直接接受数组模式
  19722. newConfig.store = {
  19723. fields: [newConfig.valueField, newConfig.displayField],
  19724. data: newConfig.data
  19725. };
  19726. delete newConfig.data;
  19727. }
  19728. else if (typeof newConfig.data !== 'object') {
  19729. newConfig.store = {
  19730. fields: [newConfig.valueField, newConfig.displayField],
  19731. data: []
  19732. };
  19733. delete newConfig.data;
  19734. }
  19735. }
  19736. cc.call(this, newConfig);
  19737. },
  19738. setDict: function (bizKey) {
  19739. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19740. this.dict = bizKey;
  19741. },
  19742. getDict: function () {
  19743. return this.dict;
  19744. },
  19745. setData: function (value) {
  19746. if (!value) {
  19747. return;
  19748. }
  19749. var config = value.config;
  19750. if (!this.store) {
  19751. this.store = new Ext.data.Store({
  19752. fields: [config.valueField, config.displayField],
  19753. data: value
  19754. });
  19755. }
  19756. else {
  19757. this.store.getProxy().setData(value);
  19758. this.store.load();
  19759. }
  19760. },
  19761. setLoading: function (value) {
  19762. if (value) {
  19763. if (!this.loadMask) {
  19764. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19765. }
  19766. }
  19767. else {
  19768. if (this.loadMask) {
  19769. this.loadMask.destroy();
  19770. delete this.loadMask;
  19771. }
  19772. }
  19773. },
  19774. reload: function () {
  19775. dataSourceReload(this);
  19776. },
  19777. initComponent: function () {
  19778. var that = this;
  19779. var toggle = function (e) {
  19780. var readOnly = that.readOnly, disabled = that.disabled;
  19781. if (readOnly || disabled) {
  19782. return;
  19783. }
  19784. if ($(e.target).is('.x-form-trigger')) {
  19785. return;
  19786. }
  19787. // 点击后下拉
  19788. if (that.isExpanded) {
  19789. that.collapse();
  19790. }
  19791. else {
  19792. that.expand();
  19793. that.doQuery(that.allQuery, true);
  19794. }
  19795. };
  19796. this.on({
  19797. afterrender: function (sender) {
  19798. var config = this.config;
  19799. if (config.dataSource && config.autoLoad) {
  19800. dataSourceReload(this);
  19801. }
  19802. // 点击后下拉
  19803. $(this.el.dom).on('click', toggle.bind(this));
  19804. },
  19805. focusenter: function (sender, event, opt) {
  19806. var _a;
  19807. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19808. // 表格内编辑框,获取焦点后自动弹开
  19809. toggle.call(this, event);
  19810. }
  19811. },
  19812. destory: function () {
  19813. $(this.el.dom).off('click', toggle.bind(this));
  19814. },
  19815. beforequery: function (context) {
  19816. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19817. // console.log('beforequery', query)
  19818. if (!forceAll && query) {
  19819. combo.store.clearFilter();
  19820. combo.store.filterBy(function (record, id) {
  19821. var text = record.get(combo.displayField);
  19822. // 用拼音筛选的方式
  19823. return keywordFilter(query, text, id);
  19824. });
  19825. combo.expand();
  19826. return false;
  19827. }
  19828. combo.store.clearFilter();
  19829. combo.expand();
  19830. return false;
  19831. },
  19832. });
  19833. initComponent.call(this);
  19834. },
  19835. focus2: function () {
  19836. this.focus();
  19837. var that = this;
  19838. _$2.defer(function () {
  19839. if (that.isExpanded) {
  19840. that.collapse();
  19841. }
  19842. else {
  19843. that.expand();
  19844. that.doQuery(that.allQuery, true);
  19845. }
  19846. });
  19847. }
  19848. });
  19849. }
  19850. //# sourceMappingURL=combo.js.map
  19851. /**
  19852. xtype: 'tagfield',
  19853. displayField: 'show',
  19854. valueField: 'id',
  19855. queryMode: 'local',
  19856. filterPickList: true,
  19857. store: {
  19858. fields: ['id', 'show'],
  19859. data: [
  19860. {id: 0, show: 'Battlestar Galactica'},
  19861. {id: 1, show: 'Doctor Who'},
  19862. {id: 2, show: 'Farscape'},
  19863. {id: 3, show: 'Firefly'},
  19864. {id: 4, show: 'Star Trek'},
  19865. {id: 5, show: 'Star Wars: Christmas Special'}
  19866. ]
  19867. }
  19868. */
  19869. function initTag () {
  19870. var cc = Ext.form.field.Tag.prototype.constructor;
  19871. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19872. Ext.form.field.Tag.override({
  19873. constructor: function (config) {
  19874. var newConfig = _$2.defaultsDeep({
  19875. // 强制性属性
  19876. }, baseConfig(config, 'col-item'), config, tagfield);
  19877. if (typeof config.dict === 'string') {
  19878. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19879. }
  19880. else if (typeof newConfig.store == 'undefined') {
  19881. if (_$2.isArray(newConfig.data)) {
  19882. // ExtJS 无法直接接受数组模式
  19883. newConfig.store = {
  19884. fields: [newConfig.valueField, newConfig.displayField],
  19885. data: newConfig.data
  19886. };
  19887. delete newConfig.data;
  19888. }
  19889. else if (typeof newConfig.data !== 'object') {
  19890. newConfig.store = {
  19891. fields: [newConfig.valueField, newConfig.displayField],
  19892. data: []
  19893. };
  19894. delete newConfig.data;
  19895. }
  19896. }
  19897. cc.call(this, newConfig);
  19898. },
  19899. setDict: function (bizKey) {
  19900. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19901. this.dict = bizKey;
  19902. },
  19903. getDict: function () {
  19904. return this.dict;
  19905. },
  19906. setData: function (value) {
  19907. if (!value) {
  19908. return;
  19909. }
  19910. var config = value.config;
  19911. if (!this.store) {
  19912. this.store = new Ext.data.Store({
  19913. fields: [config.valueField, config.displayField],
  19914. data: value
  19915. });
  19916. }
  19917. else {
  19918. this.store.getProxy().setData(value);
  19919. this.store.load();
  19920. }
  19921. },
  19922. setLoading: function (value) {
  19923. if (value) {
  19924. if (!this.loadMask) {
  19925. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19926. }
  19927. }
  19928. else {
  19929. if (this.loadMask) {
  19930. this.loadMask.destroy();
  19931. delete this.loadMask;
  19932. }
  19933. }
  19934. },
  19935. reload: function () {
  19936. dataSourceReload(this);
  19937. },
  19938. initComponent: function () {
  19939. var that = this;
  19940. var toggle = function (e) {
  19941. var readOnly = that.readOnly, disabled = that.disabled;
  19942. if (readOnly || disabled) {
  19943. return;
  19944. }
  19945. if ($(e.target).is('.x-form-trigger')) {
  19946. return;
  19947. }
  19948. // 点击后下拉
  19949. if (that.isExpanded) {
  19950. that.collapse();
  19951. }
  19952. else {
  19953. that.expand();
  19954. that.doQuery(that.allQuery, true);
  19955. }
  19956. };
  19957. this.on({
  19958. afterrender: function (sender) {
  19959. var config = this.config;
  19960. if (config.dataSource && config.autoLoad) {
  19961. dataSourceReload(this);
  19962. }
  19963. // 点击后下拉
  19964. $(this.el.dom).on('click', toggle.bind(this));
  19965. },
  19966. focusenter: function (sender, event, opt) {
  19967. var _a;
  19968. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19969. // 表格内编辑框,获取焦点后自动弹开
  19970. toggle.call(this, event);
  19971. }
  19972. },
  19973. destory: function () {
  19974. $(this.el.dom).off('click', toggle.bind(this));
  19975. },
  19976. });
  19977. initComponent.call(this);
  19978. },
  19979. focus2: function () {
  19980. this.focus();
  19981. var that = this;
  19982. _$2.defer(function () {
  19983. if (that.isExpanded) {
  19984. that.collapse();
  19985. }
  19986. else {
  19987. that.expand();
  19988. that.doQuery(that.allQuery, true);
  19989. }
  19990. });
  19991. }
  19992. });
  19993. }
  19994. //# sourceMappingURL=tagfield.js.map
  19995. function initComboGridMulti () {
  19996. Ext.define('Yvan.LocalComboGrid', {
  19997. extend: 'Ext.form.field.Picker',
  19998. // extend: 'Yvan.PickerAlignCenter',
  19999. xtype: 'combogridmulti',
  20000. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20001. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20002. editable: false,
  20003. initComponent: function () {
  20004. this.on({
  20005. afterrender: function () {
  20006. var config = this.config;
  20007. if (config.dataSource && config.autoLoad) {
  20008. dataSourceReload(this);
  20009. }
  20010. },
  20011. });
  20012. this.superclass.initComponent.apply(this, arguments);
  20013. },
  20014. setStore: function (store) {
  20015. this.store = store;
  20016. var me = this;
  20017. if (me.store) {
  20018. if (me.picker) {
  20019. me.picker.setStore(store);
  20020. if (me.isExpanded) {
  20021. me.collapse();
  20022. delete me.picker;
  20023. me.expand();
  20024. }
  20025. }
  20026. this.onLoad();
  20027. me.mon(me.store, {
  20028. scope: me,
  20029. load: me.onLoad,
  20030. update: me.onUpdate
  20031. });
  20032. }
  20033. },
  20034. reload: function () {
  20035. dataSourceReload(this);
  20036. },
  20037. setData: function (value) {
  20038. var me = this;
  20039. var config = me.config;
  20040. if (!value) {
  20041. return;
  20042. }
  20043. if (!this.store) {
  20044. this.store = new Ext.data.Store({
  20045. fields: [config.valueField, config.displayField],
  20046. data: value
  20047. });
  20048. }
  20049. else {
  20050. this.store.getProxy().setData(value);
  20051. this.store.load();
  20052. }
  20053. this.onLoad();
  20054. },
  20055. createPicker: function () {
  20056. var me = this;
  20057. 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: {
  20058. scope: me,
  20059. selectionchange: me.onSelectionChange,
  20060. itemkeydown: me.onPickerKeyDown
  20061. } })), view = picker.getView();
  20062. if (Ext.isIE9 && Ext.isStrict) {
  20063. view.on({
  20064. scope: me,
  20065. highlightitem: me.repaintPickerView,
  20066. unhighlightitem: me.repaintPickerView,
  20067. afteritemexpand: me.repaintPickerView,
  20068. afteritemcollapse: me.repaintPickerView
  20069. });
  20070. }
  20071. return picker;
  20072. },
  20073. repaintPickerView: function () {
  20074. var style = this.picker.getView().getEl().dom.style;
  20075. style.display = style.display;
  20076. },
  20077. onSelectionChange: function (view, record, node, rowIndex, e) {
  20078. this.selectItem(view, record);
  20079. },
  20080. onPickerKeyDown: function (treeView, record, item, index, e) {
  20081. var key = e.getKey();
  20082. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20083. this.selectItem(treeView, record);
  20084. }
  20085. },
  20086. selectItem: function (sender, record) {
  20087. var me = this;
  20088. var ids = [];
  20089. _$2.forEach(me.picker.getSelection(), function (record) {
  20090. ids.push(record.get(me.valueField));
  20091. });
  20092. me.fireEvent('select', me, record);
  20093. me.setValue(ids.join(me.splitChar));
  20094. // me.collapse();
  20095. },
  20096. onExpand: function () {
  20097. var me = this;
  20098. var picker = this.picker;
  20099. var value = this.value;
  20100. if (!me.store) {
  20101. msg('正在初始化数据,请稍后');
  20102. me.collapse();
  20103. return;
  20104. }
  20105. var vs = _$2.split(value, me.splitChar);
  20106. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20107. picker.setSelection(records);
  20108. },
  20109. setValue: function (value) {
  20110. var me = this;
  20111. console.log('setValue', value);
  20112. me.value = value;
  20113. if (!me.store || me.store.loading) {
  20114. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20115. return me.mixins.field.setValue.call(me, value);
  20116. // return me;
  20117. }
  20118. var vs = _$2.split(value, me.splitChar);
  20119. var displayValues = [];
  20120. _$2.forEach(vs, function (v) {
  20121. var _a;
  20122. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20123. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20124. if (dv) {
  20125. displayValues.push(dv);
  20126. }
  20127. else {
  20128. displayValues.push(v);
  20129. }
  20130. });
  20131. // set the raw value to the record's display field if a record was found
  20132. me.setRawValue(displayValues.join(me.splitChar));
  20133. return me.mixins.field.setValue.call(me, value);
  20134. },
  20135. getSubmitValue: function () {
  20136. return this.value;
  20137. },
  20138. getValue: function () {
  20139. return this.value;
  20140. },
  20141. onLoad: function () {
  20142. var value = this.value;
  20143. if (value) {
  20144. this.setValue(value);
  20145. }
  20146. },
  20147. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20148. var display = this.displayField;
  20149. var me = this;
  20150. if (type === 'edit' && modifiedFieldNames &&
  20151. Ext.Array.contains(modifiedFieldNames, display) &&
  20152. this.value === rec.getId()) {
  20153. me.mixins.field.setValue.call(me, this.value);
  20154. this.setRawValue(rec.get(display));
  20155. }
  20156. }
  20157. });
  20158. }
  20159. //# sourceMappingURL=combogridmulti.js.map
  20160. function initSearch () {
  20161. Ext.define('Yvan.Search', {
  20162. extend: 'Ext.form.field.Text',
  20163. alias: 'widget.searchfield',
  20164. xtype: 'searchfield',
  20165. constructor: function (config) {
  20166. var self = this;
  20167. var newConfig = _$2.defaultsDeep({
  20168. // 强制性属性
  20169. triggers: {
  20170. clear: {
  20171. weight: 0,
  20172. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20173. hidden: true,
  20174. handler: 'onClearClick',
  20175. },
  20176. search: {
  20177. weight: 1,
  20178. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20179. handler: 'onSearchClick'
  20180. },
  20181. },
  20182. listeners: {
  20183. blur: function (sender, e) {
  20184. this.revertOnblur();
  20185. },
  20186. specialkey: function (sender, e) {
  20187. var _a;
  20188. var me = this;
  20189. if (e.getKey() === e.ENTER) {
  20190. me.onSearchClick(sender, {}, e);
  20191. return;
  20192. }
  20193. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20194. },
  20195. afterrender: function (sender, e) {
  20196. var _a;
  20197. this.replaceRawInputEvent();
  20198. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20199. }
  20200. },
  20201. }, baseConfig(config, 'col-item'), config, search);
  20202. this.superclass.constructor.call(self, newConfig);
  20203. },
  20204. revertOnblur: function () {
  20205. this.setRawValue(this.lastValue);
  20206. },
  20207. onSearchClick: function (sender, vv, e) {
  20208. var me = this;
  20209. var config = me.config;
  20210. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20211. if (e) {
  20212. e.preventDefault();
  20213. e.stopPropagation();
  20214. }
  20215. this.fireEvent('search', sender, e);
  20216. if (!widget) {
  20217. return;
  20218. }
  20219. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20220. },
  20221. replaceRawInputEvent: function () {
  20222. var me = this;
  20223. var $dom = $(me.inputEl.dom);
  20224. $dom.on('input', function (e) {
  20225. stopEvent(e);
  20226. // console.log('has input', e)
  20227. });
  20228. $dom.on('keyup', function (e) {
  20229. if (e.key === "Enter") {
  20230. me.onSearchClick(me, {}, e);
  20231. return;
  20232. }
  20233. stopEvent(e);
  20234. });
  20235. $dom.on('change', function (e) {
  20236. stopEvent(e);
  20237. });
  20238. },
  20239. onChange: function (newVal, oldVal) {
  20240. var me = this;
  20241. var value = newVal;
  20242. if (value) {
  20243. me.getTrigger('clear').show();
  20244. me.updateLayout();
  20245. }
  20246. else {
  20247. me.getTrigger('clear').hide();
  20248. me.updateLayout();
  20249. }
  20250. },
  20251. /**
  20252. * 清空所有值
  20253. */
  20254. onClearClick: function (sender, e) {
  20255. var me = this;
  20256. var config = me.config;
  20257. var lookup = config.lookup;
  20258. me.setValue('');
  20259. clearViewModelByLookup(sender, lookup);
  20260. }
  20261. });
  20262. }
  20263. //# sourceMappingURL=search.js.map
  20264. function initMultipleSearch () {
  20265. Ext.define('Yvan.MultipleSearch', {
  20266. extend: 'Ext.form.field.Text',
  20267. xtype: 'multiplesearch',
  20268. bindTargert: '',
  20269. constructor: function (config) {
  20270. var _a, _b, _c, _d;
  20271. var self = this;
  20272. var newConfig = _$2.defaultsDeep({
  20273. // 强制性属性
  20274. triggers: {
  20275. clear: {
  20276. weight: 0,
  20277. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20278. hidden: true,
  20279. handler: 'onClearClick',
  20280. }
  20281. },
  20282. transformRawValue: function (o) {
  20283. return o;
  20284. },
  20285. listeners: {
  20286. specialkey: function (sender, e) {
  20287. var me = this;
  20288. if (e.getKey() === e.ENTER) {
  20289. me.fireEvent('search', me, e);
  20290. }
  20291. },
  20292. afterrender: function (sender, e) {
  20293. var _a;
  20294. this.replaceRawInputEvent();
  20295. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20296. }
  20297. },
  20298. }, baseConfig(config, 'col-item'), config, search);
  20299. this.superclass.constructor.call(self, newConfig);
  20300. 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 : '';
  20301. vv = _$2.replace(vv, "{", "");
  20302. vv = _$2.replace(vv, "}", "");
  20303. this.bindTargert = vv;
  20304. this.bindTargert = _$2.trim(this.bindTargert);
  20305. },
  20306. setBindValue: function (arrValue) {
  20307. if (this.bindTargert) {
  20308. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20309. }
  20310. },
  20311. replaceRawInputEvent: function () {
  20312. var me = this;
  20313. var $dom = $(me.inputEl.dom);
  20314. $dom.on('input', function (e) {
  20315. var _a, _b, _c, _d, _e, _f;
  20316. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20317. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20318. if (!a.endsWith(",") && a.length > 0) {
  20319. e.currentTarget.value = a + ",";
  20320. }
  20321. else {
  20322. e.currentTarget.value = a;
  20323. }
  20324. }
  20325. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20326. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20327. _$2.remove(arr, function (it) {
  20328. return !it;
  20329. });
  20330. me.setBindValue(arr);
  20331. stopEvent(e);
  20332. });
  20333. $dom.on('keyup', function (e) {
  20334. me.fireEvent('keyup', me, e);
  20335. // invokeMethod(me.config.listeners?.keyup, me, e)
  20336. stopEvent(e);
  20337. });
  20338. $dom.on('keydown', function (e) {
  20339. me.fireEvent('keydown', me, e);
  20340. // invokeMethod(me.config.listeners?.keydown, me, e)
  20341. //stopEvent(e)
  20342. });
  20343. $dom.on('change', function (e) {
  20344. stopEvent(e);
  20345. });
  20346. $dom.on('paste', function (e) {
  20347. var _a;
  20348. // @ts-ignore
  20349. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20350. var text = clipdata.getData("text/plain");
  20351. var spliter = ',';
  20352. text = text.replaceAll("\r", "");
  20353. text = text.replaceAll("\n", spliter);
  20354. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20355. var arr = text.split(spliter);
  20356. if (arr && Array.isArray(arr)) {
  20357. for (var i = 0; i < arr.length; i++) {
  20358. arr[i] = _$2.trim(arr[i]);
  20359. }
  20360. }
  20361. _$2.remove(arr, function (it) {
  20362. return !it;
  20363. });
  20364. me.setBindValue(arr);
  20365. stopEvent(e);
  20366. });
  20367. },
  20368. onChange: function (newVal, oldVal) {
  20369. var me = this;
  20370. var value = newVal;
  20371. if (value) {
  20372. me.getTrigger('clear').show();
  20373. me.updateLayout();
  20374. }
  20375. else {
  20376. me.getTrigger('clear').hide();
  20377. me.updateLayout();
  20378. }
  20379. },
  20380. /**
  20381. * 清空所有值
  20382. */
  20383. onClearClick: function (sender, e) {
  20384. var me = this;
  20385. var config = me.config;
  20386. var lookup = config.lookup;
  20387. me.setValue('');
  20388. clearViewModelByLookup(sender, lookup);
  20389. }
  20390. });
  20391. }
  20392. //# sourceMappingURL=multiplesearch.js.map
  20393. function initDate () {
  20394. var cc = Ext.form.field.Date.prototype.constructor;
  20395. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20396. Ext.form.field.Date.override({
  20397. format: 'Y-m-d',
  20398. altFormats: 'Y-m-d',
  20399. constructor: function (config) {
  20400. var newConfig = _$2.defaultsDeep({
  20401. // 强制属性
  20402. }, baseConfig(config, 'col-item'), config, date);
  20403. cc.call(this, newConfig);
  20404. },
  20405. getValue: function () {
  20406. var ov = getValue.call(this);
  20407. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20408. // console.log('cc:', nv, ov)
  20409. return nv;
  20410. },
  20411. // focus2() {
  20412. // const that = this
  20413. // if (that.isExpanded) {
  20414. // that.collapse()
  20415. //
  20416. // } else {
  20417. // that.expand();
  20418. // }
  20419. // _.defer(() => {
  20420. // that.focus()
  20421. // })
  20422. // },
  20423. initComponent: function () {
  20424. this.on({
  20425. afterrender: function () {
  20426. var config = this.config;
  20427. // 日期框,不要默认弹出
  20428. // $(this.el.dom).on('click', toggle.bind(this))
  20429. },
  20430. destory: function () {
  20431. // 日期框,不要默认弹出
  20432. // $(this.el.dom).off('click', toggle.bind(this))
  20433. },
  20434. change: {
  20435. fn: function (sender) {
  20436. if (sender.format === 'Y-m-d') {
  20437. // 年月日格式
  20438. var value = sender.getRawValue();
  20439. if (/^\d{8}$/.test(value)) {
  20440. // 8位数字,自动转换为 YYYY-MM-DD
  20441. var newValue = [
  20442. value.substr(0, 4),
  20443. value.substr(4, 2),
  20444. value.substr(6, 2)
  20445. ].join('-');
  20446. sender.setValue(newValue);
  20447. }
  20448. }
  20449. },
  20450. }
  20451. // focus: {
  20452. // // 获得焦点后自动下拉
  20453. // fn(sender) {
  20454. // sender.expand();
  20455. // this.doQuery(this.allQuery, true);
  20456. // },
  20457. // },
  20458. });
  20459. initComponent.call(this);
  20460. },
  20461. createInitialDate: function (value) {
  20462. var minValue = this.minValue, maxValue = this.maxValue;
  20463. value = value || syncDate(new Date());
  20464. if (minValue && minValue > value) {
  20465. value = minValue;
  20466. }
  20467. else if (maxValue && maxValue < value) {
  20468. value = maxValue;
  20469. }
  20470. return value;
  20471. },
  20472. });
  20473. }
  20474. //# sourceMappingURL=datefield.js.map
  20475. function initDateTimePicker () {
  20476. Ext.define('Yvan.DateTimePicker', {
  20477. extend: 'Ext.picker.Date',
  20478. alias: 'datetimepicker',
  20479. alternateClassName: 'Ext.DateTimePicker',
  20480. renderTpl: [
  20481. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20482. '<div class="{baseCls}-header">',
  20483. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20484. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20485. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20486. '</div>',
  20487. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20488. '<thead>',
  20489. '<tr role="row">',
  20490. '<tpl for="dayNames">',
  20491. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20492. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20493. '</th>',
  20494. '</tpl>',
  20495. '</tr>',
  20496. '</thead>',
  20497. '<tbody>',
  20498. '<tr role="row">',
  20499. '<tpl for="days">',
  20500. '{#:this.isEndOfWeek}',
  20501. '<td role="gridcell">',
  20502. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20503. '</td>',
  20504. '</tpl>',
  20505. '</tr>',
  20506. '</tbody>',
  20507. '</table>',
  20508. '<tpl if="showToday">',
  20509. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20510. '</tpl>',
  20511. // These elements are used with Assistive Technologies such as screen readers
  20512. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20513. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20514. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20515. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20516. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20517. '</div>',
  20518. {
  20519. firstInitial: function (value) {
  20520. return Ext.picker.Date.prototype.getDayInitial(value);
  20521. },
  20522. isEndOfWeek: function (value) {
  20523. // convert from 1 based index to 0 based
  20524. // by decrementing value once.
  20525. value--;
  20526. // eslint-disable-next-line vars-on-top
  20527. var end = value % 7 === 0 && value !== 0;
  20528. return end ? '</tr><tr role="row">' : '';
  20529. },
  20530. renderTodayBtn: function (values, out) {
  20531. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20532. },
  20533. renderMonthBtn: function (values, out) {
  20534. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20535. }
  20536. }
  20537. ],
  20538. beforeRender: function () {
  20539. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20540. this.superclass.beforeRender.call(this);
  20541. function handleInput(extHandle, $input) {
  20542. var $dom = $(extHandle.el.dom);
  20543. // const $up = $dom.find('.x-form-spinner-up')
  20544. // const $down = $dom.find('.x-form-spinner-down')
  20545. // debugger
  20546. // $up.on('mousedown', () => {
  20547. // debugger
  20548. // });
  20549. // $up.on('click', () => {
  20550. // debugger
  20551. // });
  20552. extHandle.on('click', function (sender) {
  20553. var hideBak = me.hide;
  20554. me.hide = Ext.emptyFn;
  20555. extHandle.focus();
  20556. me.hide = hideBak;
  20557. });
  20558. var changeValue = function (delta) {
  20559. if (_$2.trim(extHandle.getValue()) === '') {
  20560. extHandle.setValue(extHandle.minValue);
  20561. }
  20562. else {
  20563. var v = parseInt('' + extHandle.getValue());
  20564. if (v + delta > extHandle.maxValue) {
  20565. extHandle.setValue(extHandle.minValue);
  20566. }
  20567. else if (v + delta < extHandle.minValue) {
  20568. extHandle.setValue(extHandle.maxValue);
  20569. }
  20570. else {
  20571. extHandle.setValue(v + delta);
  20572. }
  20573. }
  20574. };
  20575. $input.on('mousewheel', function (e) {
  20576. e.stopPropagation();
  20577. var event = e.originalEvent;
  20578. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20579. // if (event.wheelDelta) {
  20580. // delta = event.wheelDelta / 120;
  20581. // } else if (event.detail) {
  20582. // delta = -event.detail / 3;
  20583. // }
  20584. var zoomSize = Math.ceil(eventDelta / 120);
  20585. changeValue(zoomSize);
  20586. // console.log('delta', delta)
  20587. // $input.focus()
  20588. });
  20589. }
  20590. me.input1 = Ext.create('Ext.form.field.Number', {
  20591. minValue: 0,
  20592. maxValue: 23,
  20593. flex: 1,
  20594. enableKeyEvents: true,
  20595. fieldLabel: '时',
  20596. labelWidth: 20,
  20597. hideLabel: true,
  20598. spinDownEnabled: false,
  20599. spinUpEnabled: false,
  20600. style: {
  20601. marginLeft: '5px',
  20602. },
  20603. listeners: {
  20604. afterrender: function (sender) {
  20605. var $input = $(sender.inputEl.dom);
  20606. handleInput(me.input1, $input);
  20607. },
  20608. change: function (sender, e) {
  20609. if (me.getValue()) {
  20610. me.value.setHours(sender.getValue());
  20611. }
  20612. },
  20613. }
  20614. });
  20615. me.input2 = Ext.create('Ext.form.field.Number', {
  20616. minValue: 0,
  20617. maxValue: 59,
  20618. flex: 1,
  20619. enableKeyEvents: true,
  20620. fieldLabel: ' ',
  20621. hideLabel: false,
  20622. labelWidth: 8,
  20623. spinDownEnabled: false,
  20624. spinUpEnabled: false,
  20625. listeners: {
  20626. afterrender: function (sender) {
  20627. var $input = $(sender.inputEl.dom);
  20628. handleInput(me.input2, $input);
  20629. },
  20630. change: function (sender, e) {
  20631. if (me.getValue()) {
  20632. me.value.setMinutes(sender.getValue());
  20633. }
  20634. },
  20635. }
  20636. });
  20637. me.input3 = Ext.create('Ext.form.field.Number', {
  20638. minValue: 0,
  20639. maxValue: 59,
  20640. flex: 1,
  20641. enableKeyEvents: true,
  20642. fieldLabel: ' ',
  20643. hideLabel: false,
  20644. labelWidth: 8,
  20645. spinDownEnabled: false,
  20646. spinUpEnabled: false,
  20647. style: {
  20648. marginRight: '5px',
  20649. },
  20650. listeners: {
  20651. afterrender: function (sender) {
  20652. var $input = $(sender.inputEl.dom);
  20653. handleInput(me.input3, $input);
  20654. },
  20655. change: function (sender, e) {
  20656. if (me.getValue()) {
  20657. me.value.setSeconds(sender.getValue());
  20658. }
  20659. },
  20660. }
  20661. });
  20662. me.confirmBtn = new Ext.button.Button({
  20663. text: '确认',
  20664. handler: me.confirmClick,
  20665. scope: me
  20666. });
  20667. me.tdBtn = new Ext.button.Button({
  20668. text: '现在',
  20669. handler: me.selectToday,
  20670. scope: me
  20671. });
  20672. me.todayBtn = Ext.create('Ext.container.Container', {
  20673. layout: 'anchor', border: false,
  20674. defaults: {
  20675. border: false, anchor: '100%',
  20676. margin: '0 0 5 0',
  20677. },
  20678. items: [
  20679. {
  20680. layout: 'hbox',
  20681. items: [
  20682. me.input1,
  20683. me.input2,
  20684. me.input3,
  20685. ]
  20686. },
  20687. {
  20688. layout: 'hbox',
  20689. items: [
  20690. me.confirmBtn,
  20691. me.tdBtn,
  20692. ]
  20693. }
  20694. ]
  20695. });
  20696. },
  20697. // finishRenderChildren() {
  20698. // var me = this;
  20699. //
  20700. // this.superclass.finishRenderChildren.call(this);
  20701. // //*
  20702. // me.input1.finishRender();
  20703. // me.input2.finishRender();
  20704. // me.input3.finishRender();
  20705. // //
  20706. // me.tdBtn.finishRender();
  20707. // me.confirmBtn.finishRender();
  20708. // },
  20709. setValue: function (value) {
  20710. //this.value = Ext.Date.clearTime(value, true);
  20711. this.value = value;
  20712. this.input1.setValue(this.value.getHours());
  20713. this.input2.setValue(this.value.getMinutes());
  20714. this.input3.setValue(this.value.getSeconds());
  20715. return this.update(this.value);
  20716. },
  20717. selectDate: function (value) {
  20718. if (this.showTime) {
  20719. value.setHours(this.input1.getValue());
  20720. value.setMinutes(this.input2.getValue());
  20721. value.setSeconds(this.input3.getValue());
  20722. }
  20723. this.value = value;
  20724. return this.update(this.value);
  20725. },
  20726. setDisabledStatus: function (disabled) {
  20727. var me = this;
  20728. debugger;
  20729. // me.callParent();
  20730. if (me.showTime) {
  20731. me.confirmBtn.setDisabled(disabled);
  20732. }
  20733. if (me.isShowFooter()) {
  20734. me.footerContainer.setDisabled(disabled);
  20735. }
  20736. },
  20737. handleDateClick: function (e, t) {
  20738. var me = this, handler = me.handler;
  20739. // e.stopEvent();
  20740. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20741. me.doCancelFocus = me.focusOnSelect === false;
  20742. me.selectDate(new Date(t.dateValue));
  20743. delete me.doCancelFocus;
  20744. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20745. if (me.showTime) {
  20746. return;
  20747. }
  20748. me.fireEvent('select', me, me.value);
  20749. if (handler) {
  20750. handler.call(me.scope || me, me, me.value);
  20751. }
  20752. me.onSelect();
  20753. }
  20754. },
  20755. selectToday: function () {
  20756. var me = this, btn = me.todayBtn, handler = me.handler;
  20757. if (btn && !btn.disabled) {
  20758. me.value = syncDate(new Date());
  20759. me.update(me.value);
  20760. me.fireEvent('select', me, me.value);
  20761. if (handler) {
  20762. handler.call(me.scope || me, me, me.value);
  20763. }
  20764. me.onSelect();
  20765. me.hide();
  20766. }
  20767. return me;
  20768. },
  20769. confirmClick: function () {
  20770. var me = this, btn = me.confirmBtn, handler = me.handler;
  20771. if (btn && !btn.disabled) {
  20772. me.fireEvent('select', me, me.value);
  20773. if (handler) {
  20774. handler.call(me.scope || me, me, me.value);
  20775. }
  20776. me.onSelect();
  20777. me.hide();
  20778. }
  20779. return me;
  20780. },
  20781. selectedUpdate: function (date) {
  20782. var me = this,
  20783. //t = date.getTime(),
  20784. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20785. cells.removeCls(cls);
  20786. for (c = 0; c < cLen; c++) {
  20787. cell = Ext.fly(cellItems[c]);
  20788. if (cell.dom.firstChild.dateValue == t) {
  20789. me.fireEvent('highlightitem', me, cell);
  20790. cell.addCls(cls);
  20791. if (me.isVisible() && !me.doCancelFocus) {
  20792. Ext.fly(cell.dom.firstChild).focus(50);
  20793. }
  20794. break;
  20795. }
  20796. }
  20797. },
  20798. // private, inherit docs
  20799. beforeDestroy: function () {
  20800. var me = this;
  20801. if (me.rendered) {
  20802. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20803. }
  20804. me.superclass.beforeDestroy.call(this);
  20805. }
  20806. });
  20807. }
  20808. //# sourceMappingURL=datetimepicker.js.map
  20809. function initDateTime () {
  20810. Ext.define('Yvan.DateTimeField', {
  20811. extend: 'Ext.form.field.Date',
  20812. xtype: 'datetimefield',
  20813. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20814. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20815. showTime: true,
  20816. format: "Y-m-d H:i:s",
  20817. constructor: function (config) {
  20818. var newConfig = _$2.defaultsDeep({
  20819. // 强制属性
  20820. }, baseConfig(config, 'col-item'), config, date);
  20821. this.superclass.constructor.call(this, newConfig);
  20822. },
  20823. initComponent: function () {
  20824. this.superclass.initComponent.call(this);
  20825. var setInitValue = function () {
  20826. var value = this.getRawValue();
  20827. if (!value) {
  20828. // 没填内容的时候,自动设置当前时间
  20829. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20830. }
  20831. };
  20832. this.on({
  20833. afterrender: function () {
  20834. var config = this.config;
  20835. // 日期框,不要默认弹出
  20836. $(this.el.dom).on('click', setInitValue.bind(this));
  20837. },
  20838. destory: function () {
  20839. // 日期框,不要默认弹出
  20840. $(this.el.dom).off('click', setInitValue.bind(this));
  20841. },
  20842. change: {
  20843. fn: function (sender) {
  20844. if (sender.format === "Y-m-d H:i:s") {
  20845. // 年月日格式
  20846. var value = sender.getRawValue();
  20847. if (/^\d{14}$/.test(value)) {
  20848. // 8位数字,自动转换为 YYYY-MM-DD
  20849. var newValue = [
  20850. value.substr(0, 4),
  20851. '-',
  20852. value.substr(4, 2),
  20853. '-',
  20854. value.substr(6, 2),
  20855. ' ',
  20856. value.substr(8, 2),
  20857. ':',
  20858. value.substr(10, 2),
  20859. ':',
  20860. value.substr(12, 2)
  20861. ].join('');
  20862. sender.setValue(newValue);
  20863. }
  20864. }
  20865. },
  20866. }
  20867. });
  20868. },
  20869. getValue: function () {
  20870. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  20871. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  20872. // console.log('cc:', nv, ov)
  20873. return nv;
  20874. },
  20875. onExpand: function () {
  20876. var strValue = this.getValue();
  20877. var value;
  20878. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  20879. 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)));
  20880. }
  20881. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  20882. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  20883. }
  20884. else {
  20885. value = syncDate(new Date());
  20886. }
  20887. this.picker.setValue(value);
  20888. },
  20889. createPicker: function () {
  20890. var me = this, format = Ext.String.format;
  20891. //@ts-ignore
  20892. return new Yvan.DateTimePicker({
  20893. pickerField: me,
  20894. ownerCt: me.ownerCt,
  20895. renderTo: document.body,
  20896. floating: true,
  20897. hidden: true,
  20898. focusOnShow: true,
  20899. minDate: me.minValue,
  20900. maxDate: me.maxValue,
  20901. disabledDatesRE: me.disabledDatesRE,
  20902. disabledDatesText: me.disabledDatesText,
  20903. disabledDays: me.disabledDays,
  20904. disabledDaysText: me.disabledDaysText,
  20905. format: me.format,
  20906. showToday: me.showToday,
  20907. showTime: me.showTime,
  20908. startDay: me.startDay,
  20909. minText: format(me.minText, me.formatDate(me.minValue)),
  20910. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  20911. listeners: {
  20912. scope: me,
  20913. select: me.onSelect
  20914. },
  20915. keyNavConfig: {
  20916. esc: function () {
  20917. me.collapse();
  20918. }
  20919. }
  20920. });
  20921. },
  20922. });
  20923. }
  20924. //# sourceMappingURL=datetimefield.js.map
  20925. function initNumber () {
  20926. var cc = Ext.form.field.Number.prototype.constructor;
  20927. var initComponent = Ext.form.field.Number.prototype.initComponent;
  20928. Ext.form.field.Number.override({
  20929. constructor: function (config) {
  20930. var newConfig = _$2.defaultsDeep({
  20931. // 强制属性
  20932. }, baseConfig(config, 'col-item'), config, numberfield);
  20933. cc.call(this, newConfig);
  20934. },
  20935. initComponent: function () {
  20936. this.on({
  20937. afterrender: function (sender) {
  20938. var _this = this;
  20939. var _a;
  20940. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  20941. sender.inputEl.dom.setAttribute('spellcheck', "false");
  20942. $$2(sender.inputEl.dom).on('click', function (e) {
  20943. sender.fireEvent('click', _this, e);
  20944. });
  20945. }
  20946. }
  20947. });
  20948. initComponent.call(this);
  20949. },
  20950. });
  20951. }
  20952. //# sourceMappingURL=numberfield.js.map
  20953. function initCheckbox () {
  20954. var cc = Ext.form.field.Checkbox.prototype.constructor;
  20955. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  20956. Ext.form.field.Checkbox.override({
  20957. constructor: function (config) {
  20958. var newConfig = _$2.defaultsDeep({
  20959. // 强制属性
  20960. }, baseConfig(config, 'col-item'), config, checkbox);
  20961. cc.call(this, newConfig);
  20962. },
  20963. getValue: function () {
  20964. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  20965. var ov = getValue.call(this);
  20966. // const ov = this.getRawValue()
  20967. return (ov ? checkedValue : uncheckedValue);
  20968. },
  20969. setValue: function (nv) {
  20970. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  20971. var value;
  20972. if (nv === checkedValue) {
  20973. value = true;
  20974. }
  20975. else if (nv === uncheckedValue) {
  20976. value = false;
  20977. }
  20978. else {
  20979. value = !!nv;
  20980. }
  20981. // me.setRawValue(value)
  20982. // me.checked = value
  20983. // return me.mixins.field.setValue.call(me, value);
  20984. setValue.call(this, value);
  20985. },
  20986. updateCheckedCls: function (checked) {
  20987. var me = this;
  20988. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  20989. checked = checked != null ? checked : me.getValue();
  20990. if (checked === uncheckedValue) {
  20991. checked = false;
  20992. }
  20993. else if (checked === checkedValue) {
  20994. checked = true;
  20995. }
  20996. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  20997. },
  20998. initComponent: function () {
  20999. initComponent.call(this);
  21000. },
  21001. });
  21002. }
  21003. //# sourceMappingURL=checkbox.js.map
  21004. function initCheckboxGroup () {
  21005. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21006. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21007. Ext.form.CheckboxGroup.override({
  21008. constructor: function (config) {
  21009. var newConfig = _$2.defaultsDeep({
  21010. // 强制属性
  21011. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21012. cc.call(this, newConfig);
  21013. },
  21014. initComponent: function () {
  21015. initComponent.call(this);
  21016. },
  21017. });
  21018. }
  21019. //# sourceMappingURL=checkboxgroup.js.map
  21020. function initRadio () {
  21021. var cc = Ext.form.field.Radio.prototype.constructor;
  21022. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21023. Ext.form.field.Radio.override({
  21024. constructor: function (config) {
  21025. var newConfig = _$2.defaultsDeep({
  21026. // 强制属性
  21027. }, baseConfig(config, 'col-item'), config, radio);
  21028. cc.call(this, newConfig);
  21029. },
  21030. initComponent: function () {
  21031. initComponent.call(this);
  21032. },
  21033. });
  21034. }
  21035. //# sourceMappingURL=radio.js.map
  21036. function initRadioGroup () {
  21037. var cc = Ext.form.RadioGroup.prototype.constructor;
  21038. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21039. Ext.form.RadioGroup.override({
  21040. constructor: function (config) {
  21041. var newConfig = _$2.defaultsDeep({
  21042. // 强制属性
  21043. }, baseConfig(config, 'col-item'), config, radiogroup);
  21044. cc.call(this, newConfig);
  21045. },
  21046. initComponent: function () {
  21047. initComponent.call(this);
  21048. },
  21049. });
  21050. }
  21051. //# sourceMappingURL=radiogroup.js.map
  21052. function initFieldset () {
  21053. /**
  21054. *
  21055. */
  21056. var ct = Ext.form.FieldSet.prototype.constructor;
  21057. Ext.form.FieldSet.override({
  21058. constructor: function (config) {
  21059. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21060. ct.call(this, newConfig);
  21061. }
  21062. });
  21063. }
  21064. //# sourceMappingURL=fieldset.js.map
  21065. function initCombotree () {
  21066. Ext.define('Yvan.ComboTree', {
  21067. extend: 'Ext.form.field.Picker',
  21068. xtype: 'combotree',
  21069. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21070. config: {
  21071. store: null,
  21072. displayField: null,
  21073. columns: null,
  21074. selectOnTab: true,
  21075. maxPickerHeight: 300,
  21076. minPickerHeight: 100,
  21077. minPickerWidth: 350,
  21078. rootVisible: true,
  21079. },
  21080. editable: false,
  21081. setStore: function (store) {
  21082. this.store = store;
  21083. var me = this;
  21084. if (me.store) {
  21085. if (me.picker) {
  21086. me.picker.setStore(store);
  21087. if (me.isExpanded) {
  21088. me.collapse();
  21089. delete me.picker;
  21090. me.expand();
  21091. }
  21092. }
  21093. this.onLoad();
  21094. me.mon(me.store, {
  21095. scope: me,
  21096. load: me.onLoad,
  21097. update: me.onUpdate
  21098. });
  21099. }
  21100. },
  21101. createPicker: function () {
  21102. var me = this;
  21103. var picker = new Ext.tree.Panel({
  21104. border: false,
  21105. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21106. shrinkWrapDock: 2,
  21107. store: me.store,
  21108. floating: true,
  21109. rootVisible: me.rootVisible,
  21110. displayField: me.displayField,
  21111. columns: me.columns,
  21112. minHeight: me.minPickerHeight,
  21113. maxHeight: me.maxPickerHeight,
  21114. minWidth: me.minPickerWidth,
  21115. manageHeight: false,
  21116. shadow: false,
  21117. scrollable: true,
  21118. // modal: true,
  21119. // constrain: true,
  21120. // constrainTo: topScope._handle.el.dom,
  21121. // renderTo: topScope._handle.el.dom,
  21122. // alignTarget: topScope._handle,
  21123. listeners: {
  21124. scope: me,
  21125. itemclick: me.onItemClick,
  21126. itemkeydown: me.onPickerKeyDown
  21127. }
  21128. }), view = picker.getView();
  21129. if (Ext.isIE9 && Ext.isStrict) {
  21130. view.on({
  21131. scope: me,
  21132. highlightitem: me.repaintPickerView,
  21133. unhighlightitem: me.repaintPickerView,
  21134. afteritemexpand: me.repaintPickerView,
  21135. afteritemcollapse: me.repaintPickerView
  21136. });
  21137. }
  21138. return picker;
  21139. },
  21140. repaintPickerView: function () {
  21141. var style = this.picker.getView().getEl().dom.style;
  21142. style.display = style.display;
  21143. },
  21144. onItemClick: function (view, record, node, rowIndex, e) {
  21145. this.selectItem(view, record);
  21146. },
  21147. onPickerKeyDown: function (treeView, record, item, index, e) {
  21148. var key = e.getKey();
  21149. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21150. this.selectItem(treeView, record);
  21151. }
  21152. },
  21153. selectItem: function (sender, record) {
  21154. var me = this;
  21155. me.setValue(record.getId());
  21156. me.fireEvent('select', me, record);
  21157. me.collapse();
  21158. },
  21159. onExpand: function () {
  21160. var picker = this.picker;
  21161. var store = picker.store;
  21162. var value = this.value;
  21163. var node;
  21164. if (value) {
  21165. node = store.getNodeById(value);
  21166. }
  21167. if (!node) {
  21168. node = store.getRoot();
  21169. }
  21170. picker.ensureVisible(node, {
  21171. select: true,
  21172. focus: true
  21173. });
  21174. },
  21175. setValue: function (value) {
  21176. var me = this;
  21177. console.log('setValue', value);
  21178. me.value = value;
  21179. if (!me.store || me.store.loading) {
  21180. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21181. return me.mixins.field.setValue.call(me, value);
  21182. // return me;
  21183. }
  21184. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21185. if (value === undefined) {
  21186. record = me.store.getRoot();
  21187. console.log('setValue', record.getId());
  21188. me.value = record.getId();
  21189. return me.mixins.field.setValue.call(me, value);
  21190. }
  21191. else {
  21192. record = me.store.getNodeById(value);
  21193. }
  21194. // set the raw value to the record's display field if a record was found
  21195. me.setRawValue(record ? record.get(me.displayField) : '');
  21196. return me.mixins.field.setValue.call(me, value);
  21197. },
  21198. getSubmitValue: function () {
  21199. return this.value;
  21200. },
  21201. getValue: function () {
  21202. return this.value;
  21203. },
  21204. onLoad: function () {
  21205. var value = this.value;
  21206. if (value) {
  21207. this.setValue(value);
  21208. }
  21209. },
  21210. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21211. var display = this.displayField;
  21212. var me = this;
  21213. if (type === 'edit' && modifiedFieldNames &&
  21214. Ext.Array.contains(modifiedFieldNames, display) &&
  21215. this.value === rec.getId()) {
  21216. me.mixins.field.setValue.call(me, this.value);
  21217. this.setRawValue(rec.get(display));
  21218. }
  21219. }
  21220. });
  21221. }
  21222. //# sourceMappingURL=combotree.js.map
  21223. function initPickerPlus () {
  21224. Ext.define('Yvan.PickerAlignCenter', {
  21225. extend: 'Ext.form.field.Picker',
  21226. /**
  21227. * Performs the alignment on the picker using the class defaults
  21228. * @private
  21229. */
  21230. doAlign: function () {
  21231. // 不要挪动就好
  21232. },
  21233. });
  21234. }
  21235. //# sourceMappingURL=pickerplus.js.map
  21236. function initCombogrid () {
  21237. Ext.define('Yvan.ComboGrid', {
  21238. extend: 'Ext.form.field.Picker',
  21239. // extend: 'Yvan.PickerAlignCenter',
  21240. xtype: 'combogrid',
  21241. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21242. triggers: {
  21243. clear: {
  21244. weight: 0,
  21245. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21246. hidden: true,
  21247. handler: 'onClearClick',
  21248. },
  21249. },
  21250. config: __assign({}, comboGrid),
  21251. editable: true,
  21252. _superBlur: false,
  21253. allowCustomInput: false,
  21254. pressEnterPopup: true,
  21255. initComponent: function () {
  21256. var that = this;
  21257. var scope = lookupScope(that);
  21258. var config = that.config;
  21259. if (isDesignMode(scope, config)) {
  21260. this.superclass.initComponent.call(this, arguments);
  21261. return;
  21262. }
  21263. this.on({
  21264. blur: function (sender, e) {
  21265. if (this._superBlur) {
  21266. // 挂起时不恢复内容
  21267. return;
  21268. }
  21269. // 离开焦点时,恢复原来的值
  21270. sender.setRawValue(sender.value);
  21271. },
  21272. afterrender: function (sender) {
  21273. var $dom = $(sender.inputEl.dom);
  21274. that.scope = lookupScope(sender);
  21275. if (sender.column) {
  21276. // 列模式,拦截 keydown
  21277. $dom.on('keydown', function (e) {
  21278. if (isChartEvent(e) && !that.tryEnable()) {
  21279. // 没有达成 editEnable 条件,不用响应
  21280. stopEvent(e);
  21281. return;
  21282. }
  21283. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21284. stopEvent(e);
  21285. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21286. return;
  21287. }
  21288. });
  21289. }
  21290. else {
  21291. // 常规模式,拦截 keyup
  21292. $dom.on('keyup', function (e) {
  21293. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21294. return;
  21295. }
  21296. if (isChartEvent(e) && !that.tryEnable()) {
  21297. // 没有达成 editEnable 条件,不用响应
  21298. stopEvent(e);
  21299. return;
  21300. }
  21301. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21302. stopEvent(e);
  21303. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21304. return;
  21305. }
  21306. if (!that.allowCustomInput) {
  21307. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21308. stopEvent(e);
  21309. }
  21310. });
  21311. $dom.on('change', function (e) {
  21312. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21313. // if (that.isExpanded) {
  21314. // that.filterChange(that, e.target.value)
  21315. // }
  21316. stopEvent(e);
  21317. });
  21318. }
  21319. $dom.on('input', function (e) {
  21320. stopEvent(e);
  21321. });
  21322. },
  21323. });
  21324. this.superclass.initComponent.apply(this, arguments);
  21325. },
  21326. createPicker: function () {
  21327. var me = this;
  21328. var cfg = {
  21329. layout: 'fit',
  21330. border: 0,
  21331. // border: 5,
  21332. style: {
  21333. // borderColor: 'black',
  21334. // borderWidth: '5px',
  21335. // borderStyle: 'solid',
  21336. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21337. },
  21338. shadow: 'side',
  21339. shadowOffset: 100,
  21340. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21341. shrinkWrapDock: 2,
  21342. floating: true,
  21343. width: me.pickerWidth,
  21344. height: me.pickerHeight,
  21345. minWidth: me.pickerWidth,
  21346. minHeight: me.pickerHeight,
  21347. maxWidth: me.pickerWidth,
  21348. maxHeight: me.pickerHeight,
  21349. items: [
  21350. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21351. xtype: 'toolbar',
  21352. items: [
  21353. { xtype: 'textfield', fieldLabel: '筛选' },
  21354. {
  21355. xtype: 'button',
  21356. text: '查询',
  21357. iconCls: 'x-fa fa-search',
  21358. cssType: 'primary',
  21359. listeners: {
  21360. click: function () {
  21361. me.reloadGrid();
  21362. }
  21363. }
  21364. },
  21365. ]
  21366. }, autoLoad: false, listeners: {
  21367. afterrender: function (grid) {
  21368. me.grid = grid;
  21369. grid.focus();
  21370. grid.on({
  21371. rowdblclick: function (sender, row) {
  21372. me.selectItem(row);
  21373. },
  21374. dataLoadComplete: function (sender) {
  21375. _$2.defer(function () {
  21376. me.setFocus();
  21377. });
  21378. },
  21379. keydown: function (sender, e) {
  21380. if (me.column) {
  21381. // 列模式,拦截 keydown
  21382. me.processKey(e);
  21383. }
  21384. },
  21385. keyup: function (sender, e) {
  21386. if (!me.column) {
  21387. // 常规模式,拦截 keyup
  21388. me.processKey(e);
  21389. }
  21390. }
  21391. });
  21392. },
  21393. } })
  21394. ]
  21395. };
  21396. // @ts-ignore
  21397. var picker = new Ext.container.Container(cfg);
  21398. return picker;
  21399. },
  21400. setFocus: function () {
  21401. if (this.grid.store.getCount() > 0) {
  21402. this.grid.focusRow(0);
  21403. }
  21404. },
  21405. processKey: function (e) {
  21406. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21407. this.selectItem(this.grid.selection);
  21408. stopEvent(e);
  21409. }
  21410. else if (e.key === 'Escape') {
  21411. this.collapse();
  21412. }
  21413. },
  21414. repaintPickerView: function () {
  21415. var style = this.picker.getView().getEl().dom.style;
  21416. style.display = style.display;
  21417. },
  21418. onItemClick: function (view, record, node, rowIndex, e) {
  21419. this.selectItem(record);
  21420. },
  21421. onPickerKeyDown: function (treeView, record, item, index, e) {
  21422. var key = e.getKey();
  21423. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21424. this.selectItem(record);
  21425. }
  21426. },
  21427. filterChange: _$2.debounce(function (sender, value) {
  21428. sender.onExpand();
  21429. }, 1000),
  21430. selectItem: function (record) {
  21431. var me = this;
  21432. var lookup = this.lookup;
  21433. var scope = lookupScope(this);
  21434. me.fireEvent('select', me, record);
  21435. if (record.isModel) {
  21436. record = record.data;
  21437. }
  21438. tryWriteObject(lookup, record, function (path, value) {
  21439. me._lookupSet(path, value);
  21440. });
  21441. // lookup
  21442. // fromColumn: 'toTarget'
  21443. // fromColumn: 'toTarget'
  21444. // fromColumn: 'toTarget'
  21445. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21446. var value = _$2.get(record, fromColumn);
  21447. me._lookupSet(toTarget, value);
  21448. });
  21449. // 选定之后不能做清空
  21450. // const {lookupClearOnChange} = me
  21451. // if (_.isArray(lookupClearOnChange)) {
  21452. // _.each(lookupClearOnChange, item => {
  21453. // me._lookupSet(item, '')
  21454. // })
  21455. // }
  21456. me.collapse();
  21457. // 触发 _raiseNextFocus
  21458. me._raiseNextFocus(me);
  21459. },
  21460. onExpand: function () {
  21461. // 展开时,根据 lookup 带入查询参数
  21462. var expressData = this.getExpressData();
  21463. var txtField = this.grid.down('toolbar').down('textfield');
  21464. txtField.setValue(expressData.queryValue);
  21465. this.reloadGrid();
  21466. },
  21467. reloadGrid: function () {
  21468. // 展开时,根据 lookup 带入查询参数
  21469. var expressData = this.getExpressData();
  21470. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21471. var txtField = this.grid.down('toolbar').down('textfield');
  21472. // 每个 combogrid 默认带上 __queryValue 属性
  21473. reloadParam["__queryValue"] = txtField.getValue();
  21474. this.grid.reload(reloadParam);
  21475. },
  21476. onTriggerClick: function (sender) {
  21477. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21478. if (!grid) {
  21479. msg('正在初始化,请稍后');
  21480. return;
  21481. }
  21482. if (!this.tryEnable()) {
  21483. // 没有达成 editEnable 条件,不用弹出
  21484. return;
  21485. }
  21486. if (isExpanded || readOnly || disabled) {
  21487. // 已弹出、只读、禁用状态下,不允许弹出
  21488. return;
  21489. }
  21490. this._superBlur = true;
  21491. this.superclass.onTriggerClick.apply(this, arguments);
  21492. this._superBlur = false;
  21493. },
  21494. onCollapse: function () {
  21495. // 每次收回时,删除下拉组件
  21496. // delete this.picker
  21497. },
  21498. /**
  21499. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21500. */
  21501. setValue: function (value) {
  21502. var me = this;
  21503. // 设值用户看到的表面内容
  21504. this.setRawValue(value);
  21505. // 设值 setValue 调用链,正常触发 change 事件等
  21506. return me.mixins.field.setValue.call(me, value);
  21507. },
  21508. _lookupSet: function (path, value) {
  21509. var me = this;
  21510. path = tryVarSimple(path);
  21511. if (me.column) {
  21512. // 判断写入目标,是否与自己绑定的属性相等
  21513. if (path === 'queryValue' || me.column.dataIndex === path) {
  21514. me.setValue(value);
  21515. }
  21516. // 列模式下,写当前编辑行
  21517. var parentRecord = me._lookupEditorRecord();
  21518. if (parentRecord) {
  21519. // Ext.data.Record / Ext.data.Model
  21520. parentRecord.set(path, value);
  21521. }
  21522. else {
  21523. debugger;
  21524. }
  21525. }
  21526. else {
  21527. // 常规模式下,写 viewModel
  21528. me.scope.viewModel.set(path, value);
  21529. }
  21530. },
  21531. _lookupGrid: function () {
  21532. return this.column.up('grid');
  21533. },
  21534. _lookupEditorRecord: function () {
  21535. var _a, _b, _c, _d;
  21536. // parentGrid.getSelectionModel().getLastSelected()
  21537. var grid = this._lookupGrid();
  21538. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21539. if (!editingPlugin) {
  21540. return grid.getSelectionModel().getLastSelected();
  21541. }
  21542. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21543. if (_$2.isNumber(rowIdx)) {
  21544. return grid.store.getAt(rowIdx);
  21545. }
  21546. else {
  21547. return grid.getSelectionModel().getLastSelected();
  21548. }
  21549. },
  21550. onChange: function (newVal, oldVal) {
  21551. var me = this;
  21552. var value = newVal;
  21553. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21554. if (hideTrigger || disabled || readOnly || hideClear) {
  21555. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21556. return;
  21557. }
  21558. if (value) {
  21559. me.getTrigger('clear').show();
  21560. me.updateLayout();
  21561. }
  21562. else {
  21563. me.getTrigger('clear').hide();
  21564. me.updateLayout();
  21565. }
  21566. },
  21567. /**
  21568. * 得到能用于 express 表达式计算的上下文数据
  21569. */
  21570. getExpressData: function () {
  21571. var queryValue = this.getRawValue();
  21572. if (!queryValue) {
  21573. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21574. queryValue = this.getPicker().down('textfield').getRawValue();
  21575. }
  21576. if (this.column) {
  21577. // 列模式, 准备好判断 editEnable 表达式用的数据
  21578. var parentRecord = this._lookupEditorRecord();
  21579. if (!parentRecord) {
  21580. debugger;
  21581. }
  21582. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21583. }
  21584. else {
  21585. // 编辑模式,准备好判断用的数据
  21586. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21587. }
  21588. },
  21589. tryEnable: function () {
  21590. return tryEnable(this.getExpressData(), this.editEnable);
  21591. },
  21592. /**
  21593. * 清空所有值
  21594. */
  21595. onClearClick: function (sender, e) {
  21596. var me = this;
  21597. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21598. me.fireEvent('clear', sender, e);
  21599. me.setValue('');
  21600. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21601. me._lookupSet(toTarget, '');
  21602. });
  21603. _$2.each(lookupClearOnChange, function (item) {
  21604. me._lookupSet(item, '');
  21605. });
  21606. }
  21607. });
  21608. }
  21609. //# sourceMappingURL=combogrid.js.map
  21610. function initContainer () {
  21611. var cc = Ext.container.Container.prototype.constructor;
  21612. //const {initComponent} = Ext.container.Container.prototype
  21613. Ext.container.Container.override({
  21614. constructor: function (config) {
  21615. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21616. cc.call(this, newConfig);
  21617. },
  21618. });
  21619. }
  21620. //# sourceMappingURL=container.js.map
  21621. function initRows () {
  21622. Ext.define('Yvan.Rows', {
  21623. extend: 'Ext.container.Container',
  21624. xtype: 'rows',
  21625. constructor: function (config) {
  21626. var self = this;
  21627. var newConfig = _$2.defaultsDeep({
  21628. // 强制性属性
  21629. layout: 'anchor', border: false,
  21630. defaults: {
  21631. border: false, anchor: '100%',
  21632. margin: '0 0 5 0',
  21633. },
  21634. }, baseConfig(config, 'rows-container'), config, rows);
  21635. this.superclass.constructor.call(self, newConfig);
  21636. },
  21637. });
  21638. }
  21639. //# sourceMappingURL=rows.js.map
  21640. function initForm () {
  21641. var ct = Ext.form.Panel.prototype.constructor;
  21642. Ext.form.Panel.override({
  21643. constructor: function (config) {
  21644. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21645. ct.call(this, newConfig);
  21646. }
  21647. });
  21648. }
  21649. //# sourceMappingURL=form.js.map
  21650. function initCols () {
  21651. Ext.define('Yvan.Cols', {
  21652. extend: 'Ext.container.Container',
  21653. xtype: 'cols',
  21654. constructor: function (config) {
  21655. var self = this;
  21656. var newConfig = _$2.defaultsDeep({
  21657. // 强制性属性
  21658. layout: 'hbox',
  21659. minHeight: config.designMode ? 32 : 0
  21660. }, baseConfig(config, 'cols-container'), config, cols);
  21661. this.superclass.constructor.call(self, newConfig);
  21662. },
  21663. });
  21664. }
  21665. //# sourceMappingURL=cols.js.map
  21666. function initButton () {
  21667. /**
  21668. *
  21669. */
  21670. var ct = Ext.button.Button.prototype.constructor;
  21671. Ext.button.Button.override({
  21672. constructor: function (config) {
  21673. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21674. ct.call(this, newConfig);
  21675. },
  21676. setLoading: function (value) {
  21677. if (value) {
  21678. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21679. this._originIconCls = this.iconCls;
  21680. }
  21681. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21682. this.setDisabled(true);
  21683. }
  21684. else {
  21685. this.setIconCls(this._originIconCls);
  21686. this.setDisabled(false);
  21687. }
  21688. }
  21689. });
  21690. }
  21691. //# sourceMappingURL=button.js.map
  21692. function initIframe () {
  21693. Ext.define('Ext.ux.IFrame', {
  21694. extend: 'Ext.Component',
  21695. alias: 'widget.uxiframe',
  21696. loadMask: 'Loading...',
  21697. src: 'about:blank',
  21698. renderTpl: [
  21699. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21700. ],
  21701. childEls: ['iframeEl'],
  21702. initComponent: function () {
  21703. this.superclass.initComponent.call(this);
  21704. this.superclass.initEvents.call(this);
  21705. this.frameName = this.frameName || this.id + '-frame';
  21706. },
  21707. initEvents: function () {
  21708. var me = this;
  21709. this.superclass.initEvents.call(this);
  21710. me.iframeEl.on('load', me.onLoad, me);
  21711. },
  21712. initRenderData: function () {
  21713. return Ext.apply(this.superclass.initRenderData.call(this), {
  21714. src: this.src,
  21715. frameName: this.frameName
  21716. });
  21717. },
  21718. getBody: function () {
  21719. var doc = this.getDoc();
  21720. return doc.body || doc.documentElement;
  21721. },
  21722. getDoc: function () {
  21723. try {
  21724. return this.getWin().document;
  21725. }
  21726. catch (ex) {
  21727. return null;
  21728. }
  21729. },
  21730. getWin: function () {
  21731. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21732. return win;
  21733. },
  21734. getFrame: function () {
  21735. var me = this;
  21736. return me.iframeEl.dom;
  21737. },
  21738. onLoad: function () {
  21739. var me = this, doc = me.getDoc();
  21740. if (doc) {
  21741. this.el.unmask();
  21742. this.fireEvent('load', this);
  21743. }
  21744. else if (me.src) {
  21745. this.el.unmask();
  21746. this.fireEvent('error', this);
  21747. }
  21748. },
  21749. load: function (src) {
  21750. var me = this, text = me.loadMask, frame = me.getFrame();
  21751. if (me.fireEvent('beforeload', me, src) !== false) {
  21752. if (text && me.el) {
  21753. me.el.mask(text);
  21754. }
  21755. frame.src = me.src = (src || me.src);
  21756. }
  21757. }
  21758. });
  21759. }
  21760. //# sourceMappingURL=iframe.js.map
  21761. /**
  21762. * 属性:
  21763. * - autoLoad: true
  21764. * - dataSource: ''
  21765. * 方法:
  21766. * - handleZoomBig
  21767. * - handleZoomSmall
  21768. * - handleZoomReset
  21769. * - openDiagram
  21770. * - getBpmn
  21771. * - getBpmnCanvas
  21772. * - getBpmnOverlays
  21773. * - getBpmnZoomScroll
  21774. * 事件:
  21775. * - initFinish
  21776. * - failed
  21777. * - success
  21778. * - itemHover
  21779. * - itemOut
  21780. * - itemClick
  21781. * - itemDblclick
  21782. * - itemMousedown
  21783. * - itemMouseup
  21784. */
  21785. function initBpmn () {
  21786. Ext.define('Yvan.Bpmn', {
  21787. // extend: 'Ext.container.Container',
  21788. extend: 'Ext.panel.Panel',
  21789. alias: 'widget.bpmn',
  21790. xtype: 'bpmn',
  21791. constructor: function (config) {
  21792. var self = this;
  21793. var newConfig = _$2.defaultsDeep({
  21794. // 强制性属性
  21795. }, baseConfig(config, 'row-item'), config, bpmn);
  21796. if (!newConfig.hideToolbar) {
  21797. newConfig.tbar = [];
  21798. newConfig.tbar.push({
  21799. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21800. listeners: {
  21801. click: function (sender) {
  21802. self.reload();
  21803. }
  21804. }
  21805. });
  21806. newConfig.tbar.push({
  21807. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21808. listeners: {
  21809. click: function (sender) {
  21810. self.handleZoomBig();
  21811. }
  21812. },
  21813. });
  21814. newConfig.tbar.push({
  21815. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21816. listeners: {
  21817. click: function (sender) {
  21818. self.handleZoomSmall();
  21819. }
  21820. },
  21821. });
  21822. newConfig.tbar.push({
  21823. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21824. listeners: {
  21825. click: function (sender) {
  21826. self.handleZoomReset();
  21827. }
  21828. },
  21829. });
  21830. }
  21831. this.superclass.constructor.call(self, newConfig);
  21832. },
  21833. initComponent: function () {
  21834. var _this = this;
  21835. var me = this;
  21836. var config = me.config;
  21837. var scope = lookupScope(this);
  21838. if (!isDesignMode(scope, config)) {
  21839. //@ts-ignore
  21840. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21841. console.log('BpNavigated', me, BpNavigated);
  21842. var dom = me.el.dom;
  21843. var $dom = $(dom);
  21844. var $container = $dom.find('.x-autocontainer-innerCt');
  21845. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21846. _this._bpmn = bpmn;
  21847. if (_this.autoLoad) {
  21848. _this.reload();
  21849. }
  21850. _this.fireEvent('initFinish', _this);
  21851. var eventBus = bpmn.get('eventBus');
  21852. eventBus.on('element.hover', function (e) {
  21853. // this.fireEvent('itemHover', this, e);
  21854. });
  21855. eventBus.on('element.out', function (e) {
  21856. _this.fireEvent('itemOut', _this, e);
  21857. });
  21858. eventBus.on('element.click', function (e) {
  21859. _this.fireEvent('itemClick', _this, e);
  21860. });
  21861. eventBus.on('element.dblclick', function (e) {
  21862. _this.fireEvent('itemDblclick', _this, e);
  21863. });
  21864. eventBus.on('element.mousedown', function (e) {
  21865. _this.fireEvent('itemMousedown', _this, e);
  21866. });
  21867. eventBus.on('element.mouseup', function (e) {
  21868. _this.fireEvent('itemMouseup', _this, e);
  21869. });
  21870. });
  21871. }
  21872. this.superclass.initComponent.call(this);
  21873. this.on({
  21874. afterrender: function (sender) {
  21875. }
  21876. });
  21877. },
  21878. /**
  21879. * 重新载入
  21880. */
  21881. reload: function () {
  21882. var _this = this;
  21883. var _a;
  21884. if (typeof this.dataSource === 'string' && this.dataSource) {
  21885. var scope = lookupScope(this);
  21886. var fn = lookupFn(scope, this.dataSource);
  21887. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  21888. _this.openDiagram(res.data);
  21889. });
  21890. }
  21891. },
  21892. /**
  21893. * 获取bpmn
  21894. */
  21895. getBpmn: function () {
  21896. return this._bpmn;
  21897. },
  21898. getBpmnCanvas: function () {
  21899. var _a;
  21900. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  21901. },
  21902. getBpmnOverlays: function () {
  21903. var _a;
  21904. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  21905. },
  21906. getBpmnZoomScroll: function () {
  21907. var _a;
  21908. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  21909. },
  21910. handleZoomBig: function () {
  21911. var _a;
  21912. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  21913. },
  21914. handleZoomSmall: function () {
  21915. var _a;
  21916. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  21917. },
  21918. handleZoomReset: function () {
  21919. var _a;
  21920. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  21921. },
  21922. openDiagram: function (diagram) {
  21923. var _this = this;
  21924. if (!this.getBpmn()) {
  21925. return;
  21926. }
  21927. this.getBpmn().importXML(diagram, function (err) {
  21928. if (err) {
  21929. // YvEventDispatch(this.onFailed, this, undefined);
  21930. _this.fireEvent('failed', _this, err);
  21931. return console.error('could not import BPMN 2.0 diagram', err);
  21932. }
  21933. // zoom to fit full viewport
  21934. _this.getBpmnCanvas().zoom('fit-viewport');
  21935. _this.fireEvent('success', _this);
  21936. });
  21937. },
  21938. });
  21939. }
  21940. //# sourceMappingURL=bpmn.js.map
  21941. function initSqlComplex () {
  21942. Ext.define('Yvan.SqlComplex', {
  21943. extend: 'Ext.panel.Panel',
  21944. xtype: 'sqlcomplex',
  21945. alias: 'widget.sqlcomplex',
  21946. getSqlExpress: function () {
  21947. },
  21948. constructor: function (config) {
  21949. var reference = config.reference;
  21950. var me = this;
  21951. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  21952. {
  21953. region: 'west',
  21954. width: 280,
  21955. border: false,
  21956. split: true,
  21957. reference: reference + '_tree',
  21958. xtype: 'yvtree',
  21959. hideRefresh: true,
  21960. hideExpand: true,
  21961. hideCollapse: true,
  21962. listeners: {
  21963. itemdblclick: function (sender, record, item, index, e) {
  21964. var field = record.get('field');
  21965. var defaultValue = record.get('defaultValue');
  21966. if (!field) {
  21967. return;
  21968. }
  21969. var tabExpress = me.down('tabpanel');
  21970. var sqleditor = me.down('sqleditor');
  21971. var expressGrid = me.down('yvgrid');
  21972. if (tabExpress.getActiveTab().key !== 'grid') {
  21973. // SQL 模式
  21974. sqleditor.insertText(field + '=');
  21975. }
  21976. else {
  21977. // 表格模式
  21978. expressGrid.appendEditRow({
  21979. field: field,
  21980. operator: '=',
  21981. value: defaultValue,
  21982. remark: '',
  21983. });
  21984. _$2.defer(function () {
  21985. gridChanged(me, expressGrid);
  21986. });
  21987. }
  21988. }
  21989. },
  21990. },
  21991. {
  21992. region: 'center',
  21993. xtype: 'tabpanel',
  21994. reference: reference + '_tab',
  21995. tabPosition: 'bottom',
  21996. listeners: {
  21997. afterrender: function (sender) {
  21998. var scope = lookupScope(me);
  21999. var value = scope.viewModel.get(me.config.bindValue);
  22000. // sql 转换为 grid
  22001. try {
  22002. var list_1 = parseSqlToGrid(value);
  22003. _$2.defer(function () {
  22004. var grid = me.down('yvgrid');
  22005. grid.setData(list_1);
  22006. });
  22007. }
  22008. catch (e) {
  22009. console.error(e);
  22010. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22011. var tabSql = sender.down('sqleditor');
  22012. sender.setActiveTab(tabSql);
  22013. }
  22014. },
  22015. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22016. var scope = lookupScope(me);
  22017. var value = scope.viewModel.get(me.config.bindValue);
  22018. if (newCard.key === 'grid') {
  22019. // sql 转换为 grid
  22020. try {
  22021. var list_2 = parseSqlToGrid(value);
  22022. _$2.defer(function () {
  22023. var grid = me.down('yvgrid');
  22024. grid.setData(list_2);
  22025. });
  22026. return true;
  22027. }
  22028. catch (e) {
  22029. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22030. console.error(e);
  22031. return false;
  22032. }
  22033. }
  22034. else if (newCard.key === 'sql') {
  22035. // grid 转换为 sql
  22036. _$2.defer(function () {
  22037. var editor = me.down('sqleditor');
  22038. editor.setValue(value);
  22039. });
  22040. return true;
  22041. }
  22042. }
  22043. },
  22044. items: [
  22045. {
  22046. title: '表格模式',
  22047. key: 'grid',
  22048. xtype: 'yvgrid',
  22049. _mode: 'select',
  22050. reference: reference + '_grid',
  22051. hideFootbar: true,
  22052. pagination: false,
  22053. tbar: [
  22054. {
  22055. xtype: 'button',
  22056. text: '删除',
  22057. iconCls: 'x-fa fa-minus-circle',
  22058. cls: 'ext-btn-danger',
  22059. bind: {
  22060. disabled: '{!' + reference + '_grid.selection}',
  22061. },
  22062. listeners: {
  22063. click: function (sender) {
  22064. var grid = sender.up('yvgrid');
  22065. removeGridRow(grid);
  22066. gridChanged(me, grid);
  22067. }
  22068. },
  22069. },
  22070. ],
  22071. store: {},
  22072. listeners: {
  22073. editfinish: function (sender) {
  22074. gridChanged(me, sender);
  22075. },
  22076. },
  22077. columns: [
  22078. {
  22079. dataIndex: 'field',
  22080. header: '字段', sortable: false, menuDisabled: true,
  22081. width: 190,
  22082. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22083. var column = context.column;
  22084. var propertyConfig = me.config.propertyConfig;
  22085. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22086. var field = record.get('field');
  22087. if (field) {
  22088. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22089. if (idx >= 0) {
  22090. var meta = propertyConfig[idx];
  22091. return meta.text;
  22092. }
  22093. }
  22094. return value;
  22095. }
  22096. },
  22097. {
  22098. dataIndex: 'operator',
  22099. header: '运算符', sortable: false, menuDisabled: true,
  22100. dict: 'operator',
  22101. width: 65,
  22102. editor: { xtype: 'combo' },
  22103. },
  22104. {
  22105. dataIndex: 'value',
  22106. header: '值', sortable: false, menuDisabled: true,
  22107. flex: 1,
  22108. getEditor: function (record) {
  22109. var column = this;
  22110. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22111. var propertyConfig = me.config.propertyConfig;
  22112. var field = record.get('field');
  22113. if (!field) {
  22114. // 没有填 propertyName
  22115. return;
  22116. }
  22117. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22118. if (idx < 0) {
  22119. console.error('没有找到 field=' + field + ". propertyConfig");
  22120. return;
  22121. }
  22122. var meta = propertyConfig[idx];
  22123. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22124. return new Ext.grid.CellEditor({
  22125. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22126. });
  22127. }
  22128. return new Ext.grid.CellEditor({
  22129. field: __assign({ dict: meta.dict }, meta.editor)
  22130. });
  22131. },
  22132. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22133. var column = context.column;
  22134. var grid = _$2.get(view, 'ownerGrid');
  22135. var propertyConfig = me.config.propertyConfig;
  22136. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22137. var field = record.get('field');
  22138. if (field) {
  22139. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22140. if (idx >= 0) {
  22141. var meta = propertyConfig[idx];
  22142. var dictName = _$2.get(meta, 'dict');
  22143. if (dictName && window['DICT_CACHE'][dictName]) {
  22144. var dict_1 = window['DICT_CACHE'][dictName];
  22145. var valueText_1 = [];
  22146. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22147. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22148. if (idxKv >= 0) {
  22149. valueText_1.push(dict_1[idxKv].text);
  22150. }
  22151. else {
  22152. valueText_1.push(value);
  22153. }
  22154. });
  22155. return valueText_1.join(',');
  22156. }
  22157. }
  22158. }
  22159. return valueList;
  22160. },
  22161. },
  22162. ]
  22163. },
  22164. {
  22165. title: 'SQL模式',
  22166. key: 'sql',
  22167. xtype: 'sqleditor',
  22168. reference: reference + '_sql',
  22169. listeners: {
  22170. change: function (sender) {
  22171. var scope = lookupScope(me);
  22172. // 保存 editor 写入的值
  22173. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22174. }
  22175. }
  22176. },
  22177. ]
  22178. }
  22179. ] });
  22180. this.superclass.constructor.call(this, newConfig);
  22181. },
  22182. initComponent: function () {
  22183. // 货位条件树
  22184. var me = this;
  22185. me.superclass.initComponent.apply(this, arguments);
  22186. var tree = this.down('yvtree');
  22187. var config = me.config;
  22188. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22189. },
  22190. });
  22191. function gridChanged(me, grid) {
  22192. var data = grid.getDataRows();
  22193. var propertyConfig = me.config.propertyConfig;
  22194. var bindValue = me.config.bindValue;
  22195. var scope = lookupScope(me);
  22196. var sql = parseGridToSql(data);
  22197. scope.viewModel.set(bindValue, sql);
  22198. }
  22199. /**
  22200. * 用于从 propertyConfig 解析出树形结构
  22201. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22202. * ->
  22203. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22204. */
  22205. function buildConfigTree(propertyConfig) {
  22206. var root = {
  22207. expanded: true,
  22208. leaf: false,
  22209. children: []
  22210. };
  22211. var categoryObj = {};
  22212. var cfgList = propertyConfig;
  22213. _$2.forEach(cfgList, function (cfg) {
  22214. var cateNode = categoryObj[cfg.category];
  22215. if (!cateNode) {
  22216. cateNode = {
  22217. text: cfg.category, expanded: true, leaf: false,
  22218. children: []
  22219. };
  22220. categoryObj[cfg.category] = cateNode;
  22221. root.children.push(cateNode);
  22222. }
  22223. cateNode.children.push({
  22224. text: cfg.text,
  22225. field: cfg.field,
  22226. operator: cfg.operator,
  22227. defaultValue: cfg.defaultValue,
  22228. leaf: true,
  22229. });
  22230. });
  22231. return root;
  22232. }
  22233. /**
  22234. * 将表格变成 SQL where语句 [
  22235. * {field: 'f1', value: 1, operator: '='}
  22236. * {field: 'f2', value: 2, operator: '='}
  22237. * {field: 'f3', value: '3', operator: '>='}
  22238. * {field: 'f4', value: 4, operator: '='}
  22239. * ]
  22240. * ->
  22241. * f1=v1 and f2=v2
  22242. */
  22243. function parseGridToSql(list) {
  22244. var sqls = [];
  22245. _$2.forEach(list, function (i) {
  22246. var _a;
  22247. if (i.operator === 'in') {
  22248. sqls.push(i.field + ' in (' + (i.value) + ')');
  22249. }
  22250. else if (i.operator === 'notIn') {
  22251. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22252. }
  22253. else {
  22254. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22255. }
  22256. });
  22257. return sqls.join(' AND ');
  22258. }
  22259. /**
  22260. * 将 SQL 语句的 where 片段变成表格
  22261. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22262. * @return [
  22263. {field: 'f1', value: 1, operator: '='}
  22264. {field: 'f2', value: 2, operator: '='}
  22265. {field: 'f3', value: '3', operator: '>='}
  22266. {field: 'f4', value: 4, operator: '='}
  22267. ]
  22268. */
  22269. function parseSqlToGrid(sql) {
  22270. if (!sql || !_$2.trim(sql)) {
  22271. return [];
  22272. }
  22273. var parser = new window['NodeSQLParser'].Parser();
  22274. var ast = parser.astify('select * from dual where ' + sql);
  22275. var ret = [];
  22276. exp(ast.where, ret);
  22277. return ret;
  22278. }
  22279. function exp(ast, ret) {
  22280. if (ast.type === 'binary_expr') {
  22281. if (_$2.toUpper(ast.operator) === 'AND') {
  22282. if (ast.left.type === 'binary_expr') {
  22283. exp(ast.left, ret);
  22284. }
  22285. if (ast.right.type === 'binary_expr') {
  22286. exp(ast.right, ret);
  22287. }
  22288. }
  22289. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22290. if (ast.left.type === 'column_ref') {
  22291. if (ast.right.type === 'number' ||
  22292. ast.right.type === 'single_quote_string' ||
  22293. ast.right.type === 'double_quote_string') {
  22294. // 具体值相等
  22295. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22296. }
  22297. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22298. && ast.right.type === 'expr_list') {
  22299. // in / not in
  22300. var valueList_1 = [];
  22301. _$2.forEach(ast.right.value, function (item) {
  22302. valueList_1.push(item.value);
  22303. });
  22304. var operator = void 0;
  22305. if (_$2.toUpper(ast.operator) === 'IN') {
  22306. operator = 'in';
  22307. }
  22308. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22309. operator = 'notIn';
  22310. }
  22311. ret.push({
  22312. field: ast.left.column, value: valueList_1.join(','),
  22313. operator: operator
  22314. });
  22315. }
  22316. else {
  22317. throw new Error('ast.right must is value.');
  22318. }
  22319. }
  22320. else {
  22321. throw new Error('ast.left must is column_ref.');
  22322. }
  22323. }
  22324. else {
  22325. // 必须用 AND 条件符匹配
  22326. throw new Error('ast.operator must is "AND / =".');
  22327. }
  22328. }
  22329. else {
  22330. throw new Error('ast.type must is "binary_expr".');
  22331. }
  22332. }
  22333. /**
  22334. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22335. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22336. {
  22337. type: 'binary_expr',
  22338. operator: 'AND',
  22339. left: {
  22340. type: 'binary_expr',
  22341. operator: 'AND',
  22342. left: {
  22343. type: 'binary_expr',
  22344. operator: 'AND',
  22345. left: {
  22346. type: 'binary_expr',
  22347. operator: 'AND',
  22348. left: {
  22349. type: 'binary_expr',
  22350. operator: '=',
  22351. left: {
  22352. type: 'column_ref',
  22353. table: null,
  22354. column: 'f1'
  22355. },
  22356. right: {
  22357. type: 'number',
  22358. value: 1
  22359. }
  22360. },
  22361. right: {
  22362. type: 'binary_expr',
  22363. operator: '=',
  22364. left: {
  22365. type: 'column_ref',
  22366. table: null,
  22367. column: 'f2'
  22368. },
  22369. right: {
  22370. type: 'number',
  22371. value: 2
  22372. }
  22373. }
  22374. },
  22375. right: {
  22376. type: 'binary_expr',
  22377. operator: '=',
  22378. left: {
  22379. type: 'column_ref',
  22380. table: null,
  22381. column: 'f3'
  22382. },
  22383. right: {
  22384. type: 'single_quote_string',
  22385. value: '3'
  22386. }
  22387. }
  22388. },
  22389. right: {
  22390. type: 'binary_expr',
  22391. operator: '>=',
  22392. left: {
  22393. type: 'column_ref',
  22394. table: null,
  22395. column: 'f4'
  22396. },
  22397. right: {
  22398. type: 'number',
  22399. value: 4
  22400. }
  22401. }
  22402. },
  22403. right: {
  22404. type: 'binary_expr',
  22405. operator: '<',
  22406. left: {
  22407. type: 'column_ref',
  22408. table: null,
  22409. column: 'f4'
  22410. },
  22411. right: {
  22412. type: 'number',
  22413. value: 3
  22414. }
  22415. }
  22416. }
  22417. * */
  22418. }
  22419. //# sourceMappingURL=SqlComplex.js.map
  22420. function initParamComplex () {
  22421. Ext.define('Yvan.ParamComplex', {
  22422. extend: 'Ext.panel.Panel',
  22423. xtype: 'paramcomplex',
  22424. alias: 'widget.paramcomplex',
  22425. getSqlExpress: function () {
  22426. },
  22427. constructor: function (config) {
  22428. var reference = config.reference;
  22429. var me = this;
  22430. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22431. {
  22432. region: 'west',
  22433. width: 280,
  22434. border: false,
  22435. split: true,
  22436. reference: reference + '_tree',
  22437. xtype: 'yvtree',
  22438. hideRefresh: true,
  22439. hideExpand: true,
  22440. hideCollapse: true,
  22441. listeners: {
  22442. itemdblclick: function (sender, record, item, index, e) {
  22443. var field = record.get('field');
  22444. var defaultValue = record.get('defaultValue');
  22445. if (!field) {
  22446. return;
  22447. }
  22448. var tabExpress = me.down('tabpanel');
  22449. var sqleditor = me.down('sqleditor');
  22450. var expressGrid = me.down('yvgrid');
  22451. if (tabExpress.getActiveTab().key !== 'grid') {
  22452. // SQL 模式
  22453. sqleditor.insertText(field + '=');
  22454. }
  22455. else {
  22456. // 表格模式
  22457. expressGrid.appendEditRow({
  22458. field: field,
  22459. operator: '=',
  22460. value: defaultValue,
  22461. remark: '',
  22462. });
  22463. _$2.defer(function () {
  22464. gridChanged(me, expressGrid);
  22465. });
  22466. }
  22467. }
  22468. },
  22469. },
  22470. {
  22471. region: 'center',
  22472. xtype: 'tabpanel',
  22473. reference: reference + '_tab',
  22474. tabPosition: 'bottom',
  22475. listeners: {
  22476. afterrender: function (sender) {
  22477. var scope = lookupScope(me);
  22478. var value = scope.viewModel.get(me.config.bindValue);
  22479. // sql 转换为 grid
  22480. try {
  22481. var list_1 = parseParamToGrid(value);
  22482. _$2.defer(function () {
  22483. var grid = me.down('yvgrid');
  22484. grid.setData(list_1);
  22485. });
  22486. }
  22487. catch (e) {
  22488. console.error(e);
  22489. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22490. var tabSql = sender.down('sqleditor');
  22491. sender.setActiveTab(tabSql);
  22492. }
  22493. },
  22494. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22495. var scope = lookupScope(me);
  22496. var value = scope.viewModel.get(me.config.bindValue);
  22497. if (newCard.key === 'grid') {
  22498. // sql 转换为 grid
  22499. try {
  22500. var list_2 = parseParamToGrid(value);
  22501. _$2.defer(function () {
  22502. var grid = me.down('yvgrid');
  22503. grid.setData(list_2);
  22504. });
  22505. return true;
  22506. }
  22507. catch (e) {
  22508. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22509. console.error(e);
  22510. return false;
  22511. }
  22512. }
  22513. else if (newCard.key === 'sql') {
  22514. // grid 转换为 sql
  22515. _$2.defer(function () {
  22516. var editor = me.down('sqleditor');
  22517. editor.setValue(value);
  22518. });
  22519. return true;
  22520. }
  22521. }
  22522. },
  22523. items: [
  22524. {
  22525. title: '表格模式',
  22526. key: 'grid',
  22527. xtype: 'yvgrid',
  22528. _mode: 'select',
  22529. reference: reference + '_grid',
  22530. hideFootbar: true,
  22531. pagination: false,
  22532. tbar: [
  22533. {
  22534. xtype: 'button',
  22535. text: '删除',
  22536. iconCls: 'x-fa fa-minus-circle',
  22537. cls: 'ext-btn-danger',
  22538. bind: {
  22539. disabled: '{!' + reference + '_grid.selection}',
  22540. },
  22541. listeners: {
  22542. click: function (sender) {
  22543. var grid = sender.up('yvgrid');
  22544. removeGridRow(grid);
  22545. gridChanged(me, grid);
  22546. }
  22547. },
  22548. },
  22549. ],
  22550. store: {},
  22551. listeners: {
  22552. editfinish: function (sender) {
  22553. gridChanged(me, sender);
  22554. },
  22555. },
  22556. columns: [
  22557. {
  22558. dataIndex: 'field',
  22559. header: '字段', sortable: false, menuDisabled: true,
  22560. width: 190,
  22561. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22562. var column = context.column;
  22563. var propertyConfig = me.config.propertyConfig;
  22564. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22565. var field = record.get('field');
  22566. if (field) {
  22567. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22568. if (idx >= 0) {
  22569. var meta = propertyConfig[idx];
  22570. return meta.text;
  22571. }
  22572. }
  22573. return value;
  22574. }
  22575. },
  22576. {
  22577. dataIndex: 'value',
  22578. header: '值', sortable: false, menuDisabled: true,
  22579. flex: 1,
  22580. getEditor: function (record) {
  22581. var column = this;
  22582. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22583. var propertyConfig = me.config.propertyConfig;
  22584. var field = record.get('field');
  22585. if (!field) {
  22586. // 没有填 propertyName
  22587. return;
  22588. }
  22589. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22590. if (idx < 0) {
  22591. console.error('没有找到 field=' + field + ". propertyConfig");
  22592. return;
  22593. }
  22594. var meta = propertyConfig[idx];
  22595. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22596. return new Ext.grid.CellEditor({
  22597. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22598. });
  22599. }
  22600. return new Ext.grid.CellEditor({
  22601. field: __assign({ dict: meta.dict }, meta.editor)
  22602. });
  22603. },
  22604. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22605. var column = context.column;
  22606. var grid = _$2.get(view, 'ownerGrid');
  22607. var propertyConfig = me.config.propertyConfig;
  22608. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22609. var field = record.get('field');
  22610. if (field) {
  22611. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22612. if (idx >= 0) {
  22613. var meta = propertyConfig[idx];
  22614. var dictName = _$2.get(meta, 'dict');
  22615. if (dictName && window['DICT_CACHE'][dictName]) {
  22616. var dict_1 = window['DICT_CACHE'][dictName];
  22617. var valueText_1 = [];
  22618. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22619. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22620. if (idxKv >= 0) {
  22621. valueText_1.push(dict_1[idxKv].text);
  22622. }
  22623. else {
  22624. valueText_1.push(value);
  22625. }
  22626. });
  22627. return valueText_1.join(',');
  22628. }
  22629. }
  22630. }
  22631. return valueList;
  22632. },
  22633. },
  22634. ]
  22635. },
  22636. {
  22637. title: '文本模式',
  22638. key: 'sql',
  22639. xtype: 'sqleditor',
  22640. reference: reference + '_sql',
  22641. listeners: {
  22642. change: function (sender) {
  22643. var scope = lookupScope(me);
  22644. // 保存 editor 写入的值
  22645. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22646. }
  22647. }
  22648. },
  22649. ]
  22650. }
  22651. ] });
  22652. this.superclass.constructor.call(this, newConfig);
  22653. },
  22654. initComponent: function () {
  22655. // 货位条件树
  22656. var me = this;
  22657. me.superclass.initComponent.apply(this, arguments);
  22658. var tree = this.down('yvtree');
  22659. var config = me.config;
  22660. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22661. },
  22662. });
  22663. function gridChanged(me, grid) {
  22664. var data = grid.getDataRows();
  22665. var propertyConfig = me.config.propertyConfig;
  22666. var bindValue = me.config.bindValue;
  22667. var scope = lookupScope(me);
  22668. var sql = parseGridToParam(data);
  22669. scope.viewModel.set(bindValue, sql);
  22670. }
  22671. /**
  22672. * 用于从 propertyConfig 解析出树形结构
  22673. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22674. * ->
  22675. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22676. */
  22677. function buildConfigTree(propertyConfig) {
  22678. var root = {
  22679. expanded: true,
  22680. leaf: false,
  22681. children: []
  22682. };
  22683. var categoryObj = {};
  22684. var cfgList = propertyConfig;
  22685. _$2.forEach(cfgList, function (cfg) {
  22686. var cateNode = categoryObj[cfg.category];
  22687. if (!cateNode) {
  22688. cateNode = {
  22689. text: cfg.category, expanded: true, leaf: false,
  22690. children: []
  22691. };
  22692. categoryObj[cfg.category] = cateNode;
  22693. root.children.push(cateNode);
  22694. }
  22695. cateNode.children.push({
  22696. text: cfg.text,
  22697. field: cfg.field,
  22698. operator: cfg.operator,
  22699. defaultValue: cfg.defaultValue,
  22700. leaf: true,
  22701. });
  22702. });
  22703. return root;
  22704. }
  22705. /**
  22706. * 将表格变成参数语句 [
  22707. * {field: 'f1', value: 1}
  22708. * {field: 'f2', value: 2}
  22709. * {field: 'f3', value: '3'}
  22710. * {field: 'f4', value: 4}
  22711. * ]
  22712. * ->
  22713. * f1=v1, f2=v2
  22714. */
  22715. function parseGridToParam(list) {
  22716. var sqls = [];
  22717. _$2.forEach(list, function (i) {
  22718. sqls.push(i.field + '=' + (i.value));
  22719. });
  22720. return sqls.join('; ');
  22721. }
  22722. /**
  22723. * 将 分号分割的的参数设置 变成表格
  22724. * @param param a=1; b=2; c='3'
  22725. * @return [
  22726. {field: 'a', value: 1}
  22727. {field: 'b', value: 2}
  22728. {field: 'c', value: '3'}
  22729. ]
  22730. */
  22731. function parseParamToGrid(param) {
  22732. if (!param || !_$2.trim(param)) {
  22733. return [];
  22734. }
  22735. var ret = [];
  22736. var sp = _$2.split(param, ';');
  22737. _$2.forEach(sp, function (v) {
  22738. var vi = _$2.indexOf(v, '=');
  22739. var field = _$2.trim(v.substr(0, vi));
  22740. var value = eval(v.substr(vi + 1));
  22741. ret.push({ field: field, value: value });
  22742. });
  22743. return ret;
  22744. }
  22745. }
  22746. //# sourceMappingURL=ParamComplex.js.map
  22747. function initSqlEditor () {
  22748. Ext.define('com.yvan.studio.SqlEditor', {
  22749. extend: 'Ext.panel.Panel',
  22750. alias: 'widget.sqleditor',
  22751. xtype: 'sqleditor',
  22752. layout: 'fit',
  22753. border: false,
  22754. html: "<div class=\"editor\"/>",
  22755. config: {
  22756. value: ''
  22757. },
  22758. codeChange: undefined,
  22759. isChangeFromOuter: false,
  22760. setCode: function (value) {
  22761. var _this = this;
  22762. this.code = value;
  22763. this.value = value;
  22764. _$2.defer(function () {
  22765. _this.isChangeFromOuter = true;
  22766. if (_this.editor) {
  22767. _this.editor.setValue(value);
  22768. }
  22769. });
  22770. },
  22771. getCode: function () {
  22772. return this.getValue();
  22773. },
  22774. updateOptions: function (options) {
  22775. if (this.editor && options) {
  22776. this.editor.updateOptions(options);
  22777. }
  22778. },
  22779. getValue: function () {
  22780. if (!this.editor) {
  22781. return this.code;
  22782. }
  22783. return this.editor.getValue();
  22784. },
  22785. applyPosition: function () {
  22786. var _this = this;
  22787. if (this.autoFocusMethod) {
  22788. if (this.editor) {
  22789. _$2.defer(function () {
  22790. if (_this.autoFocusStartLine) {
  22791. _this.editor.setPosition({
  22792. lineNumber: _this.autoFocusStartLine,
  22793. column: _this.autoFocusStartColumn
  22794. });
  22795. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22796. }
  22797. _this.editor.focus();
  22798. });
  22799. delete this.autoFocusMethod;
  22800. }
  22801. }
  22802. this.editor.layout();
  22803. },
  22804. insertText: function (text) {
  22805. var editor = this.editor;
  22806. var position = editor.getPosition();
  22807. editor.executeEdits('', [
  22808. {
  22809. range: {
  22810. startLineNumber: position.lineNumber,
  22811. startColumn: position.column,
  22812. endLineNumber: position.lineNumber,
  22813. endColumn: position.column
  22814. },
  22815. text: text
  22816. }
  22817. ]);
  22818. },
  22819. setValue: function (value, fromEditor) {
  22820. this.setCode(value);
  22821. var me = this;
  22822. if (me.value === value) {
  22823. // 值相等,不需要变化
  22824. return;
  22825. }
  22826. if (fromEditor !== true && me.editor) {
  22827. // 不是来源于编辑器的变化,才设置编辑器的值
  22828. me.editor.setValue(value);
  22829. }
  22830. // 通知mixins setValue
  22831. me.value = value;
  22832. me.fireEvent('change', value);
  22833. },
  22834. initComponent: function () {
  22835. var that = this;
  22836. this.superclass.initComponent.call(this);
  22837. that.on({
  22838. resize: function () {
  22839. if (that.editor) {
  22840. that.editor.layout();
  22841. }
  22842. },
  22843. destory: function () {
  22844. if (that.editor) {
  22845. that.editor.dispose();
  22846. delete that.editor;
  22847. }
  22848. },
  22849. afterrender: function (sender) {
  22850. var $dom = $(that.el.dom).find('.editor');
  22851. attach_2($dom[0], {
  22852. value: that.code
  22853. }).then(function (editor) {
  22854. that.editor = editor;
  22855. that.applyPosition();
  22856. that.editor.onDidChangeModelContent(function (e) {
  22857. that.fireEvent('change', that.editor, e);
  22858. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22859. that.codeChange(that.editor.getValue(), that.name, e);
  22860. }
  22861. that.isChangeFromOuter = false;
  22862. });
  22863. });
  22864. }
  22865. });
  22866. }
  22867. });
  22868. function attach_2(element, opts) {
  22869. if (!window['monaco']) {
  22870. return;
  22871. }
  22872. var monaco = window['monaco'];
  22873. return new Promise(function (resolve) {
  22874. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  22875. enabled: false
  22876. } }));
  22877. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  22878. // const sql = editor.getValue()
  22879. // if (_.trim(sql).length > 0) {
  22880. // editor.setValue(format(sql, {
  22881. // indent: ' ',
  22882. // uppercase: true,
  22883. // }))
  22884. // }
  22885. // })
  22886. editor.onKeyUp(function (e) {
  22887. // console.log(e)
  22888. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  22889. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  22890. }
  22891. });
  22892. resolve(editor);
  22893. });
  22894. }
  22895. }
  22896. //# sourceMappingURL=SqlEditor.js.map
  22897. function initJsonEditor () {
  22898. Ext.define('com.yvan.studio.JsonEditor', {
  22899. extend: 'Ext.panel.Panel',
  22900. alias: 'widget.jsoneditor',
  22901. xtype: 'jsoneditor',
  22902. layout: 'fit',
  22903. border: false,
  22904. html: "<div class=\"editor\"/>",
  22905. autoFocusMethod: true,
  22906. autoFocusStartLine: 0,
  22907. autoFocusStartColumn: 0,
  22908. codeChange: undefined,
  22909. funcArr: [],
  22910. modulePage: null,
  22911. isChangeFromOuter: false,
  22912. name: "",
  22913. /**
  22914. * 设置代码
  22915. */
  22916. setCode: function (value) {
  22917. var _this = this;
  22918. this.code = value;
  22919. _$2.defer(function () {
  22920. _this.isChangeFromOuter = true;
  22921. if (_this.editor) {
  22922. _this.editor.setValue(value);
  22923. }
  22924. });
  22925. },
  22926. updateOptions: function (options) {
  22927. if (this.editor && options) {
  22928. this.editor.updateOptions(options);
  22929. }
  22930. },
  22931. setLanguage: function (lang) {
  22932. if (!window['monaco']) {
  22933. return;
  22934. }
  22935. var monaco = window['monaco'];
  22936. if (this.editor && lang) {
  22937. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  22938. }
  22939. },
  22940. getCode: function () {
  22941. var _a;
  22942. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  22943. },
  22944. applyPosition: function () {
  22945. var _this = this;
  22946. if (this.autoFocusMethod) {
  22947. if (this.editor) {
  22948. _$2.defer(function () {
  22949. if (_this.autoFocusStartLine) {
  22950. _this.editor.setPosition({
  22951. lineNumber: _this.autoFocusStartLine,
  22952. column: _this.autoFocusStartColumn
  22953. });
  22954. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22955. }
  22956. _this.editor.focus();
  22957. });
  22958. delete this.autoFocusMethod;
  22959. }
  22960. }
  22961. this.editor.layout();
  22962. },
  22963. initComponent: function () {
  22964. var that = this;
  22965. this.superclass.initComponent.apply(this, arguments);
  22966. this.on({
  22967. resize: function (sender, width, height) {
  22968. if (that.editor) {
  22969. that.editor.layout();
  22970. }
  22971. },
  22972. destory: function () {
  22973. if (that.editor) {
  22974. that.editor.dispose();
  22975. delete that.editor;
  22976. }
  22977. },
  22978. afterrender: function (sender) {
  22979. var $dom = $(that.el.dom).find('.editor');
  22980. attach_116($dom[0], {
  22981. value: that.code
  22982. }).then(function (editor) {
  22983. that.editor = editor;
  22984. that.applyPosition();
  22985. that.editor.onDidChangeModelContent(function (e) {
  22986. that.fireEvent('change', that.editor, e);
  22987. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22988. that.codeChange(that.editor.getValue(), that.name, e);
  22989. }
  22990. that.isChangeFromOuter = false;
  22991. });
  22992. });
  22993. }
  22994. });
  22995. },
  22996. });
  22997. function attach_116(element, opts) {
  22998. if (!window['monaco']) {
  22999. return;
  23000. }
  23001. var monaco = window['monaco'];
  23002. return new Promise(function (resolve) {
  23003. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23004. enabled: false
  23005. } }));
  23006. editor.onKeyUp(function (e) {
  23007. // console.log(e)
  23008. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23009. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23010. }
  23011. });
  23012. resolve(editor);
  23013. });
  23014. }
  23015. }
  23016. //# sourceMappingURL=JsonEditor.js.map
  23017. function initJsEditor () {
  23018. Ext.define('com.yvan.studio.JsEditor', {
  23019. extend: 'Ext.panel.Panel',
  23020. alias: 'widget.jseditor',
  23021. xtype: 'jseditor',
  23022. layout: 'fit',
  23023. border: false,
  23024. html: "<div class=\"editor\"/>",
  23025. autoFocusMethod: true,
  23026. autoFocusStartLine: 0,
  23027. autoFocusStartColumn: 0,
  23028. codeChange: undefined,
  23029. funcArr: [],
  23030. modulePage: null,
  23031. isChangeFromOuter: false,
  23032. name: "",
  23033. /**
  23034. * 设置代码
  23035. */
  23036. setCode: function (value) {
  23037. var _this = this;
  23038. this.code = value;
  23039. _$2.defer(function () {
  23040. _this.isChangeFromOuter = true;
  23041. if (_this.editor) {
  23042. _this.editor.setValue(value);
  23043. if (_this.name === "controllerEditor") {
  23044. _this.funcArr = _this.getAllFunction();
  23045. }
  23046. }
  23047. });
  23048. },
  23049. getCode: function () {
  23050. var _a;
  23051. if (!this.editor) {
  23052. return this.code;
  23053. }
  23054. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23055. },
  23056. applyPosition: function () {
  23057. var _this = this;
  23058. if (this.autoFocusMethod) {
  23059. if (this.editor) {
  23060. _$2.defer(function () {
  23061. if (_this.autoFocusStartLine) {
  23062. _this.editor.setPosition({
  23063. lineNumber: _this.autoFocusStartLine,
  23064. column: _this.autoFocusStartColumn
  23065. });
  23066. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23067. }
  23068. _this.editor.focus();
  23069. });
  23070. delete this.autoFocusMethod;
  23071. }
  23072. }
  23073. this.editor.layout();
  23074. },
  23075. initComponent: function () {
  23076. var that = this;
  23077. this.superclass.initComponent.apply(this, arguments);
  23078. this.on({
  23079. resize: function (sender, width, height) {
  23080. if (that.editor) {
  23081. that.editor.layout();
  23082. }
  23083. },
  23084. destory: function () {
  23085. if (that.editor) {
  23086. that.editor.dispose();
  23087. delete that.editor;
  23088. }
  23089. },
  23090. afterrender: function () {
  23091. var $dom = $(that.el.dom).find('.editor');
  23092. attach_1($dom[0], {
  23093. value: that.code
  23094. }).then(function (editor) {
  23095. that.editor = editor;
  23096. that.applyPosition();
  23097. that.editor.onDidChangeModelContent(function (e) {
  23098. that.fireEvent('change', that.editor, e);
  23099. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23100. that.codeChange(that.editor.getValue(), that.name, e);
  23101. }
  23102. that.isChangeFromOuter = false;
  23103. });
  23104. });
  23105. }
  23106. });
  23107. },
  23108. getAllFunction: function () {
  23109. var funcArr = [];
  23110. var ast = window['YvanUI'].recast.parse(this.code);
  23111. if (ast && ast.program && ast.program.body) {
  23112. if (Array.isArray(ast.program.body)) {
  23113. for (var i = 0; i < ast.program.body.length; i++) {
  23114. var m = ast.program.body[i];
  23115. if (m.type === "ExportDefaultDeclaration") {
  23116. if (m.declaration.type === "ClassDeclaration") {
  23117. if (m.declaration.body.type === "ClassBody") {
  23118. if (Array.isArray(m.declaration.body.body)) {
  23119. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23120. var ob = m.declaration.body.body[j];
  23121. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23122. var funcItem = { name: ob.key.name, args: [] };
  23123. if (Array.isArray(ob.value.params)) {
  23124. for (var k = 0; k < ob.value.params.length; k++) {
  23125. var p = ob.value.params[k];
  23126. funcItem.args.push(p.name);
  23127. }
  23128. }
  23129. funcArr.push(funcItem);
  23130. }
  23131. }
  23132. }
  23133. }
  23134. }
  23135. }
  23136. }
  23137. }
  23138. }
  23139. return funcArr;
  23140. }
  23141. });
  23142. var isInited = false;
  23143. function attach_1(element, opts) {
  23144. if (!window['monaco']) {
  23145. return;
  23146. }
  23147. var monaco = window['monaco'];
  23148. return new Promise(function (resolve) {
  23149. if (!isInited) {
  23150. isInited = true;
  23151. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23152. noSemanticValidation: true,
  23153. noSyntaxValidation: false
  23154. });
  23155. // compiler options
  23156. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23157. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23158. allowNonTsExtensions: true,
  23159. });
  23160. // extra libraries
  23161. var libSource = [
  23162. 'declare class Facts {',
  23163. ' /**',
  23164. ' * Returns the next fact',
  23165. ' */',
  23166. ' static next():string',
  23167. ' static next222():string',
  23168. '}',
  23169. "\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 ",
  23170. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23171. ].join('\n');
  23172. var libUri = 'file:///index.d.ts';
  23173. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23174. // When resolving definitions and references, the editor will try to use created models.
  23175. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23176. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23177. }
  23178. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23179. resolve(editor);
  23180. });
  23181. }
  23182. }
  23183. //# sourceMappingURL=JsEditor.js.map
  23184. function initClipboard () {
  23185. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23186. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23187. Ext.grid.plugin.Clipboard.override({
  23188. getCellData: function (format, erase) {
  23189. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23190. if (selection) {
  23191. selection.eachCell(function (cellContext) {
  23192. column = cellContext.column;
  23193. view = cellContext.column.getView();
  23194. record = cellContext.record;
  23195. // Do not copy the check column or row numberer column
  23196. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23197. return;
  23198. }
  23199. if (lastRecord !== record) {
  23200. lastRecord = record;
  23201. ret.push(row = []);
  23202. }
  23203. dataIndex = column.dataIndex;
  23204. // 记录原始数据
  23205. var rData = record.data[dataIndex];
  23206. if (isRaw) {
  23207. data = record.data[dataIndex];
  23208. }
  23209. else {
  23210. // Try to access the view node.
  23211. viewNode = view.all.item(cellContext.rowIdx);
  23212. // If we could not, it's because it's outside of the rendered block -
  23213. // recreate it.
  23214. if (!viewNode) {
  23215. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23216. }
  23217. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23218. data = cell.innerHTML;
  23219. if (isText) {
  23220. data = Ext.util.Format.stripTags(data);
  23221. }
  23222. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23223. data = data || rData;
  23224. }
  23225. row.push(data);
  23226. if (erase && dataIndex) {
  23227. record.set(dataIndex, null);
  23228. }
  23229. });
  23230. }
  23231. // See decode() comment below
  23232. return Ext.util.TSV.encode(ret, undefined, null);
  23233. },
  23234. getCells: function (format, erase) {
  23235. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23236. if (selection) {
  23237. selection.eachCell(function (cellContext) {
  23238. record = cellContext.record;
  23239. if (lastRecord !== record) {
  23240. lastRecord = record;
  23241. ret.push(row = {
  23242. model: record.self,
  23243. fields: []
  23244. });
  23245. }
  23246. dataIndex = cellContext.column.dataIndex;
  23247. row.fields.push({
  23248. name: dataIndex,
  23249. value: record.data[dataIndex]
  23250. });
  23251. if (erase && dataIndex) {
  23252. record.set(dataIndex, null);
  23253. }
  23254. });
  23255. }
  23256. return ret;
  23257. },
  23258. getTextData: function (format, erase) {
  23259. return this.getCellData(format, erase);
  23260. },
  23261. putCellData: function (data, format) {
  23262. var _a;
  23263. 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 = {};
  23264. // If the view is not focused, use the first cell of the selection as the destination.
  23265. if (!destination && selected) {
  23266. selected.eachCell(function (c) {
  23267. destination = c;
  23268. return false;
  23269. });
  23270. }
  23271. if (destination) {
  23272. // Create a new Context based upon the outermost View.
  23273. // NavigationModel works on local views.
  23274. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23275. // At that point, we can use navModel.getPosition()
  23276. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23277. }
  23278. else {
  23279. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23280. }
  23281. destinationStartColumn = destination.colIdx;
  23282. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23283. row = values[sourceRowIdx];
  23284. // Collect new values in dataObject
  23285. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23286. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23287. continue;
  23288. }
  23289. dataIndex = destination.column.dataIndex;
  23290. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23291. if (dataIndex) {
  23292. switch (format) {
  23293. // Raw field values
  23294. case 'raw':
  23295. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23296. break;
  23297. // Textual data with HTML tags stripped
  23298. case 'text':
  23299. {
  23300. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23301. // 获取字典原始的value
  23302. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23303. }
  23304. else {
  23305. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23306. }
  23307. break;
  23308. }
  23309. }
  23310. }
  23311. // If we are at the end of the destination row, break the column loop.
  23312. if (destination.colIdx === maxColIdx) {
  23313. break;
  23314. }
  23315. destination.setColumn(destination.colIdx + 1);
  23316. }
  23317. // Update the record in one go.
  23318. destination.record.set(dataObject);
  23319. // If we are at the end of the destination store, break the row loop.
  23320. if (destination.rowIdx === maxRowIdx) {
  23321. break;
  23322. }
  23323. // Jump to next row in destination
  23324. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23325. }
  23326. },
  23327. putTextData: function (data, format) {
  23328. var _a, _b, _c;
  23329. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23330. // 根据复制的行数自动添加新的行
  23331. 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;
  23332. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23333. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23334. this.cmp.getStore().add({});
  23335. }
  23336. }
  23337. this.putCellData(data, format);
  23338. },
  23339. });
  23340. }
  23341. //# sourceMappingURL=clipboard.js.map
  23342. function initDict () {
  23343. var DICT_CACHE = window['DICT_CACHE'];
  23344. if (!DICT_CACHE) {
  23345. DICT_CACHE = {};
  23346. window['DICT_CACHE'] = DICT_CACHE;
  23347. }
  23348. DICT_CACHE.XTYPE = [
  23349. { id: 'datefield', text: '日期' },
  23350. { id: 'datetimefield', text: '日期时间' },
  23351. { id: 'textfield', text: '文本' },
  23352. { id: 'numberfield', text: '数字' },
  23353. { id: 'combo', text: '下拉框' },
  23354. ];
  23355. DICT_CACHE.operator = [
  23356. { id: '=', text: '=' },
  23357. { id: '>', text: '>' },
  23358. { id: '<', text: '<' },
  23359. { id: '>=', text: '>=' },
  23360. { id: '<=', text: '<=' },
  23361. { id: 'in', text: 'in' },
  23362. { id: 'notIn', text: 'notIn' },
  23363. ];
  23364. DICT_CACHE.GRID_MODE = [
  23365. { id: 'edit1', text: '单机编辑模式' },
  23366. { id: 'edit2', text: '双击编辑模式' },
  23367. { id: 'checkbox', text: '勾选' },
  23368. { id: 'checkonly', text: '只勾选' },
  23369. { id: 'select', text: '行选择模式' },
  23370. ];
  23371. DICT_CACHE.BOTH_SELECT = [
  23372. { id: 'N/A', text: '<无>' },
  23373. { id: 'textfield', text: '文本' },
  23374. { id: 'numberfield', text: '数字框' },
  23375. { id: 'datefield', text: '日期' },
  23376. { id: 'datetimefield', text: '日期时间' },
  23377. { id: 'combo', text: '下拉框' },
  23378. { id: 'combogrid', text: '下拉表' },
  23379. { id: 'checkbox', text: '勾选' },
  23380. ];
  23381. DICT_CACHE.ROW_LAYOUT = [
  23382. { id: 'flex', text: '按权重摆放' },
  23383. { id: 'hbox', text: '按宽度摆放' },
  23384. ];
  23385. DICT_CACHE.GRID_XTYPE = [
  23386. { id: 'N/A', text: '<无>' },
  23387. { id: 'textfield', text: '文本-textfield' },
  23388. { id: 'numberfield', text: '数字框-numberfield' },
  23389. { id: 'datefield', text: '日期-datefield' },
  23390. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23391. { id: 'combo', text: '下拉框-combo' },
  23392. { id: 'combogrid', text: '下拉表-combogrid' },
  23393. { id: 'checkbox', text: '勾选-checkbox' },
  23394. ];
  23395. DICT_CACHE.FORM_XTYPE = [
  23396. { id: 'N/A', text: '<无>' },
  23397. { id: 'textfield', text: '文本-textfield' },
  23398. { id: 'numberfield', text: '数字框-numberfield' },
  23399. { id: 'datefield', text: '日期-datefield' },
  23400. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23401. { id: 'combo', text: '下拉框-combo' },
  23402. { id: 'combogrid', text: '下拉表-combogrid' },
  23403. { id: 'checkbox', text: '勾选-checkbox' },
  23404. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23405. ];
  23406. DICT_CACHE.GRID_FORMATTER = [
  23407. { id: 'N/A', text: '默认' },
  23408. { id: 'rownum', text: '序号-rownum' },
  23409. { id: 'button', text: '按钮-button' },
  23410. { id: 'checkbox', text: '勾选-checkbox' },
  23411. { id: 'progres', text: '进度条-progres' },
  23412. ];
  23413. }
  23414. //# sourceMappingURL=dict.js.map
  23415. function initDesigner () {
  23416. Ext.define('com.yvan.studio.designer', {
  23417. extend: 'Ext.panel.Panel',
  23418. alias: 'widget.designer',
  23419. xtype: 'designer',
  23420. layout: 'fit',
  23421. items: [],
  23422. constructor: function (config) {
  23423. var self = this;
  23424. var newConfig = _$2.defaultsDeep({
  23425. // 强制性属性
  23426. }, config);
  23427. this.superclass.constructor.call(self, newConfig);
  23428. },
  23429. initComponent: function () {
  23430. var me = this;
  23431. me.on({
  23432. afterrender: function () {
  23433. }
  23434. });
  23435. this.superclass.initComponent.call(me);
  23436. }
  23437. });
  23438. }
  23439. //# sourceMappingURL=designer.js.map
  23440. var FixClass = /** @class */ (function () {
  23441. function FixClass() {
  23442. }
  23443. FixClass.prototype.fix = function (me, config) {
  23444. var _this = this;
  23445. if (isDesignMode(me, config)) {
  23446. return;
  23447. }
  23448. if (!config) {
  23449. return;
  23450. }
  23451. var fix = config.fix;
  23452. if (!fix) {
  23453. return;
  23454. }
  23455. delete config.fix;
  23456. // 这里有个 bug
  23457. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23458. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23459. var scope;
  23460. if (config.$initParent) {
  23461. // 在面板上的组件
  23462. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23463. }
  23464. else if (config.column) {
  23465. // 在列上的组件
  23466. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23467. }
  23468. if (_$2.isArray(fix)) {
  23469. _$2.each(fix, function (f) {
  23470. var fn = lookupFn(scope, f);
  23471. fn.call(_this, me, config);
  23472. });
  23473. }
  23474. else if (_$2.isString(fix)) {
  23475. var fn = lookupFn(scope, fix);
  23476. fn.call(this, me, config);
  23477. }
  23478. };
  23479. __decorate([
  23480. baseConfigProcess(),
  23481. __metadata("design:type", Function),
  23482. __metadata("design:paramtypes", [Object, Object]),
  23483. __metadata("design:returntype", void 0)
  23484. ], FixClass.prototype, "fix", null);
  23485. return FixClass;
  23486. }());
  23487. //# sourceMappingURL=fix.js.map
  23488. function init$1() {
  23489. // 引入 filters 过滤插件
  23490. Ext.require([
  23491. 'Ext.grid.filters.Filters'
  23492. ]);
  23493. // 启用 tooltip 快捷提示
  23494. Ext.QuickTips.init();
  23495. // 定义日期格式化方法
  23496. if (Ext.util && Ext.util.Format) {
  23497. Ext.apply(Ext.util.Format, {
  23498. dateFormat: 'Y-m-d'
  23499. });
  23500. }
  23501. Ext.form.field.Display.override({
  23502. cls: 'yvan-display-field',
  23503. labelAlign: 'right'
  23504. });
  23505. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23506. override: "Ext.picker.Date",
  23507. format: "Y-m-d",
  23508. });
  23509. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23510. override: "Ext.form.field.Date",
  23511. format: "Y-m-d",
  23512. });
  23513. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23514. override: "Ext.grid.PropertyColumnModel",
  23515. format: "Y-m-d",
  23516. });
  23517. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23518. override: "Ext.view.AbstractView",
  23519. loadingText: "读取中..."
  23520. });
  23521. Ext.LoadMask.prototype.msg = '请稍后...';
  23522. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23523. override: "Ext.grid.header.Container",
  23524. sortClearText: '不排序',
  23525. sortAscText: "正序",
  23526. sortDescText: "倒序",
  23527. lockText: "锁定列",
  23528. unlockText: "解除锁定",
  23529. columnsText: "字段隐藏"
  23530. });
  23531. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23532. override: "Ext.grid.filters.filter.Date",
  23533. fields: {
  23534. lt: { text: '之前' },
  23535. gt: { text: '之后' },
  23536. eq: { text: '相等' },
  23537. },
  23538. // Defaults to Ext.Date.defaultFormat
  23539. dateFormat: null
  23540. });
  23541. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23542. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23543. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23544. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23545. override: "Ext.grid.locking.Lockable",
  23546. lockText: "锁定",
  23547. unlockText: '解锁',
  23548. });
  23549. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23550. override: "Ext.grid.filters.Filters",
  23551. menuFilterText: "过滤"
  23552. });
  23553. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23554. override: "Ext.grid.filters.filter.Boolean",
  23555. yesText: "已钩选",
  23556. noText: "未勾选"
  23557. });
  23558. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23559. override: "Ext.grid.filters.filter.String",
  23560. emptyText: "输入过滤文本..."
  23561. });
  23562. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23563. override: "Ext.grid.filters.filter.Number",
  23564. emptyText: "输入数字..."
  23565. });
  23566. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23567. override: "Ext.PagingToolbar",
  23568. beforePageText: "第",
  23569. // update
  23570. afterPageText: "/ {0} 页",
  23571. // update
  23572. firstText: "第一页",
  23573. prevText: "上一页",
  23574. // update
  23575. nextText: "下一页",
  23576. lastText: "最后页",
  23577. refreshText: "刷新",
  23578. displayMsg: "总共 {2} 条",
  23579. // update
  23580. emptyMsg: '没有数据'
  23581. });
  23582. /**
  23583. * 改变事件的获取方式.
  23584. * 具体见: ext-all-debug.js:23216 addListener
  23585. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23586. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23587. */
  23588. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23589. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23590. if (typeof fn === 'string' &&
  23591. (_$2.startsWith(fn, 'scope.') ||
  23592. _$2.startsWith(fn, 'system.') ||
  23593. _$2.startsWith(fn, 'format.'))) {
  23594. scope = lookupScope(this);
  23595. if (isDesignMode(scope, undefined)) {
  23596. fn = Ext.emptyFn;
  23597. }
  23598. else {
  23599. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23600. // const vm = this.lookupViewModel()
  23601. // if (vm && vm.yvanScope) {
  23602. // scope = vm.yvanScope
  23603. // fn = scope[fn.substr('scope.'.length)]
  23604. // }
  23605. fn = lookupFn(scope, fn, this);
  23606. }
  23607. }
  23608. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23609. };
  23610. // 将 SystemLib 扩展到 window.system 下
  23611. if (!window['system']) {
  23612. window['system'] = {};
  23613. }
  23614. _$2.extend(window['system'], SystemLib);
  23615. _$2.extend(window['system'], {
  23616. showGridRowDetail: showGridRowDetail
  23617. });
  23618. Ext.apply(Ext.util.Format, {
  23619. // 百分比
  23620. percentRenderer: function (v, rd, model) {
  23621. if (!v) {
  23622. v = 0;
  23623. }
  23624. if (typeof v === 'string') {
  23625. v = parseInt(v);
  23626. }
  23627. var valueString = v.toFixed(2);
  23628. var valueFixed = v > 100 ? 100 : v;
  23629. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23630. var cls = '';
  23631. if (v < 90) {
  23632. cls = 'danger';
  23633. }
  23634. else if (v < 100) {
  23635. cls = 'warning';
  23636. }
  23637. else {
  23638. cls = 'success';
  23639. }
  23640. return Ext.String
  23641. .format(
  23642. // '<div>'
  23643. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23644. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23645. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23646. // + '</div></div>', valueString, valueFixed, cls);
  23647. '<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(
  23648. // '<div>'
  23649. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23650. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23651. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23652. // + '</div></div>', v, valueFixed, valueString);
  23653. },
  23654. //button
  23655. button: function (v, rd, model) {
  23656. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23657. }
  23658. });
  23659. initComponent();
  23660. initPanel();
  23661. initGridColumn();
  23662. initTree();
  23663. initGrid();
  23664. initMainTab();
  23665. initTextfield();
  23666. initCombo();
  23667. initTag();
  23668. initContainer();
  23669. initRows();
  23670. initCols();
  23671. initForm();
  23672. initToolbar();
  23673. initSplitter();
  23674. initButton();
  23675. initStores();
  23676. initSearch();
  23677. initMultipleSearch();
  23678. initDate();
  23679. initDateTimePicker();
  23680. initDateTime();
  23681. initNumber();
  23682. initCheckbox();
  23683. initCheckboxGroup();
  23684. initRadio();
  23685. initRadioGroup();
  23686. initFieldset();
  23687. initCombotree();
  23688. initPickerPlus();
  23689. initCombogrid();
  23690. initComboGridMulti();
  23691. initIframe();
  23692. initBpmn();
  23693. initSqlEditor();
  23694. initJsonEditor();
  23695. initJsEditor();
  23696. initClipboard();
  23697. initSqlComplex();
  23698. initParamComplex();
  23699. initDict();
  23700. initDesigner();
  23701. }
  23702. //# sourceMappingURL=init.js.map
  23703. /**
  23704. * 创建一个 Ajax 客户端
  23705. */
  23706. function createAjax(createOption) {
  23707. if (createOption.baseUrl) {
  23708. axios__default.defaults.baseURL = createOption.baseUrl;
  23709. axios__default.defaults.timeout = createOption.timeout;
  23710. storeAjax.timeout = createOption.timeout;
  23711. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23712. }
  23713. return function (option) {
  23714. //@ts-ignore
  23715. option.method = (option.method || 'get').toLocaleLowerCase();
  23716. //@ts-ignore
  23717. var ax = __assign({}, option);
  23718. switch (option.method) {
  23719. case 'get':
  23720. ax.method = 'GET';
  23721. ax.params = option.param;
  23722. ax.headers = __assign({}, option.headers);
  23723. break;
  23724. case 'post':
  23725. ax.method = 'POST';
  23726. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23727. ax.params = option.param;
  23728. ax.data = Qs.stringify(option.data);
  23729. break;
  23730. case 'put':
  23731. case 'patch':
  23732. case 'delete':
  23733. ax.method = option.method;
  23734. ax.headers = option.headers;
  23735. ax.params = option.param;
  23736. ax.data = Qs.stringify(option.data);
  23737. break;
  23738. case 'download':
  23739. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23740. return new Promise(function (resolver, reject) {
  23741. });
  23742. case "invoke":
  23743. ax.url = serverInvokeUrlTransform(option.url, option);
  23744. ax.method = 'POST';
  23745. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23746. if (typeof option.args === 'object') {
  23747. ax.data = JSON.stringify({
  23748. args: option.args,
  23749. });
  23750. }
  23751. else {
  23752. ax.data = JSON.stringify({
  23753. args: [
  23754. __assign(__assign({}, option.data), option.param)
  23755. ],
  23756. filterModel: option.filterModel,
  23757. sortModel: option.sortModel
  23758. });
  23759. }
  23760. break;
  23761. case 'post-json':
  23762. ax.method = 'POST';
  23763. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23764. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23765. break;
  23766. case 'post-file':
  23767. //TODO 刘壮. 上传文件
  23768. var forms = new FormData();
  23769. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23770. _$2.forOwn(option.data, function (value, key) {
  23771. if (key === 'files') {
  23772. var i_1 = 0;
  23773. _$2.each(value, function (f) {
  23774. // @ts-ignore
  23775. forms.append('file' + (++i_1), f);
  23776. });
  23777. }
  23778. else {
  23779. forms.append(key, value);
  23780. }
  23781. });
  23782. ax.data = forms;
  23783. ax.method = 'POST';
  23784. break;
  23785. case "sql":
  23786. ax.url = sqlUrlTransform(option.url);
  23787. ax.method = 'POST';
  23788. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23789. ax.data = JSON.stringify({
  23790. args: [option.data],
  23791. db: option.db,
  23792. filterModel: option.filterModel,
  23793. sortModel: option.sortModel
  23794. });
  23795. break;
  23796. default:
  23797. throw new Error('not implements');
  23798. }
  23799. return new Promise(function (resolver, reject) {
  23800. axios__default(ax).then(function (resolverRaw) {
  23801. var apiResult = {
  23802. rawData: resolverRaw.data,
  23803. status: resolverRaw.status,
  23804. success: (resolverRaw.data && resolverRaw.data.success),
  23805. data: resolverRaw.data.data,
  23806. pagination: resolverRaw.data.pagination,
  23807. msg: (resolverRaw.data.msg),
  23808. errors: resolverRaw.data.errors,
  23809. headers: resolverRaw.headers
  23810. };
  23811. resolver(apiResult);
  23812. }).catch(function (reason) {
  23813. reject(reason);
  23814. });
  23815. });
  23816. };
  23817. }
  23818. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23819. if (isJson === void 0) { isJson = false; }
  23820. var YvanUI = _$2.get(window, 'YvanUI');
  23821. YvanUI.loading();
  23822. var createObjectURL = function (object) {
  23823. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23824. };
  23825. // const formData = new FormData();
  23826. // _.forOwn(data, (v, k) => {
  23827. // formData.append(k, v);
  23828. // });
  23829. var formData = '';
  23830. var xhr = new XMLHttpRequest();
  23831. xhr.open('POST', downLoadUrl);
  23832. xhr.responseType = 'blob';
  23833. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23834. if (isJson) {
  23835. formData = data ? JSON.stringify(data) : '';
  23836. xhr.setRequestHeader('Content-Type', 'application/json');
  23837. }
  23838. else {
  23839. formData = data ? Qs.stringify(data) : '';
  23840. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23841. }
  23842. //
  23843. if (header) {
  23844. _$2.forOwn(header, function (v, k) {
  23845. xhr.setRequestHeader(k, v);
  23846. });
  23847. }
  23848. xhr.onload = function (e) {
  23849. if (this.status === 200) {
  23850. var blob = this.response;
  23851. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23852. navigator.msSaveBlob(blob, filename);
  23853. YvanUI.clearLoading();
  23854. }
  23855. else {
  23856. var a = document.createElement('a');
  23857. var url = createObjectURL(blob);
  23858. a.href = url;
  23859. a.download = filename;
  23860. document.append(a);
  23861. a.click();
  23862. a.remove();
  23863. window.URL.revokeObjectURL(url);
  23864. YvanUI.clearLoading();
  23865. }
  23866. }
  23867. };
  23868. xhr.send(formData);
  23869. }
  23870. //# sourceMappingURL=ajax.js.map
  23871. function readExcel(file) {
  23872. return new Promise(function (resolve, reject) {
  23873. if (!file) {
  23874. reject("文件读取失败!!!");
  23875. return;
  23876. }
  23877. var reader = new FileReader();
  23878. reader.onload = function (e) {
  23879. if (e.target) {
  23880. var data = e.target.result;
  23881. var workbook = XLSX.read(data, { type: 'binary' });
  23882. resolve(workbook);
  23883. }
  23884. else {
  23885. reject("文件读取失败!!!");
  23886. }
  23887. };
  23888. try {
  23889. reader.readAsBinaryString(file);
  23890. }
  23891. catch (e) {
  23892. reject(e);
  23893. }
  23894. });
  23895. }
  23896. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  23897. if (dataStartRow === void 0) { dataStartRow = 2; }
  23898. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  23899. if (rowValidate === void 0) { rowValidate = undefined; }
  23900. if (otherValidate === void 0) { otherValidate = undefined; }
  23901. if (fieldValidate === void 0) { fieldValidate = undefined; }
  23902. return new Promise(function (resolve, reject) {
  23903. var promiseArr = [];
  23904. for (var i = 0; i < columnsSet.length; i++) {
  23905. var fix = columnsSet[i].fix;
  23906. if (_$2.isArray(fix) && fix.length > 0) {
  23907. var ss = fix[0].toLowerCase();
  23908. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  23909. columnsSet[i].importFormatter = function (vdata) {
  23910. // @ts-ignore
  23911. return window.moment(vdata.ov) - 0;
  23912. };
  23913. }
  23914. else {
  23915. var fn = lookupFn(topScope, fix[0]);
  23916. promiseArr.push(fn(null, columnsSet[i]));
  23917. delete columnsSet[i].fix;
  23918. }
  23919. }
  23920. else if (_$2.isString(fix)) {
  23921. var ss = fix.toLowerCase();
  23922. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  23923. columnsSet[i].importFormatter = function (vdata) {
  23924. // @ts-ignore
  23925. return window.moment(vdata.ov) - 0;
  23926. };
  23927. }
  23928. else {
  23929. var fn = lookupFn(topScope, fix);
  23930. promiseArr.push(fn(null, columnsSet[i]));
  23931. delete columnsSet[i].fix;
  23932. }
  23933. }
  23934. }
  23935. var read = function () {
  23936. readExcel(file).then(function (workbook) {
  23937. var sheetNames = workbook.SheetNames; // 工作表名称集合
  23938. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  23939. var titleRowValue = [];
  23940. var titleRowKey = [];
  23941. var needLoop = false; // 是否需要迭代
  23942. var columns = [];
  23943. if (worksheet && worksheet["!ref"]) {
  23944. var t = worksheet["!ref"];
  23945. var tempArr = t.split(':');
  23946. if (tempArr.length >= 2) {
  23947. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  23948. // 选取title的行,删除之前的行
  23949. if (titleRowNumber > firstRowNumber) {
  23950. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  23951. for (var key in worksheet) {
  23952. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  23953. delete worksheet[key];
  23954. }
  23955. }
  23956. }
  23957. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  23958. firstRowNumber = titleRowNumber + '';
  23959. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  23960. }
  23961. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  23962. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  23963. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  23964. for (var key in worksheet) {
  23965. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  23966. titleRowKey.push(key);
  23967. titleRowValue.push(worksheet[key].v);
  23968. }
  23969. }
  23970. if (columnsSet && columnsSet.length > 0) {
  23971. var length = columnsSet.length;
  23972. length = length <= titleRowKey.length ? length : titleRowKey.length;
  23973. for (var i = 0; i < length; i++) {
  23974. var vk = titleRowKey[i];
  23975. var item = columnsSet[i];
  23976. var column = {};
  23977. if (typeof item === 'string') {
  23978. column.dataIndex = item;
  23979. column.header = worksheet[vk].v;
  23980. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  23981. }
  23982. else if (typeof item.dataIndex === "string") {
  23983. column.dataIndex = item.dataIndex;
  23984. column.header = worksheet[vk].v;
  23985. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  23986. if (typeof item.validate === "function") {
  23987. column.validate = item.validate;
  23988. needLoop = true;
  23989. }
  23990. if (typeof item.importFormatter === "function") {
  23991. column.importFormatter = item.importFormatter;
  23992. needLoop = true;
  23993. }
  23994. if ((item.data instanceof Array && item.data.length > 0)
  23995. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  23996. column.data = item.data;
  23997. needLoop = true;
  23998. }
  23999. }
  24000. columns.push(column);
  24001. }
  24002. }
  24003. }
  24004. }
  24005. if (fieldValidate && typeof fieldValidate === "function") {
  24006. if (fieldValidate(columns, titleRowValue) !== true) {
  24007. reject("fields validate error");
  24008. return;
  24009. }
  24010. }
  24011. var allData = XLSX.utils.sheet_to_json(worksheet);
  24012. var okData = [], errorData = [], errorMsgData = [];
  24013. var needItemLoop = needLoop;
  24014. if (rowValidate && typeof rowValidate === "function") {
  24015. needLoop = true;
  24016. }
  24017. if (needLoop === true) {
  24018. for (var index = 0; index < allData.length; index++) {
  24019. var row = allData[index];
  24020. var rowNumber = dataStartRow + index;
  24021. row.__importID__ = rowNumber;
  24022. var isRowOk = true;
  24023. if (needItemLoop) {
  24024. var _loop_1 = function (num) {
  24025. var column = columns[num];
  24026. var ov = row[column.dataIndex];
  24027. var nv = ov;
  24028. var hasError = false;
  24029. var rowNumber_1 = dataStartRow + index;
  24030. var ei = {
  24031. errorId: rowNumber_1 + '_' + column.dataIndex,
  24032. importID: rowNumber_1,
  24033. dataIndex: column.dataIndex,
  24034. header: column.header,
  24035. value: ov,
  24036. errormessage: ""
  24037. };
  24038. // 格式化
  24039. if (column.data instanceof Array) {
  24040. nv = undefined;
  24041. ei.errormessage = "字典匹配失败";
  24042. _$2.forEach(column.data, function (v, index) {
  24043. if (v.text === ov) {
  24044. nv = v.id;
  24045. return;
  24046. }
  24047. });
  24048. }
  24049. else if (_$2.isPlainObject(column.data)) {
  24050. nv = undefined;
  24051. ei.errormessage = "字典匹配失败";
  24052. _$2.forEach(column.data, function (value, key) {
  24053. if (value === ov) {
  24054. nv = key;
  24055. return;
  24056. }
  24057. });
  24058. }
  24059. if (typeof column.importFormatter === 'function') {
  24060. var vdata = {
  24061. column: column,
  24062. ov: ov,
  24063. nv: nv,
  24064. rowIndex: index,
  24065. data: row,
  24066. rowDatas: allData
  24067. };
  24068. nv = undefined;
  24069. ei.errormessage = "格式化失败";
  24070. nv = column.importFormatter(vdata);
  24071. }
  24072. if (!nv && nv != 0) {
  24073. hasError = true;
  24074. }
  24075. else {
  24076. row[column.dataIndex] = nv;
  24077. ei.errormessage = "";
  24078. }
  24079. // 校验
  24080. if (typeof column.validate === 'function') {
  24081. var vdata = {
  24082. column: column,
  24083. ov: ov,
  24084. nv: nv,
  24085. rowIndex: index,
  24086. data: row,
  24087. rowDatas: allData
  24088. };
  24089. var errormessage = column.validate(vdata);
  24090. if (errormessage === true) ;
  24091. else {
  24092. hasError = true;
  24093. ei.errormessage = ei.errormessage + "/" + errormessage;
  24094. }
  24095. }
  24096. if (hasError === true) {
  24097. isRowOk = false;
  24098. errorMsgData.push(ei);
  24099. }
  24100. };
  24101. for (var num = 0; num < columns.length; num++) {
  24102. _loop_1(num);
  24103. }
  24104. }
  24105. if (rowValidate && typeof rowValidate === "function") {
  24106. var errormessage = rowValidate({
  24107. columns: columns,
  24108. data: row,
  24109. rowIndex: index,
  24110. rowDatas: allData
  24111. });
  24112. if (errormessage === true) ;
  24113. else {
  24114. isRowOk = false;
  24115. var ei = {
  24116. errorId: rowNumber + '',
  24117. dataIndex: "row",
  24118. header: "数据行",
  24119. value: "当前行的数据",
  24120. importID: rowNumber,
  24121. errormessage: errormessage
  24122. };
  24123. errorMsgData.push(ei);
  24124. }
  24125. }
  24126. row.__hasError__ = !isRowOk;
  24127. if (isRowOk === true) {
  24128. okData.push(row);
  24129. }
  24130. else {
  24131. errorData.push(row);
  24132. }
  24133. }
  24134. }
  24135. else {
  24136. // 添加数据的唯一标识
  24137. for (var index = 0; index < allData.length; index++) {
  24138. var row = allData[index];
  24139. var rowNumber = dataStartRow + index;
  24140. row.__importID__ = rowNumber;
  24141. row.__hasError__ = false;
  24142. }
  24143. okData = allData;
  24144. }
  24145. if (otherValidate && typeof otherValidate === "function") {
  24146. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24147. }
  24148. else {
  24149. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24150. }
  24151. // clearLoading()
  24152. }).catch(function (e) {
  24153. reject(e);
  24154. });
  24155. };
  24156. if (promiseArr.length > 0) {
  24157. Promise.all(promiseArr).then(function (resArr) {
  24158. for (var i = 0; i < resArr.length; i++) {
  24159. var tmp = resArr[i];
  24160. tmp.config.data = [];
  24161. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24162. if (tmp.r.field.length > 1) {
  24163. var keyKey = tmp.r.field[0];
  24164. var valueKey = tmp.r.field[1];
  24165. for (var j = 0; j < tmp.r.data.length; j++) {
  24166. var it = tmp.r.data[j];
  24167. var newIt = {};
  24168. newIt.id = it[keyKey];
  24169. newIt.text = it[valueKey];
  24170. tmp.config.data.push(newIt);
  24171. }
  24172. }
  24173. }
  24174. }
  24175. read();
  24176. });
  24177. }
  24178. else {
  24179. setTimeout(read, 50);
  24180. }
  24181. });
  24182. }
  24183. //# sourceMappingURL=xlsx.js.map
  24184. var ExcelImportDialog = /** @class */ (function (_super) {
  24185. __extends(ExcelImportDialog, _super);
  24186. function ExcelImportDialog(option) {
  24187. var _this = this;
  24188. var vjson = vjsonFunc(option);
  24189. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24190. _this.importExcelOption = option;
  24191. return _this;
  24192. }
  24193. ExcelImportDialog.prototype.onLoad = function () {
  24194. _super.prototype.onLoad.call(this);
  24195. };
  24196. ExcelImportDialog.prototype.fileChange = function (sender) {
  24197. var _this = this;
  24198. var file = sender.fileInputEl.dom.files[0];
  24199. // const senderScope = lookupScope(sender)
  24200. var topScope = this.topScope;
  24201. var rowValidate = this.importExcelOption.rowValidate;
  24202. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24203. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24204. }
  24205. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24206. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24207. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24208. }
  24209. var fieldValidate = this.importExcelOption.fieldValidate;
  24210. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24211. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24212. }
  24213. this.setLoading(true);
  24214. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24215. _this.importData = res;
  24216. _this.refs.dataGrid.setData(res.allData);
  24217. _this.viewModel.set("dataCount", res.allData.length);
  24218. _this.refs.errGrid.setData(res.errorMsgData);
  24219. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24220. }).catch(function (e) {
  24221. _this.importData = null;
  24222. _this.refs.dataGrid.setData();
  24223. _this.refs.errGrid.setData();
  24224. msg(e.toString());
  24225. }).finally(function () {
  24226. _this.setLoading(false);
  24227. });
  24228. };
  24229. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24230. if (record.get('__hasError__')) {
  24231. return "x-grid-record-bg-red";
  24232. }
  24233. };
  24234. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24235. return "x-grid-record-bg-red";
  24236. };
  24237. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24238. var _a;
  24239. var id = record.data.__importID__;
  24240. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24241. var selectRecord = null;
  24242. var dataIndex = -1;
  24243. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24244. for (var i = 0; i < rows.length; i++) {
  24245. if (rows[i].importID === id) {
  24246. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24247. dataIndex = i;
  24248. }
  24249. if (rows[i].errorId === id + "_" + subId) {
  24250. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24251. dataIndex = i;
  24252. break;
  24253. }
  24254. }
  24255. if (selectRecord) {
  24256. this.refs.errGrid.ensureVisible(selectRecord);
  24257. this.refs.errGrid.selModel.select(dataIndex);
  24258. // this.refs.errGrid.reload()
  24259. }
  24260. };
  24261. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24262. var _a;
  24263. var id = record.data.importID;
  24264. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24265. var selectRecord = null;
  24266. var dataIndex = -1;
  24267. for (var i = 0; i < rows.length; i++) {
  24268. if (rows[i].__importID__ === id) {
  24269. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24270. dataIndex = i;
  24271. break;
  24272. }
  24273. }
  24274. if (selectRecord) {
  24275. this.refs.dataGrid.ensureVisible(selectRecord);
  24276. this.refs.dataGrid.selModel.select(dataIndex);
  24277. // this.refs.dataGrid.reload()
  24278. }
  24279. };
  24280. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24281. this.viewModel.set("dataType", newValue);
  24282. if (this.importData) {
  24283. this.refs.dataGrid.setData(this.importData[newValue]);
  24284. this.viewModel.set("dataCount", this.importData[newValue].length);
  24285. }
  24286. };
  24287. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24288. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24289. window.location.href = this.importExcelOption.dowLoadUrl;
  24290. return;
  24291. }
  24292. var xt = [];
  24293. _$2.forEach(this.importExcelOption.columns, function (v) {
  24294. xt.push(v.header);
  24295. });
  24296. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24297. if (filename.endsWith(".xlsx")) {
  24298. filename = filename.split(".xlsx")[0];
  24299. }
  24300. filename = filename + ".xlsx";
  24301. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24302. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24303. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24304. XLSX.writeFile(wb, filename); //导出Excel
  24305. };
  24306. ExcelImportDialog.prototype.getData = function (sender) {
  24307. _$2.each(this.importData.okData, function (item) {
  24308. delete item.id;
  24309. delete item.__hasError__;
  24310. delete item.__importID__;
  24311. delete item._origin;
  24312. });
  24313. _$2.each(this.importData.allData, function (item) {
  24314. delete item.id;
  24315. delete item.__hasError__;
  24316. delete item.__importID__;
  24317. delete item._origin;
  24318. });
  24319. _$2.each(this.importData.errorData, function (item) {
  24320. delete item.id;
  24321. delete item.__hasError__;
  24322. delete item.__importID__;
  24323. delete item._origin;
  24324. });
  24325. this.dialogSuccess(this.importData);
  24326. };
  24327. return ExcelImportDialog;
  24328. }(Scope));
  24329. var model$d = {
  24330. data: {
  24331. dataType: "all",
  24332. errMsgCount: 0,
  24333. dataCount: 0
  24334. }
  24335. };
  24336. var vjsonFunc = function (option) {
  24337. return {
  24338. title: option.title || 'excel导入',
  24339. layout: 'fit',
  24340. items: [
  24341. {
  24342. layout: 'border',
  24343. tbar: {
  24344. xtype: "form",
  24345. items: [
  24346. {
  24347. xtype: "cols",
  24348. items: [
  24349. {
  24350. xtype: "filefield",
  24351. fieldLabel: 'excel文件',
  24352. buttonText: '请选择excel文件',
  24353. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24354. flex: 3,
  24355. listeners: {
  24356. change: "scope.fileChange"
  24357. }
  24358. }, {
  24359. xtype: "button",
  24360. iconCls: "x-fa fa-download",
  24361. text: "下载模版",
  24362. listeners: {
  24363. click: "scope.downloadTemplate"
  24364. }
  24365. }, {
  24366. xtype: 'container',
  24367. border: false,
  24368. layout: 'hbox',
  24369. }, {
  24370. xtype: "button",
  24371. iconCls: "x-fa fa-upload",
  24372. text: option.tQButtonText || "提取数据",
  24373. listeners: {
  24374. click: "scope.getData"
  24375. }
  24376. }
  24377. ]
  24378. },
  24379. ]
  24380. },
  24381. items: [
  24382. {
  24383. tbar: {
  24384. xtype: "toolbar",
  24385. title: "导入的数据",
  24386. items: [{
  24387. xtype: 'label',
  24388. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24389. }, {
  24390. xtype: 'radiogroup',
  24391. items: [
  24392. {
  24393. boxLabel: '所有数据',
  24394. checked: true,
  24395. inputValue: 'allData',
  24396. }, {
  24397. boxLabel: '正确数据',
  24398. inputValue: 'okData',
  24399. }, {
  24400. boxLabel: '错误数据',
  24401. inputValue: 'errorData',
  24402. }
  24403. ],
  24404. listeners: {
  24405. change: 'scope.filterData',
  24406. },
  24407. }, {
  24408. xtype: "textfield",
  24409. readOnly: true,
  24410. fieldLabel: "条目数",
  24411. bind: "{dataCount}"
  24412. }]
  24413. },
  24414. xtype: 'yvgrid',
  24415. reference: 'dataGrid',
  24416. layout: 'fit',
  24417. pagination: false,
  24418. // pageSize: 50,
  24419. getRowClass: 'scope.getDataGridRowRecord',
  24420. columns: option.columns,
  24421. region: 'center',
  24422. split: true,
  24423. listeners: {
  24424. cellclick: "scope.dataGridClick",
  24425. },
  24426. selModel: {
  24427. // type: 'rowmodel',
  24428. mode: 'SINGLE',
  24429. },
  24430. }, {
  24431. tbar: {
  24432. xtype: "toolbar", items: [
  24433. {
  24434. xtype: 'label',
  24435. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24436. }, {
  24437. xtype: "textfield",
  24438. readOnly: true,
  24439. fieldLabel: "条目数",
  24440. bind: "{errMsgCount}"
  24441. }
  24442. ]
  24443. },
  24444. xtype: 'yvgrid',
  24445. reference: 'errGrid',
  24446. layout: 'fit',
  24447. pagination: false,
  24448. getRowClass: 'scope.getErrGridRowRecord',
  24449. height: "40%",
  24450. columns: [
  24451. { dataIndex: "errorId", header: "ID", hidden: true },
  24452. { dataIndex: "importID", header: "行号", width: 80 },
  24453. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24454. { dataIndex: "value", header: "值", width: 120 },
  24455. { dataIndex: "header", header: "字段名", width: 120 },
  24456. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24457. ],
  24458. region: 'south',
  24459. split: true,
  24460. listeners: {
  24461. itemclick: "scope.errGridClick"
  24462. },
  24463. selModel: {
  24464. // type: 'rowmodel',
  24465. mode: 'SINGLE',
  24466. },
  24467. },
  24468. ],
  24469. },
  24470. ],
  24471. referenceHolder: true,
  24472. };
  24473. };
  24474. //# sourceMappingURL=ExcelImportDialog.js.map
  24475. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24476. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24477. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24478. ret.report_id = reportId;
  24479. ret.report = report;
  24480. return ret;
  24481. }
  24482. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24483. var e_1, _a, e_2, _b;
  24484. var model = {
  24485. data: {
  24486. report_name: config.report_name,
  24487. query: {},
  24488. sum: {},
  24489. }
  24490. };
  24491. var json5 = window['YvanUI'].json5;
  24492. var report = config.report ? json5.parse(config.report) : {};
  24493. var conditionRows = [];
  24494. var sumRows = [];
  24495. model.data.has_sum = _$2.size(report.summary) > 0;
  24496. // query 查询条件
  24497. var newRow = false;
  24498. var currentRow = { xtype: 'cols', items: [], };
  24499. conditionRows.push(currentRow);
  24500. _$2.forEach(report.query, function (item) {
  24501. if (newRow) {
  24502. currentRow = { xtype: 'cols', items: [], };
  24503. conditionRows.push(currentRow);
  24504. }
  24505. var vj = json5.parse(item.conditionFieldExtend);
  24506. if (item.conditionFieldXtype) {
  24507. vj.xtype = item.conditionFieldXtype;
  24508. if (item.conditionFieldXtype === 'combo') {
  24509. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24510. }
  24511. if (item.conditionFieldXtype === 'datetimefield') {
  24512. //@ts-ignore
  24513. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  24514. }
  24515. else if (item.conditionFieldXtype === 'datefield') {
  24516. //@ts-ignore
  24517. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24518. }
  24519. else {
  24520. model.data.query[item.conditionFieldBind] = '';
  24521. }
  24522. }
  24523. else {
  24524. // 没有组件类型,是个空占位符
  24525. vj.border = false;
  24526. }
  24527. if (item.conditionFieldBind) {
  24528. vj.bind = {
  24529. value: '{query.' + item.conditionFieldBind + '}'
  24530. };
  24531. }
  24532. if (item.conditionFieldFlex) {
  24533. vj.flex = item.conditionFieldFlex;
  24534. }
  24535. if (item.conditionFieldXtype) {
  24536. vj.fieldLabel = item.conditionFieldLabel;
  24537. }
  24538. if (item.fieldLabel) {
  24539. vj.fieldLabel = item.fieldLabel;
  24540. }
  24541. newRow = item.conditionFieldWrap || false;
  24542. currentRow.items.push(vj);
  24543. });
  24544. if (currentRow) {
  24545. currentRow.margin = '10 0 10 0';
  24546. }
  24547. // sum 汇总条件
  24548. newRow = true;
  24549. try {
  24550. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24551. var item = _d.value;
  24552. if (newRow) {
  24553. currentRow = {
  24554. xtype: 'cols',
  24555. defaultType: 'displayfield',
  24556. defaults: {
  24557. labelWidth: 70,
  24558. },
  24559. items: []
  24560. };
  24561. sumRows.push(currentRow);
  24562. }
  24563. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24564. if (item.sumFieldBind) {
  24565. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24566. model.data.sum[item.sumFieldBind] = '';
  24567. }
  24568. else {
  24569. // 没有组件类型,是个空占位符
  24570. vj.border = false;
  24571. }
  24572. if (item.sumFieldFlex) {
  24573. vj.flex = item.sumFieldFlex;
  24574. }
  24575. if (item.sumFieldLabel) {
  24576. vj.fieldLabel = item.sumFieldLabel;
  24577. }
  24578. // sumFieldBind: "zs"
  24579. // sumFieldExtend: "{}"
  24580. // sumFieldFlex: 1
  24581. // sumFieldLabel: "总数"
  24582. // sumFieldWrap: false
  24583. newRow = item.sumFieldWrap || false;
  24584. currentRow.items.push(vj);
  24585. }
  24586. }
  24587. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24588. finally {
  24589. try {
  24590. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24591. }
  24592. finally { if (e_1) throw e_1.error; }
  24593. }
  24594. if (currentRow) {
  24595. currentRow.margin = '10 0 10 0';
  24596. }
  24597. // column 结果字段
  24598. var columns = [];
  24599. try {
  24600. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24601. var item = _f.value;
  24602. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24603. if (item.xtype) {
  24604. if (item.xtype == 'checkbox') {
  24605. vj.xtype = 'checkcolumn';
  24606. vj.disabled = true;
  24607. }
  24608. else {
  24609. vj.xtype = item.xtype;
  24610. }
  24611. }
  24612. if (item.dataType) {
  24613. vj.dataType = item.dataType;
  24614. }
  24615. if (item.align) {
  24616. vj.align = item.align;
  24617. }
  24618. if (item.width) {
  24619. vj.width = item.width;
  24620. }
  24621. if (item.dict) {
  24622. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24623. }
  24624. columns.push(vj);
  24625. }
  24626. }
  24627. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24628. finally {
  24629. try {
  24630. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24631. }
  24632. finally { if (e_2) throw e_2.error; }
  24633. }
  24634. var vjson = {
  24635. bind: {
  24636. title: '{report_name}',
  24637. },
  24638. layout: 'fit',
  24639. referenceHolder: true,
  24640. items: [
  24641. {
  24642. layout: 'border',
  24643. border: false,
  24644. items: [
  24645. {
  24646. region: 'north',
  24647. border: false,
  24648. tbar: {
  24649. xtype: 'toolbar',
  24650. border: false,
  24651. items: [
  24652. {
  24653. xtype: 'button',
  24654. text: '查询',
  24655. reference: 'btnSearch',
  24656. iconCls: 'x-fa fa-search',
  24657. listeners: {
  24658. click: 'scope.reload',
  24659. },
  24660. },
  24661. {
  24662. xtype: 'button',
  24663. text: '关闭',
  24664. iconCls: 'x-fa fa-times',
  24665. listeners: {
  24666. click: 'system.closeMe()',
  24667. },
  24668. },
  24669. ],
  24670. },
  24671. defaults: {
  24672. margin: '8 0 0 0'
  24673. },
  24674. items: __spread(conditionRows, sumRows),
  24675. fix: ['system.enterToClick("btnSearch")'],
  24676. },
  24677. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24678. method: 'invoke',
  24679. url: '/report/Report@execute',
  24680. params: {
  24681. dataSource: report.dataSource,
  24682. pagination: report.grid.pagination || true,
  24683. report_id: config.report_id,
  24684. query: '{query}',
  24685. },
  24686. }, columns: columns }, report.grid),
  24687. ],
  24688. },
  24689. ],
  24690. };
  24691. return { model: model, vjson: vjson, report: report };
  24692. }
  24693. var ReportScope = /** @class */ (function (_super) {
  24694. __extends(ReportScope, _super);
  24695. function ReportScope(_a, invokeServerFn) {
  24696. var model = _a.model, vjson = _a.vjson;
  24697. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  24698. _this.invokeServerFn = invokeServerFn;
  24699. return _this;
  24700. }
  24701. ReportScope.prototype.onLoad = function () {
  24702. // this.reload()
  24703. };
  24704. ReportScope.prototype.reload = function () {
  24705. var _this = this;
  24706. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24707. if (this.viewModel.get('has_sum')) {
  24708. this.invokeServerFn('/report/Report@executeSum', {
  24709. dataSource: this.report.dataSource,
  24710. report_id: this.report_id,
  24711. query: this.viewModel.get('query'),
  24712. }).then(function (res) {
  24713. if (!res.success) {
  24714. showErrorDialog$1(res.msg);
  24715. }
  24716. else {
  24717. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24718. }
  24719. });
  24720. }
  24721. this.refs.grid1.reload();
  24722. };
  24723. return ReportScope;
  24724. }(Scope));
  24725. //# sourceMappingURL=Report.js.map
  24726. var model$e = {
  24727. data: {
  24728. form: {
  24729. resource_parent: '',
  24730. resource_name: '',
  24731. resource_icon: '',
  24732. scope_url: '',
  24733. scope_params: '',
  24734. resource_order: '',
  24735. permission_code: '',
  24736. },
  24737. }
  24738. };
  24739. //# sourceMappingURL=RegisterModule.model.js.map
  24740. var vjson$d = {
  24741. title: '注册模块',
  24742. layout: 'fit',
  24743. width: "40%",
  24744. height: "50%",
  24745. fbar: {
  24746. xtype: 'toolbar',
  24747. items: [
  24748. {
  24749. xtype: "button",
  24750. text: "确定",
  24751. iconCls: 'x-fa fa-check',
  24752. listeners: {
  24753. click: 'scope.saveNode',
  24754. }
  24755. },
  24756. {
  24757. xtype: "button",
  24758. text: "关闭",
  24759. iconCls: 'x-fa fa-times',
  24760. listeners: {
  24761. click: 'system.closeMe()',
  24762. }
  24763. },
  24764. ]
  24765. },
  24766. items: [
  24767. {
  24768. layout: 'border',
  24769. items: [
  24770. {
  24771. region: 'west',
  24772. layout: 'fit',
  24773. xtype: 'tabpanel',
  24774. reference: 'tabs',
  24775. width: "50%",
  24776. split: true,
  24777. listeners: {
  24778. tabchange: 'scope.tabchange',
  24779. },
  24780. items: [
  24781. {
  24782. region: 'center',
  24783. layout: 'fit',
  24784. title: 'PC菜单',
  24785. key: "1",
  24786. items: [
  24787. {
  24788. xtype: 'treepanel',
  24789. layout: 'fit',
  24790. region: 'west',
  24791. rootVisible: false,
  24792. useArrows: true,
  24793. reference: 'tree1',
  24794. listeners: {
  24795. itemclick: "scope.tree1NodeClick",
  24796. }
  24797. },
  24798. ]
  24799. },
  24800. {
  24801. region: 'center',
  24802. layout: 'fit',
  24803. title: 'PDA菜单',
  24804. key: "2",
  24805. items: [
  24806. {
  24807. xtype: 'treepanel',
  24808. layout: 'fit',
  24809. region: 'west',
  24810. reference: 'tree2',
  24811. rootVisible: false,
  24812. useArrows: true,
  24813. listeners: {
  24814. itemclick: "scope.tree1NodeClick",
  24815. }
  24816. },
  24817. ]
  24818. },
  24819. ]
  24820. },
  24821. {
  24822. region: 'center',
  24823. xtype: 'form',
  24824. margin: '0 0 0 0',
  24825. split: true,
  24826. width: '50%',
  24827. items: [
  24828. {
  24829. xtype: 'cols',
  24830. items: [
  24831. {
  24832. xtype: 'textfield',
  24833. fieldLabel: '上级资源ID',
  24834. bind: {
  24835. readOnly: true,
  24836. disabled: true,
  24837. value: '{form.resource_parent}'
  24838. },
  24839. },
  24840. ],
  24841. },
  24842. {
  24843. xtype: 'cols',
  24844. items: [
  24845. {
  24846. xtype: 'textfield',
  24847. fieldLabel: '资源名称',
  24848. bind: {
  24849. value: '{form.resource_name}'
  24850. },
  24851. allowBlank: false,
  24852. },
  24853. ],
  24854. },
  24855. {
  24856. xtype: 'cols',
  24857. items: [
  24858. {
  24859. xtype: 'numberfield',
  24860. fieldLabel: '资源排序',
  24861. bind: {
  24862. value: '{form.resource_order}'
  24863. },
  24864. allowBlank: false,
  24865. },
  24866. ],
  24867. },
  24868. {
  24869. xtype: 'cols',
  24870. items: [
  24871. {
  24872. xtype: 'textfield',
  24873. fieldLabel: '功能URL',
  24874. bind: {
  24875. disabled: true,
  24876. value: '{form.scope_url}'
  24877. },
  24878. },
  24879. ]
  24880. },
  24881. {
  24882. xtype: 'cols',
  24883. items: [
  24884. {
  24885. xtype: 'textfield',
  24886. fieldLabel: '权限编码',
  24887. bind: {
  24888. value: '{form.permission_code}'
  24889. }
  24890. },
  24891. ],
  24892. },
  24893. {
  24894. xtype: 'cols',
  24895. items: [
  24896. {
  24897. xtype: 'textfield',
  24898. fieldLabel: '功能参数',
  24899. bind: {
  24900. value: '{form.scope_params}'
  24901. }
  24902. },
  24903. ],
  24904. },
  24905. ],
  24906. },
  24907. ],
  24908. },
  24909. ],
  24910. referenceHolder: true,
  24911. };
  24912. //# sourceMappingURL=RegisterModule.view.js.map
  24913. var RegisterModule = /** @class */ (function (_super) {
  24914. __extends(RegisterModule, _super);
  24915. function RegisterModule() {
  24916. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  24917. }
  24918. RegisterModule.prototype.onLoad = function () {
  24919. this.reloadTree("PC");
  24920. };
  24921. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  24922. var currTabKey = b.key;
  24923. if (currTabKey === '1') {
  24924. this.viewModel.set('form', '');
  24925. this.reloadTree("PC");
  24926. }
  24927. else {
  24928. this.viewModel.set('form', '');
  24929. this.reloadTree("PDA");
  24930. }
  24931. };
  24932. RegisterModule.prototype.reloadTree = function (type) {
  24933. var _this = this;
  24934. if ("PC" === type) {
  24935. this.setLoading(true);
  24936. getMenuTree({ type: "PC" }).then(function (res) {
  24937. if (res.success) {
  24938. _this.refs.tree1.store.setRootNode({
  24939. expanded: true,
  24940. children: res.data
  24941. });
  24942. }
  24943. }).finally(function () {
  24944. _this.setLoading(false);
  24945. });
  24946. }
  24947. else {
  24948. this.setLoading(true);
  24949. getMenuTree({ type: "PDA" }).then(function (res) {
  24950. if (res.success) {
  24951. _this.refs.tree2.store.setRoot({
  24952. expanded: true,
  24953. children: res.data
  24954. });
  24955. }
  24956. }).finally(function () {
  24957. _this.setLoading(false);
  24958. });
  24959. }
  24960. };
  24961. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  24962. var id = _$2.split(node.data.id, '_')[1];
  24963. if (!id) {
  24964. return;
  24965. }
  24966. this.viewModel.set('form.resource_parent', id);
  24967. };
  24968. RegisterModule.prototype.saveNode = function () {
  24969. var _this = this;
  24970. var tabKey = this.refs.tabs.activeTab.key;
  24971. // 检验菜单数据
  24972. var param = this.viewModel.get('form');
  24973. if (!param.resource_parent) {
  24974. msg$1('请选择一个父节点');
  24975. return;
  24976. }
  24977. if (!param.resource_name) {
  24978. msg$1('资源名称不能为空');
  24979. return;
  24980. }
  24981. if (!param.scope_url) {
  24982. msg$1('功能URL不能为空');
  24983. return;
  24984. }
  24985. var type;
  24986. if (tabKey === '1') {
  24987. type = 'PC';
  24988. }
  24989. else {
  24990. type = 'PDA';
  24991. }
  24992. this.setLoading(true);
  24993. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  24994. if (res.success) {
  24995. msg$1("注册成功");
  24996. _this.close();
  24997. }
  24998. }).finally(function () {
  24999. _this.setLoading(false);
  25000. });
  25001. };
  25002. return RegisterModule;
  25003. }(Scope));
  25004. //# sourceMappingURL=RegisterModule.js.map
  25005. var model$f = {
  25006. data: {
  25007. title: "模板选择",
  25008. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25009. moduleType: 1,
  25010. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25011. packagePath: "",
  25012. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25013. fileSavePath: "",
  25014. // 模块名称 "Dict"
  25015. moduleName: "NewModule",
  25016. // 页面标题 "字典维护"
  25017. pageTitle: "新模块",
  25018. // 单表查询
  25019. singleTable: {
  25020. sql: "select * from bas_dict",
  25021. // 新增或者删除所用的表
  25022. tableName: "",
  25023. // 是否分页查询
  25024. pagination: true,
  25025. // 是否需要删除
  25026. delete: true,
  25027. // 删除条件字段
  25028. deleteWhereColumn: "",
  25029. // 删除提示语
  25030. deleteTips: "确定要删除?",
  25031. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25032. editType: 2,
  25033. },
  25034. singleTableView: {
  25035. tableNameList: [
  25036. // { value: "aaa"},
  25037. ],
  25038. columnList: [
  25039. // { value: "aaa"},
  25040. ],
  25041. }
  25042. }
  25043. };
  25044. //# sourceMappingURL=CreateModule.model.js.map
  25045. var vjson$e = {
  25046. bind: {
  25047. title: '新建模块-{title}',
  25048. },
  25049. width: "55%",
  25050. height: "60%",
  25051. minWidth: 500,
  25052. minHeight: 400,
  25053. modal: true,
  25054. frame: true,
  25055. layout: 'card',
  25056. bbar: [
  25057. '->',
  25058. {
  25059. itemId: 'card-prev',
  25060. text: '&laquo; 上一步',
  25061. disabled: true,
  25062. listeners: {
  25063. click: 'scope.showPrevious',
  25064. },
  25065. },
  25066. {
  25067. itemId: 'card-next',
  25068. text: '下一步 &raquo;',
  25069. listeners: {
  25070. click: 'scope.showNext',
  25071. },
  25072. },
  25073. {
  25074. itemId: 'card-finish',
  25075. text: '立刻执行',
  25076. iconCls: 'x-fa fa-flash',
  25077. hidden: true,
  25078. listeners: {
  25079. click: 'scope.finish',
  25080. },
  25081. },
  25082. ],
  25083. items: [
  25084. {
  25085. vtitle: '模板选择',
  25086. reference: 'templateSelection',
  25087. layout: {
  25088. type: 'hbox',
  25089. pack: 'start',
  25090. align: 'stretch'
  25091. },
  25092. listeners: {
  25093. cardEnter: 'scope.templateEnter',
  25094. cardLevel: 'scope.templateLevel'
  25095. },
  25096. items: [
  25097. {
  25098. width: 150,
  25099. xtype: 'form',
  25100. border: false,
  25101. layout: {
  25102. type: 'vbox',
  25103. align: 'stretch'
  25104. },
  25105. defaults: {
  25106. border: false,
  25107. anchor: '100%',
  25108. margin: '5',
  25109. },
  25110. items: [
  25111. {
  25112. xtype: 'radiogroup',
  25113. bind: {
  25114. value: '{moduleType}'
  25115. },
  25116. layout: 'vbox',
  25117. defaults: {
  25118. border: false,
  25119. anchor: '100%',
  25120. margin: '5',
  25121. },
  25122. items: [
  25123. { boxLabel: '单表查询', inputValue: 1 },
  25124. { boxLabel: '主/明细查询', inputValue: 2 },
  25125. { boxLabel: '树/明细查询', inputValue: 3 },
  25126. { boxLabel: '卡片表单', inputValue: 4 },
  25127. { boxLabel: '主/详情查询', inputValue: 5 },
  25128. ]
  25129. },
  25130. ]
  25131. },
  25132. {
  25133. flex: 1,
  25134. region: 'center',
  25135. xtype: "panel",
  25136. border: false,
  25137. frame: true,
  25138. padding: "4px 8px",
  25139. html: "描述...",
  25140. }
  25141. ]
  25142. },
  25143. {
  25144. vtitle: '模块名称',
  25145. reference: 'moduleName',
  25146. layout: 'fit',
  25147. listeners: {
  25148. cardEnter: 'scope.moduleEnter',
  25149. cardLevel: 'scope.moduleLevel'
  25150. },
  25151. items: [
  25152. {
  25153. xtype: 'form',
  25154. border: false,
  25155. layout: {
  25156. type: 'vbox',
  25157. align: 'stretch'
  25158. },
  25159. defaults: {
  25160. border: false,
  25161. anchor: '100%',
  25162. margin: '5',
  25163. },
  25164. items: [
  25165. {
  25166. xtype: 'textfield',
  25167. fieldLabel: '包路径',
  25168. allowBlank: false,
  25169. bind: { value: '{packagePath}' },
  25170. },
  25171. {
  25172. xtype: 'textfield',
  25173. fieldLabel: '文件路径',
  25174. allowBlank: false,
  25175. bind: { value: '{fileSavePath}' },
  25176. },
  25177. {
  25178. xtype: 'textfield',
  25179. fieldLabel: '模块名',
  25180. allowBlank: false,
  25181. bind: { value: '{moduleName}' },
  25182. },
  25183. {
  25184. xtype: 'textfield',
  25185. fieldLabel: '菜单名',
  25186. allowBlank: false,
  25187. bind: { value: '{pageTitle}' },
  25188. },
  25189. ]
  25190. },
  25191. ]
  25192. },
  25193. {
  25194. vtitle: '确认结果',
  25195. reference: 'confirmResult',
  25196. layout: 'fit',
  25197. listeners: {
  25198. cardEnter: 'scope.optionEnter',
  25199. cardLevel: 'scope.optionLevel',
  25200. },
  25201. items: [
  25202. {
  25203. xtype: 'jsoneditor',
  25204. reference: 'jsoneditor'
  25205. }
  25206. ]
  25207. },
  25208. // ---------------------------------------------------------------------------------- 单表查询
  25209. {
  25210. vtitle: '查询SQL',
  25211. reference: 'singleTable_1',
  25212. layout: 'fit',
  25213. listeners: {
  25214. cardEnter: 'scope.editorEnter',
  25215. cardLevel: 'scope.editorLevel'
  25216. },
  25217. items: [
  25218. {
  25219. xtype: 'sqleditor',
  25220. }
  25221. ],
  25222. },
  25223. {
  25224. vtitle: '字段选项',
  25225. reference: 'singleTable_2',
  25226. layout: 'fit',
  25227. listeners: {
  25228. cardEnter: 'scope.columnEnter',
  25229. cardLevel: 'scope.columnLevel',
  25230. },
  25231. items: [
  25232. {
  25233. xtype: 'yvgrid',
  25234. border: false,
  25235. selModel: {
  25236. type: 'spreadsheet',
  25237. columnSelect: true,
  25238. pruneRemoved: false,
  25239. extensible: 'y'
  25240. },
  25241. plugins: {
  25242. clipboard: true,
  25243. selectionreplicator: true
  25244. },
  25245. reference: 'grid1',
  25246. idField: 'column_name',
  25247. hideFootbar: true,
  25248. tbar: {
  25249. xtype: 'toolbar',
  25250. items: [
  25251. {
  25252. xtype: 'button',
  25253. text: '添加',
  25254. iconCls: 'x-fa fa-plus-circle',
  25255. listeners: {
  25256. click: 'scope.addField'
  25257. }
  25258. },
  25259. {
  25260. xtype: 'button',
  25261. text: '删除',
  25262. iconCls: 'x-fa fa-minus-circle',
  25263. listeners: {
  25264. click: 'scope.removeField'
  25265. }
  25266. },
  25267. {
  25268. xtype: 'button',
  25269. text: '分析SQL',
  25270. iconCls: 'x-fa fa-refresh',
  25271. listeners: {
  25272. click: 'scope.parseSQL'
  25273. }
  25274. },
  25275. ]
  25276. },
  25277. columns: [
  25278. {
  25279. text: '字段名', dataIndex: 'column_name',
  25280. sortable: false,
  25281. menuDisabled: true,
  25282. width: 150,
  25283. editor: {
  25284. allowBlank: true,
  25285. selectOnFocus: false,
  25286. }
  25287. },
  25288. {
  25289. text: '字段中文', dataIndex: 'column_comment',
  25290. width: 150,
  25291. sortable: false,
  25292. menuDisabled: true,
  25293. editor: {
  25294. allowBlank: true,
  25295. selectOnFocus: false,
  25296. }
  25297. },
  25298. {
  25299. dataIndex: "column_useto",
  25300. // fix: ['system.getDict("column_useto")'],
  25301. header: "用途",
  25302. editor: {
  25303. xtype: 'combo',
  25304. allowBlank: false,
  25305. },
  25306. },
  25307. {
  25308. text: '主键', dataIndex: 'is_primary_key',
  25309. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25310. width: 48, resizable: false,
  25311. },
  25312. {
  25313. text: '必填', dataIndex: 'not_null',
  25314. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25315. width: 48, resizable: false,
  25316. },
  25317. {
  25318. text: '长度', dataIndex: 'column_size',
  25319. sortable: false, menuDisabled: true,
  25320. xtype: 'numbercolumn', format: '0',
  25321. editor: { allowBlank: true, selectOnFocus: true }
  25322. },
  25323. {
  25324. text: '字典', dataIndex: 'column_dict',
  25325. sortable: false, menuDisabled: true,
  25326. width: 200,
  25327. editor: {
  25328. allowBlank: true,
  25329. }
  25330. },
  25331. {
  25332. text: 'UI组件', dataIndex: 'column_ui',
  25333. sortable: false, menuDisabled: true,
  25334. // fix: ['system.getDict("column_ui")'],
  25335. width: 150,
  25336. editor: {
  25337. xtype: 'combo',
  25338. allowBlank: true,
  25339. }
  25340. },
  25341. {
  25342. dataIndex: 'data_type',
  25343. hidden: true,
  25344. },
  25345. ]
  25346. }
  25347. ],
  25348. },
  25349. {
  25350. vtitle: '其他选项',
  25351. reference: 'singleTable_3',
  25352. isEnd: true,
  25353. listeners: {
  25354. cardEnter: 'scope.extendEnter',
  25355. cardLevel: 'scope.extendLevel',
  25356. },
  25357. layout: 'fit',
  25358. items: [
  25359. {
  25360. xtype: 'form',
  25361. border: false,
  25362. layout: {
  25363. type: 'vbox',
  25364. align: 'stretch'
  25365. },
  25366. defaults: {
  25367. border: false,
  25368. anchor: '100%',
  25369. margin: '5',
  25370. },
  25371. items: [
  25372. {
  25373. xtype: 'checkbox',
  25374. fieldLabel: '需要分页',
  25375. labelWidth: 100,
  25376. bind: {
  25377. value: '{singleTable.pagination}',
  25378. },
  25379. },
  25380. {
  25381. xtype: 'combobox',
  25382. fieldLabel: '操作数据库表',
  25383. labelWidth: 100,
  25384. publishes: 'singleTable.tableName',
  25385. displayField: 'value',
  25386. valueField: 'value',
  25387. bind: {
  25388. data: '{singleTableView.tableNameList}',
  25389. value: '{singleTable.tableName}',
  25390. },
  25391. },
  25392. {
  25393. xtype: 'checkboxfield',
  25394. fieldLabel: '需要删除',
  25395. labelWidth: 100,
  25396. bind: {
  25397. value: '{singleTable.delete}',
  25398. },
  25399. },
  25400. {
  25401. xtype: 'combobox',
  25402. fieldLabel: '删除条件字段',
  25403. labelWidth: 100,
  25404. publishes: 'singleTable.deleteWhereColumn',
  25405. displayField: 'value',
  25406. valueField: 'value',
  25407. bind: {
  25408. data: '{singleTableView.columnList}',
  25409. hidden: '{!singleTable.delete}',
  25410. value: '{singleTable.deleteWhereColumn}',
  25411. },
  25412. },
  25413. {
  25414. xtype: 'textfield',
  25415. fieldLabel: '删除提示语句',
  25416. labelWidth: 100,
  25417. bind: {
  25418. hidden: '{!singleTable.delete}',
  25419. value: '{singleTable.deleteTips}',
  25420. },
  25421. },
  25422. {
  25423. fieldLabel: '新增与编辑',
  25424. labelWidth: 100,
  25425. xtype: 'radiogroup',
  25426. bind: {
  25427. value: '{singleTable.editType}'
  25428. },
  25429. layout: 'vbox',
  25430. defaults: {
  25431. border: false,
  25432. anchor: '100%',
  25433. margin: '5',
  25434. },
  25435. items: [
  25436. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25437. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25438. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25439. ]
  25440. },
  25441. ]
  25442. }
  25443. ]
  25444. },
  25445. // ---------------------------------------------------------------------------------- 主/明细查询
  25446. {
  25447. vtitle: '主表查询SQL',
  25448. reference: 'mainDetailTable_1',
  25449. layout: 'fit',
  25450. listeners: {},
  25451. items: [],
  25452. },
  25453. {
  25454. vtitle: '主表字段选项',
  25455. reference: 'mainDetailTable_2',
  25456. layout: 'fit',
  25457. listeners: {},
  25458. items: [],
  25459. },
  25460. {
  25461. vtitle: '主表其他选项',
  25462. reference: 'mainDetailTable_3',
  25463. layout: 'fit',
  25464. listeners: {},
  25465. items: [],
  25466. },
  25467. {
  25468. vtitle: '子表查询SQL',
  25469. reference: 'mainDetailTable_4',
  25470. layout: 'fit',
  25471. listeners: {},
  25472. items: [],
  25473. },
  25474. {
  25475. vtitle: '子表字段选项',
  25476. reference: 'mainDetailTable_5',
  25477. layout: 'fit',
  25478. listeners: {},
  25479. items: [],
  25480. },
  25481. {
  25482. vtitle: '子表其他选项',
  25483. reference: 'mainDetailTable_6',
  25484. isEnd: true,
  25485. layout: 'fit',
  25486. listeners: {},
  25487. items: [],
  25488. },
  25489. // ---------------------------------------------------------------------------------- 树/明细查询
  25490. // ---------------------------------------------------------------------------------- 卡片表单
  25491. {
  25492. vtitle: '表单字段',
  25493. reference: 'cardForm_1',
  25494. layout: 'fit',
  25495. listeners: {},
  25496. items: [],
  25497. },
  25498. {
  25499. vtitle: '表单初始化',
  25500. reference: 'cardForm_2',
  25501. isEnd: true,
  25502. layout: 'fit',
  25503. listeners: {},
  25504. items: [],
  25505. },
  25506. ]
  25507. };
  25508. //# sourceMappingURL=CreateModule.view.js.map
  25509. // noinspection TypeScriptCheckImport
  25510. function getSingleTableData(origin) {
  25511. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25512. var _a, _b, _c;
  25513. var data = {
  25514. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25515. package: _$2.replace(origin.packagePath, /\//g, "."),
  25516. groovyClass: origin.moduleName,
  25517. qClass: queryDslInfo.qClass,
  25518. qClassTable: queryDslInfo.qClassTable,
  25519. queryColumns: [],
  25520. insertColumns: [],
  25521. updateColumns: [],
  25522. updateWheres: [],
  25523. deleteWheres: [],
  25524. gridColumns: [],
  25525. sql: origin.sql,
  25526. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25527. addButton: origin.editType !== 1,
  25528. saveButton: origin.editType === 2,
  25529. deleteButton: true,
  25530. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25531. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25532. fileSavePath: origin.fileSavePath,
  25533. };
  25534. origin.columnList.forEach(function (column) {
  25535. 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;
  25536. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25537. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25538. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25539. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25540. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25541. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25542. if (query) {
  25543. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25544. }
  25545. if (insert) {
  25546. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25547. }
  25548. if (update) {
  25549. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25550. }
  25551. if (grid) {
  25552. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25553. if (column_dict) {
  25554. gridColumn.fix = { dictName: column_dict };
  25555. }
  25556. if (origin.editType == 2 && (insert || update)) {
  25557. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25558. if (column_dict) {
  25559. gridColumn.editor.fix = { dictName: column_dict };
  25560. }
  25561. }
  25562. data.gridColumns.push(gridColumn);
  25563. }
  25564. if (is_primary_key) {
  25565. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25566. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25567. }
  25568. });
  25569. return data;
  25570. });
  25571. }
  25572. // noinspection HttpUrlsUsage
  25573. var urlPrefix = "/static/studio-template/single_table";
  25574. function generateCode(data) {
  25575. return Promise.all([
  25576. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25577. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25578. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25579. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25580. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25581. ]).then(function (values) {
  25582. var groovy = handlebars.compile(values[0]);
  25583. var mybatis = handlebars.compile(values[1]);
  25584. var controller = handlebars.compile(values[2]);
  25585. var view = handlebars.compile(values[3]);
  25586. var model = handlebars.compile(values[4]);
  25587. var code = {
  25588. groovy: groovy(data),
  25589. mybatis: mybatis(data),
  25590. controller: controller(data),
  25591. view: view(data),
  25592. model: model(data),
  25593. };
  25594. return code;
  25595. });
  25596. }
  25597. //# sourceMappingURL=SingleTableCodegen.js.map
  25598. var CreateModule = /** @class */ (function (_super) {
  25599. __extends(CreateModule, _super);
  25600. function CreateModule() {
  25601. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25602. _this.columns = [];
  25603. return _this;
  25604. }
  25605. CreateModule.prototype.onLoad = function () {
  25606. this.refs.grid1.setData([]);
  25607. };
  25608. CreateModule.prototype.addField = function () {
  25609. this.refs.grid1.appendEditRow({
  25610. column_name: '',
  25611. column_comment: '',
  25612. is_primary_key: false,
  25613. not_null: true,
  25614. column_domain: '',
  25615. data_type: '',
  25616. column_size: 0,
  25617. decimal_digits: 0,
  25618. default_value: '',
  25619. column_dict: '',
  25620. column_ui: '',
  25621. column_note: '',
  25622. }, 0);
  25623. };
  25624. CreateModule.prototype.removeField = function () {
  25625. var _this = this;
  25626. var rows = [];
  25627. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25628. rows.push(r);
  25629. });
  25630. _$2.forEach(rows, function (r) {
  25631. _this.refs.grid1.getStore().remove(r);
  25632. });
  25633. };
  25634. CreateModule.prototype.parseSQL = function (sender) {
  25635. var _this = this;
  25636. var sql = this.viewModel.get('singleTable.sql');
  25637. sender.up('window').setLoading(true);
  25638. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25639. parseSqlApi(sql).then(function (parseResult) {
  25640. if (!parseResult.success) {
  25641. msg$1(parseResult.msg);
  25642. return;
  25643. }
  25644. var tableNameList = [];
  25645. var columnList = [];
  25646. var singleTableTableName;
  25647. var singleTableDeleteWhereColumn;
  25648. _this.refs.grid1.setData([]);
  25649. var rows = _this.refs.grid1.getDataRows();
  25650. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25651. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25652. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25653. return;
  25654. }
  25655. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25656. tableNameList.push({ value: tableName });
  25657. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25658. columnList.push({ value: columnName });
  25659. if (!singleTableTableName)
  25660. singleTableTableName = tableName;
  25661. if (!singleTableDeleteWhereColumn)
  25662. singleTableDeleteWhereColumn = columnName;
  25663. // 已经加过这个列了
  25664. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25665. if (rowExists) {
  25666. return;
  25667. }
  25668. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25669. if (columnRow) {
  25670. _this.refs.grid1.appendEditRow({
  25671. table_name: tableName,
  25672. column_name: columnRow.column_name,
  25673. column_comment: columnRow.column_comment,
  25674. column_useto: 2,
  25675. is_primary_key: columnRow.is_primary_key,
  25676. not_null: columnRow.not_null,
  25677. column_size: columnRow.column_size,
  25678. column_dict: columnRow.column_dict,
  25679. column_ui: columnRow.column_ui,
  25680. data_type: columnRow.data_type,
  25681. });
  25682. if (columnRow.is_primary_key)
  25683. singleTableDeleteWhereColumn = columnName;
  25684. }
  25685. else {
  25686. _this.refs.grid1.appendEditRow({
  25687. table_name: tableName,
  25688. column_name: columnName,
  25689. column_useto: 2,
  25690. });
  25691. }
  25692. });
  25693. _this.viewModel.set("singleTableView.columnList", columnList);
  25694. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25695. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25696. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25697. }).finally(function () {
  25698. sender.up('window').setLoading(false);
  25699. });
  25700. }).catch(function () {
  25701. sender.up('window').setLoading(false);
  25702. });
  25703. };
  25704. CreateModule.prototype.templateEnter = function (sender) {
  25705. };
  25706. CreateModule.prototype.templateLevel = function (sender, opt) {
  25707. if (!this.viewModel.get('moduleType')) {
  25708. msg$1('请选择模板类型');
  25709. opt.cancel = true;
  25710. return;
  25711. }
  25712. };
  25713. CreateModule.prototype.moduleEnter = function (sender) {
  25714. };
  25715. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25716. if (!sender.down('form').isValid()) {
  25717. opt.cancel = true;
  25718. return;
  25719. }
  25720. };
  25721. CreateModule.prototype.editorEnter = function (sender) {
  25722. var editor = sender.down('sqleditor');
  25723. editor.setValue(this.viewModel.get('singleTable.sql'));
  25724. };
  25725. CreateModule.prototype.editorLevel = function (sender, opt) {
  25726. var editor = sender.down('sqleditor');
  25727. var sql = editor.getValue();
  25728. if (!sql) {
  25729. msg$1('查询SQL语句必填');
  25730. opt.cancel = true;
  25731. return;
  25732. }
  25733. this.viewModel.set('singleTable.sql', sql);
  25734. };
  25735. CreateModule.prototype.columnEnter = function (sender) {
  25736. };
  25737. CreateModule.prototype.columnLevel = function (sender, opt) {
  25738. };
  25739. CreateModule.prototype.extendEnter = function (sender) {
  25740. };
  25741. CreateModule.prototype.extendLevel = function (sender, opt) {
  25742. };
  25743. // 确认结果 - Enter
  25744. CreateModule.prototype.optionEnter = function (sender) {
  25745. var _this = this;
  25746. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25747. var moduleType = this.viewModel.get("moduleType");
  25748. var data = this.viewModel.getData();
  25749. var code = "";
  25750. var origin = {};
  25751. if (moduleType === 1) {
  25752. var singleTable = data.singleTable;
  25753. var editColumns = this.refs.grid1.getDataRows();
  25754. origin.moduleType = data.moduleType;
  25755. origin.packagePath = data.packagePath;
  25756. origin.fileSavePath = data.fileSavePath;
  25757. origin.moduleName = data.moduleName;
  25758. origin.pageTitle = data.pageTitle;
  25759. if (singleTable) {
  25760. origin.sql = singleTable.sql;
  25761. origin.tableName = singleTable.tableName;
  25762. origin.pagination = singleTable.pagination;
  25763. origin.delete = singleTable.delete;
  25764. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25765. origin.deleteTips = singleTable.deleteTips;
  25766. origin.editType = singleTable.editType;
  25767. }
  25768. origin.columnList = [];
  25769. origin.queryColumns = [];
  25770. origin.insertColumns = [];
  25771. origin.updateColumns = [];
  25772. origin.gridColumns = [];
  25773. editColumns.forEach(function (column) {
  25774. var row = {
  25775. table_name: column.table_name,
  25776. column_name: column.column_name,
  25777. column_comment: column.column_comment,
  25778. is_primary_key: column.is_primary_key,
  25779. not_null: column.not_null,
  25780. column_size: column.column_size,
  25781. column_dict: column.column_dict,
  25782. column_ui: column.column_ui,
  25783. data_type: column.data_type,
  25784. column_type: column.column_type,
  25785. };
  25786. origin.columnList.push(row);
  25787. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25788. var column_name = column.column_name, column_useto = column.column_useto;
  25789. switch (column_useto) {
  25790. case 1:
  25791. origin.queryColumns.push(column_name);
  25792. break;
  25793. case 2:
  25794. origin.gridColumns.push(column_name);
  25795. break;
  25796. case 3:
  25797. origin.queryColumns.push(column_name);
  25798. origin.gridColumns.push(column_name);
  25799. break;
  25800. }
  25801. origin.insertColumns.push(column_name);
  25802. origin.updateColumns.push(column_name);
  25803. });
  25804. }
  25805. this.setLoading(true);
  25806. getSingleTableData(origin).then(function (data) {
  25807. code = JSON.stringify(data, null, 4);
  25808. window['lastTemplateData'] = code;
  25809. var editor = _this.refs.jsoneditor;
  25810. editor.setCode(code);
  25811. }).finally(function () { return _this.setLoading(false); });
  25812. };
  25813. // 确认结果 - Level
  25814. CreateModule.prototype.optionLevel = function (sender, opt) {
  25815. };
  25816. // 上一步
  25817. CreateModule.prototype.showPrevious = function () {
  25818. this.doCardNavigation(false);
  25819. };
  25820. // 下一步
  25821. CreateModule.prototype.showNext = function () {
  25822. this.doCardNavigation(true, true);
  25823. };
  25824. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25825. if (isNext === void 0) { isNext = true; }
  25826. if (isCancelable === void 0) { isCancelable = false; }
  25827. var layout = this._handle.getLayout();
  25828. var activeItem = layout.activeItem;
  25829. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25830. if (isNext)
  25831. this.prevCard = reference;
  25832. var activeCard;
  25833. if (reference === "templateSelection") {
  25834. if (isNext) {
  25835. activeCard = this.refs['moduleName'];
  25836. }
  25837. }
  25838. else if (reference === "moduleName") {
  25839. if (isNext) {
  25840. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25841. var moduleType = this.viewModel.get("moduleType");
  25842. switch (moduleType) {
  25843. case 1:
  25844. activeCard = this.refs['singleTable_1'];
  25845. break;
  25846. case 2:
  25847. activeCard = this.refs['mainDetailTable_1'];
  25848. break;
  25849. case 3:
  25850. // activeCard =
  25851. break;
  25852. case 4:
  25853. activeCard = this.refs['cardForm_1'];
  25854. break;
  25855. }
  25856. }
  25857. else {
  25858. activeCard = this.refs['templateSelection'];
  25859. }
  25860. }
  25861. else if (reference === "confirmResult") {
  25862. if (!isNext) {
  25863. activeCard = this.refs[this.prevCard];
  25864. }
  25865. }
  25866. else {
  25867. var name = reference.split('_')[0];
  25868. var idx = parseInt(reference.split('_')[1], 10);
  25869. if (isNext) {
  25870. if (isEnd) {
  25871. activeCard = this.refs['confirmResult'];
  25872. }
  25873. else {
  25874. idx += 1;
  25875. }
  25876. }
  25877. else {
  25878. idx -= 1;
  25879. }
  25880. if (idx <= 0) {
  25881. activeCard = this.refs['moduleName'];
  25882. }
  25883. else if (!activeCard) {
  25884. activeCard = this.refs[name + "_" + idx];
  25885. }
  25886. }
  25887. // 按钮状态
  25888. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  25889. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  25890. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  25891. // 设置下一页显示
  25892. if (activeCard) {
  25893. var optCancel = { cancel: false };
  25894. // 发出 cardLevel 事件
  25895. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  25896. if (isCancelable && optCancel.cancel) {
  25897. // 取消了
  25898. return;
  25899. }
  25900. layout.setActiveItem(activeCard);
  25901. this.viewModel.set('title', layout.activeItem.vtitle);
  25902. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  25903. }
  25904. };
  25905. // 立刻执行
  25906. CreateModule.prototype.finish = function (sender) {
  25907. var _this = this;
  25908. var parent = sender.up('window');
  25909. var editor = this.refs.jsoneditor;
  25910. var data = JSON.parse(editor.getCode());
  25911. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25912. var moduleType = this.viewModel.get("moduleType");
  25913. if (moduleType === 1) {
  25914. this.setLoading(true);
  25915. generateCode(data).then(function (code) {
  25916. console.log("===> ", code);
  25917. _this.setLoading(true);
  25918. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  25919. .then(function () {
  25920. msg$1("创建成功!");
  25921. parent.close();
  25922. handles$1.fileTree.reload();
  25923. }).finally(function () { return _this.setLoading(false); });
  25924. }).finally(function () { return _this.setLoading(false); });
  25925. }
  25926. };
  25927. return CreateModule;
  25928. }(Scope));
  25929. //# sourceMappingURL=CreateModule.js.map
  25930. function getModuleId(path) {
  25931. var separator = "/";
  25932. var sps = path.split(separator);
  25933. var joinSps = sps.join('$');
  25934. if (!joinSps) {
  25935. return "ROOT";
  25936. }
  25937. return joinSps;
  25938. }
  25939. /**
  25940. * Module数据转换成Tree数据
  25941. */
  25942. function modulesToTreeData(modules) {
  25943. var separator = "/";
  25944. var treeNodeMap = new Map();
  25945. var root = {
  25946. type: "Dir",
  25947. path: "",
  25948. expanded: true,
  25949. leaf: false,
  25950. children: [],
  25951. };
  25952. root.id = getModuleId(root.path);
  25953. treeNodeMap.set(root.path, root);
  25954. modules.forEach(function (module) {
  25955. var _a;
  25956. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  25957. if (paths.length <= 0)
  25958. return;
  25959. var path = [];
  25960. var parent = root;
  25961. paths.forEach(function (dirName, idx) {
  25962. var parentPath = path.join(separator);
  25963. parent = treeNodeMap.get(parentPath);
  25964. path.push(dirName);
  25965. var currentPath = path.join(separator);
  25966. var child = treeNodeMap.get(currentPath);
  25967. if (child == null) {
  25968. // 获取当前path 绝对路径
  25969. var indexLength = module.absolutePath.indexOf(currentPath);
  25970. var currentAbsolutePath = "";
  25971. if (indexLength > 0) {
  25972. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  25973. }
  25974. child = {
  25975. type: "Dir",
  25976. path: currentPath,
  25977. absolutePath: currentAbsolutePath,
  25978. leaf: false,
  25979. children: [],
  25980. text: dirName
  25981. };
  25982. child.id = getModuleId(child.path);
  25983. parent.children.push(child);
  25984. treeNodeMap.set(child.path, child);
  25985. }
  25986. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  25987. var leaf = {
  25988. type: "Module",
  25989. path: module.path + separator + module.name,
  25990. absolutePath: module.absolutePath,
  25991. leaf: true,
  25992. text: module.name,
  25993. module: module,
  25994. };
  25995. leaf.id = getModuleId(leaf.path);
  25996. child.children.push(leaf);
  25997. treeNodeMap.set(leaf.path, leaf);
  25998. }
  25999. });
  26000. });
  26001. // 排序处理
  26002. treeNodeMap.forEach(function (module) {
  26003. if (module.children) {
  26004. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26005. module.children.length = 0;
  26006. children.forEach(function (item) { return module.children.push(item); });
  26007. }
  26008. });
  26009. return root;
  26010. }
  26011. function showDialog(sender, option) {
  26012. var _a, _b;
  26013. var win = new Ext.Window({
  26014. autoDestroy: true,
  26015. title: option.title,
  26016. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26017. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26018. resizable: false,
  26019. closable: true,
  26020. modal: true,
  26021. maximizable: false,
  26022. minimizable: false,
  26023. // constrainHeader: true,
  26024. constrain: true,
  26025. layout: 'fit',
  26026. animateTarget: sender,
  26027. buttonAlign: 'center',
  26028. items: [
  26029. {
  26030. xtype: "form",
  26031. layout: "hbox",
  26032. margin: '10px 20px',
  26033. border: 0,
  26034. items: option.items
  26035. }
  26036. ],
  26037. //窗口按钮
  26038. fbar: [
  26039. {
  26040. xtype: 'button', text: '保存', handler: function (btn) {
  26041. //窗口获取表单
  26042. var form = win.down('form');
  26043. var vaildSuccess = form.isValid();
  26044. if (!vaildSuccess) {
  26045. return;
  26046. }
  26047. option.submitFunc(form);
  26048. }
  26049. },
  26050. {
  26051. xtype: 'button', text: '取消', handler: function (btn) {
  26052. //窗口关闭
  26053. btn.up('window').close();
  26054. }
  26055. }
  26056. ],
  26057. });
  26058. win.show();
  26059. }
  26060. function showCreateFolderWin(sender, parentPath) {
  26061. showDialog(sender, {
  26062. title: '新建文件夹',
  26063. height: 150,
  26064. items: [
  26065. {
  26066. xtype: "textfield",
  26067. name: "filename",
  26068. fieldLabel: "文件夹名称",
  26069. allowBlank: false,
  26070. selectOnFocus: true,
  26071. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26072. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26073. labelWidth: 80,
  26074. width: "100%",
  26075. listeners: {
  26076. afterrender: function (sender) {
  26077. _$2.defer(function () {
  26078. sender.focus();
  26079. });
  26080. }
  26081. }
  26082. },
  26083. ],
  26084. submitFunc: function (form) {
  26085. var filename = form.down('textfield[name="filename"]').getValue();
  26086. createFolder(parentPath, filename).then(function (res) {
  26087. if (res.success) {
  26088. msg$1('创建成功');
  26089. handles$1.fileTree.reload();
  26090. form.up('window').close();
  26091. }
  26092. else {
  26093. showErrorDialog$1(res.msg);
  26094. }
  26095. }).catch(function (e) {
  26096. showErrorDialog$1(e.responseJSON.msg);
  26097. });
  26098. }
  26099. });
  26100. }
  26101. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26102. var dlg = new CreateModule();
  26103. dlg.showDialog(sender, {}, {
  26104. data: {
  26105. packagePath: path,
  26106. fileSavePath: absolutePath,
  26107. }
  26108. });
  26109. }
  26110. function registerModule$1(sender, path, name, icon) {
  26111. // 前缀 com/galaxis/wms 写死了
  26112. var dlg = new RegisterModule();
  26113. dlg.showDialog(sender, {}, {
  26114. data: {
  26115. form: {
  26116. scope_url: path.replace("com/galaxis/wms", "."),
  26117. resource_name: name,
  26118. resource_icon: icon,
  26119. }
  26120. }
  26121. });
  26122. }
  26123. function showCreateEmptyModule(sender, path) {
  26124. var win = new Ext.Window({
  26125. autoDestroy: true,
  26126. title: "新建空模块",
  26127. width: 400,
  26128. height: 150,
  26129. resizable: true,
  26130. closable: true,
  26131. maximizable: true,
  26132. minimizable: true,
  26133. plain: true,
  26134. // constrainHeader: true,
  26135. constrain: true,
  26136. layout: 'fit',
  26137. animateTarget: sender,
  26138. buttonAlign: 'center',
  26139. items: [
  26140. {
  26141. xtype: "form",
  26142. layout: "hbox",
  26143. margin: '10px 20px',
  26144. border: 0,
  26145. items: [
  26146. {
  26147. flex: 1,
  26148. layout: 'vbox',
  26149. items: [
  26150. {
  26151. xtype: "textfield",
  26152. name: "filename",
  26153. fieldLabel: "模块名",
  26154. flex: 1,
  26155. allowBlank: false,
  26156. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26157. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26158. labelWidth: 50,
  26159. width: "100%",
  26160. },
  26161. ]
  26162. },
  26163. ]
  26164. }
  26165. ],
  26166. //窗口按钮
  26167. buttons: [
  26168. {
  26169. xtype: 'button', text: '保存', handler: function (btn) {
  26170. //窗口获取表单
  26171. var form = win.down('form');
  26172. var vaildSuccess = form.isValid();
  26173. if (!vaildSuccess) {
  26174. return;
  26175. }
  26176. var filename = form.down('textfield[name="filename"]').getValue();
  26177. createEmptyModule(path, filename).then(function (res) {
  26178. if (res.success) {
  26179. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26180. handles$1.fileTree.reload();
  26181. win.close();
  26182. }
  26183. else {
  26184. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26185. }
  26186. }).catch(function (e) {
  26187. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26188. });
  26189. }
  26190. },
  26191. {
  26192. xtype: 'button', text: '取消', handler: function (btn) {
  26193. //窗口关闭
  26194. win.close();
  26195. }
  26196. }
  26197. ]
  26198. });
  26199. win.show();
  26200. }
  26201. //# sourceMappingURL=FileHelp.js.map
  26202. function initFileTree () {
  26203. Ext.define('com.yvan.studio.FileTree', {
  26204. extend: 'com.yvan.studio.StateTree',
  26205. xtype: 'filetree',
  26206. tooltip: '文件',
  26207. iconCls: 'x-fa fa-file',
  26208. rootVisible: false,
  26209. useArrows: true,
  26210. colspan: 2,
  26211. lines: true,
  26212. reference: 'filetree',
  26213. multiSelect: true,
  26214. getStateFilename: function () {
  26215. return getCurrentProject().uuid + "/filetree.json";
  26216. },
  26217. openNode: function () {
  26218. var selection = this.getSelection();
  26219. var _a = __read(selection, 1), record = _a[0];
  26220. if (!record) {
  26221. return;
  26222. }
  26223. var raw = record.raw;
  26224. if (raw.type === 'Dir') {
  26225. return;
  26226. }
  26227. if (raw.type === "Module" && raw.module) {
  26228. eventBus.publish(EventType.ModuleOpen, raw);
  26229. }
  26230. },
  26231. openInIdea: function () {
  26232. var _a = __read(this.getSelection(), 1), record = _a[0];
  26233. if (record) {
  26234. var data = record.data;
  26235. if (data.type === "Module") {
  26236. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26237. native.openInIdea(data.module.groovyFile.absolutePath);
  26238. }
  26239. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26240. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26241. }
  26242. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26243. native.openInIdea(data.module.jsViewFile.absolutePath);
  26244. }
  26245. return;
  26246. }
  26247. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26248. }
  26249. },
  26250. deleteSelection: function () {
  26251. var selection = this.getSelection();
  26252. var pathList = [];
  26253. _.forEach(selection, function (item) {
  26254. if (item.data.type === "Dir") {
  26255. pathList.push({ path: item.data.path, isFolder: true });
  26256. }
  26257. else {
  26258. pathList.push({ path: item.data.path, isFolder: false });
  26259. }
  26260. });
  26261. {
  26262. return;
  26263. }
  26264. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26265. //
  26266. // Ext.Msg.confirm('提示', title, (btn) => {
  26267. // if (btn === 'yes') {
  26268. // deleteFileOrFolder(raw.path, title, true)
  26269. // }
  26270. // })
  26271. // const title = '您确定要删除(' + raw.path + ')吗?'
  26272. // deleteFileOrFolder(raw.path, title, false)
  26273. },
  26274. listeners: {
  26275. itemverify: function () {
  26276. this.openNode();
  26277. },
  26278. afterrender: function (me) {
  26279. console.log('filetree_afterrender', 'reloadIfNeed');
  26280. moduleStore.registe(me.subscribeModule.bind(this));
  26281. moduleStore.reloadIfNeed("PC");
  26282. },
  26283. destroy: function (me) {
  26284. console.log('filetree_destroy');
  26285. moduleStore.unregiste(me.subscribeModule.bind(this));
  26286. },
  26287. itemcontextmenu: function (sender, node, element, idx, e) {
  26288. e.preventDefault();
  26289. var raw = node.raw;
  26290. var option = {};
  26291. if (raw.type === 'Dir') {
  26292. // 文件夹右键
  26293. option = {
  26294. shadow: 'frame', allowOtherMenus: true,
  26295. items: [
  26296. {
  26297. text: '新建空模块',
  26298. iconCls: 'x-fa fa-plus-circle',
  26299. handler: function (sender) {
  26300. showCreateEmptyModule(sender, raw.path);
  26301. }
  26302. },
  26303. {
  26304. text: '新建模块',
  26305. iconCls: 'x-fa fa-plus-circle',
  26306. handler: function (sender) {
  26307. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26308. }
  26309. },
  26310. '-',
  26311. {
  26312. text: '新建文件夹',
  26313. iconCls: 'x-fa fa-folder-o',
  26314. handler: function (sender) {
  26315. var parentPath = raw.path;
  26316. showCreateFolderWin(sender, parentPath);
  26317. }
  26318. },
  26319. {
  26320. text: '复制路径',
  26321. iconCls: 'x-fa fa-external-link',
  26322. handler: function (sender) {
  26323. native.clipboardSet(raw.path);
  26324. }
  26325. },
  26326. ]
  26327. };
  26328. }
  26329. else {
  26330. // 文件右键
  26331. option = {
  26332. shadow: 'frame', allowOtherMenus: true,
  26333. items: [
  26334. // {
  26335. // text: '重命名',
  26336. // iconCls: 'x-fa fa-terminal',
  26337. // handler(sender) {
  26338. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26339. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26340. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26341. // }
  26342. // },
  26343. // {
  26344. // text: '另存为',
  26345. // iconCls: 'x-fa fa-exchange',
  26346. // handler(sender) {
  26347. // console.error('没做')
  26348. // }
  26349. // },
  26350. {
  26351. text: '复制路径',
  26352. iconCls: 'x-fa fa-external-link',
  26353. handler: function (sender) {
  26354. native.clipboardSet(raw.path);
  26355. }
  26356. },
  26357. '-',
  26358. {
  26359. text: '注册模块',
  26360. iconCls: 'x-fa fa-sign-in',
  26361. handler: function (sender) {
  26362. registerModule$1(sender, raw.path);
  26363. }
  26364. },
  26365. ]
  26366. };
  26367. }
  26368. var treeMenu = new Ext.menu.Menu(option);
  26369. treeMenu.showAt(e.getXY());
  26370. },
  26371. },
  26372. tbar: [
  26373. {
  26374. xtype: 'button',
  26375. iconCls: 'x-fa fa-crosshairs',
  26376. tooltip: '选中当前打开的文件',
  26377. handler: function (sender) {
  26378. msg$1('没做');
  26379. }
  26380. },
  26381. {
  26382. xtype: 'button',
  26383. iconCls: 'x-fa fa-link',
  26384. tooltip: '在IDEA中打开',
  26385. handler: function (sender) {
  26386. var scope = sender.up("filetree");
  26387. scope.openInIdea();
  26388. }
  26389. },
  26390. {
  26391. xtype: 'button',
  26392. iconCls: 'x-fa fa-refresh',
  26393. tooltip: '刷新',
  26394. handler: function (sender) {
  26395. var scope = sender.up("filetree");
  26396. scope.reload();
  26397. }
  26398. },
  26399. {
  26400. xtype: 'button',
  26401. iconCls: 'x-fa fa-percent',
  26402. tooltip: '监控',
  26403. handler: function (sender) {
  26404. // handles.mainWindow.showPerform()
  26405. }
  26406. },
  26407. ],
  26408. initComponent: function () {
  26409. setFileTree(this);
  26410. this.superclass.initComponent.apply(this, arguments);
  26411. // super.initComponent.apply(this, arguments)
  26412. },
  26413. subscribeModule: function (res) {
  26414. if (typeof res === 'object') {
  26415. var rootNode = modulesToTreeData(res.data);
  26416. this.setRootNode(rootNode);
  26417. this.restoreState();
  26418. handles$1.mainWindow.modules = res.data;
  26419. }
  26420. else if (typeof res === 'boolean') {
  26421. this.setLoading(res);
  26422. }
  26423. },
  26424. reload: function () {
  26425. console.log('filetree_reloadForce');
  26426. moduleStore.reloadForce("PC").then(function (res) {
  26427. });
  26428. }
  26429. });
  26430. }
  26431. //# sourceMappingURL=FileTree.js.map
  26432. function initDbTree () {
  26433. var define = {
  26434. extend: 'com.yvan.studio.StateTree',
  26435. xtype: 'dbtree',
  26436. tooltip: '数据库',
  26437. iconCls: 'x-fa fa-database',
  26438. rootVisible: false,
  26439. useArrows: true,
  26440. reference: 'dbtree',
  26441. multiSelect: true,
  26442. getStateFilename: function () {
  26443. return getCurrentProject().uuid + "/dbtree.json";
  26444. },
  26445. tbar: [
  26446. {
  26447. xtype: 'button',
  26448. iconCls: 'x-fa fa-crosshairs',
  26449. tooltip: '选中当前打开的表',
  26450. handler: function (sender) {
  26451. var _a;
  26452. // 获取当前选中的活动标签 tableColumn_bas_car
  26453. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26454. if (!locatPath) {
  26455. return;
  26456. }
  26457. handles$1.dbTree.selectPath(locatPath);
  26458. }
  26459. },
  26460. {
  26461. xtype: 'button',
  26462. iconCls: 'x-fa fa-refresh',
  26463. tooltip: '刷新',
  26464. handler: function (sender) {
  26465. handles$1.dbTree.reload();
  26466. }
  26467. },
  26468. {
  26469. xtype: 'button',
  26470. iconCls: 'x-fa fa-cloud-download',
  26471. tooltip: '重新拉取生成元数据(耗时很长!)',
  26472. handler: function (sender) {
  26473. handles$1.dbTree.dbToMetaAndReload(sender);
  26474. }
  26475. },
  26476. // {
  26477. // xtype: 'button',
  26478. // iconCls: 'x-fa fa-files-o',
  26479. // tooltip: '数据同步',
  26480. // handler(sender) {
  26481. //
  26482. // }
  26483. // },
  26484. {
  26485. xtype: 'button',
  26486. iconCls: 'x-fa fa-exchange',
  26487. tooltip: '数据结构同步',
  26488. handler: function (sender) {
  26489. // handles.mainWindow.showDataSync(sender)
  26490. }
  26491. },
  26492. {
  26493. xtype: 'button',
  26494. iconCls: 'x-fa fa-window-maximize',
  26495. tooltip: 'SQL查询分析器',
  26496. handler: function (sender) {
  26497. // handles.mainWindow.showDbCodeTemplate(sender)
  26498. }
  26499. },
  26500. {
  26501. xtype: 'button',
  26502. iconCls: 'x-fa fa-cubes',
  26503. tooltip: '数据域管理',
  26504. handler: function (sender) {
  26505. // handles.mainWindow.showColumnDomain()
  26506. }
  26507. },
  26508. {
  26509. xtype: 'button',
  26510. iconCls: 'x-fa fa-edit',
  26511. tooltip: '修改结构',
  26512. handler: function (sender) {
  26513. var tree = sender.up("treepanel");
  26514. var selection = tree.getSelection();
  26515. var _a = __read(selection, 1), node = _a[0];
  26516. if (!node) {
  26517. msg$1('请选择一个表');
  26518. return;
  26519. }
  26520. var raw = node.data.raw;
  26521. if (node.get('type') === 'table') ;
  26522. else if (node.get('type') === 'column') ;
  26523. }
  26524. },
  26525. ],
  26526. listeners: {
  26527. afterrender: function (me) {
  26528. setDbTree(this);
  26529. // 找管理器订阅刷新的事件
  26530. instance$1.registe(this.refreshData.bind(this));
  26531. instance$1.reloadIfNeed(undefined);
  26532. },
  26533. destory: function (me) {
  26534. setDbTree(undefined);
  26535. instance$1.unregiste(this.refreshData.bind(this));
  26536. },
  26537. itemcontextmenu: function (sender, node, element, idx, e) {
  26538. var _this = this;
  26539. e.preventDefault();
  26540. var option = {};
  26541. var raw = node.raw.raw;
  26542. if (node.get('type') === 'column') {
  26543. option = {
  26544. shadow: 'frame', allowOtherMenus: true,
  26545. items: [
  26546. {
  26547. text: '设计结构',
  26548. iconCls: 'x-fa fa-edit',
  26549. handler: function (sender) {
  26550. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26551. }
  26552. },
  26553. ]
  26554. };
  26555. }
  26556. else if (node.get('type') === 'table') {
  26557. option = {
  26558. shadow: 'frame', allowOtherMenus: true,
  26559. items: [
  26560. {
  26561. text: '新建',
  26562. iconCls: 'x-fa fa-plus',
  26563. handler: function (sender) {
  26564. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26565. }
  26566. },
  26567. {
  26568. text: '设计结构',
  26569. iconCls: 'x-fa fa-edit',
  26570. handler: function (sender) {
  26571. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26572. }
  26573. },
  26574. {
  26575. text: '重命名',
  26576. iconCls: 'x-fa fa-pencil',
  26577. handler: function (sender) {
  26578. _this.renameTable(sender, node.data.raw);
  26579. }
  26580. },
  26581. '-',
  26582. {
  26583. text: '删除',
  26584. iconCls: 'x-fa fa-minus',
  26585. handler: function (sender) {
  26586. _this.removeTable(sender, node.data.raw);
  26587. }
  26588. },
  26589. ]
  26590. };
  26591. }
  26592. var treeMenu = new Ext.menu.Menu(option);
  26593. treeMenu.showAt(e.getXY());
  26594. }
  26595. },
  26596. // DbTreeStore 刷新时,会回调到这个方法
  26597. refreshData: function (isLoadingState) {
  26598. var me = this;
  26599. if (typeof isLoadingState === 'boolean') {
  26600. me.setLoading(isLoadingState);
  26601. return;
  26602. }
  26603. var rootNode = getDbTree(instance$1.apiResponse);
  26604. me.setRootNode(rootNode);
  26605. this.restoreState();
  26606. },
  26607. renameTable: function (sender, tableRow) {
  26608. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26609. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26610. if (!res.data)
  26611. return;
  26612. var window = Ext.create('Ext.window.Window', {
  26613. title: 'SQL 预览',
  26614. height: 400,
  26615. width: 600,
  26616. modal: true,
  26617. animateTarget: sender,
  26618. maximizable: true,
  26619. layout: 'fit',
  26620. items: {
  26621. xtype: 'sqleditor',
  26622. value: res.data,
  26623. },
  26624. buttons: [
  26625. {
  26626. xtype: 'button',
  26627. text: '执行',
  26628. iconCls: 'x-fa fa-save',
  26629. handler: function (sender) {
  26630. var editor = sender.up('window').down('sqleditor');
  26631. var ddl = editor.getValue();
  26632. window.setLoading(true);
  26633. instance$1.pushToDbCommit({
  26634. schema_name: tableRow.schema_name,
  26635. table_name: name,
  26636. old_table_name: tableRow.table_name,
  26637. ddl: ddl,
  26638. }).then(function () {
  26639. handles$1.dbTree.reload();
  26640. window.close();
  26641. }).finally(function () { return window.setLoading(false); });
  26642. },
  26643. },
  26644. {
  26645. xtype: 'button',
  26646. text: '取消',
  26647. iconCls: 'x-fa fa-times',
  26648. handler: function () {
  26649. window.close();
  26650. }
  26651. },
  26652. ]
  26653. }).show();
  26654. });
  26655. });
  26656. },
  26657. removeTable: function (sender, tableRow) {
  26658. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26659. if (!res.data)
  26660. return;
  26661. var window = Ext.create('Ext.window.Window', {
  26662. title: 'SQL 预览',
  26663. height: 400,
  26664. width: 600,
  26665. modal: true,
  26666. animateTarget: sender,
  26667. maximizable: true,
  26668. layout: 'fit',
  26669. items: {
  26670. xtype: 'sqleditor',
  26671. value: res.data,
  26672. },
  26673. buttons: [
  26674. {
  26675. xtype: 'button',
  26676. text: '执行',
  26677. iconCls: 'x-fa fa-save',
  26678. handler: function (sender) {
  26679. var editor = sender.up('window').down('sqleditor');
  26680. var ddl = editor.getValue();
  26681. window.setLoading(true);
  26682. instance$1.pushToDbCommit({
  26683. schema_name: tableRow.schema_name,
  26684. table_name: tableRow.table_name,
  26685. ddl: ddl
  26686. })
  26687. .then(function () {
  26688. handles$1.dbTree.reload();
  26689. window.close();
  26690. }).finally(function () { return window.setLoading(false); });
  26691. }
  26692. },
  26693. {
  26694. xtype: 'button',
  26695. text: '取消',
  26696. iconCls: 'x-fa fa-times',
  26697. handler: function () {
  26698. window.close();
  26699. }
  26700. }
  26701. ]
  26702. }).show();
  26703. });
  26704. },
  26705. // hideHeaders: true,
  26706. // columns: [
  26707. // {
  26708. // xtype: 'treecolumn',
  26709. // text: '名称',
  26710. // dataIndex: 'text',
  26711. // flex: 2,
  26712. // }, {
  26713. // text: '描述',
  26714. // dataIndex: 'comment',
  26715. // flex: 1,
  26716. // }
  26717. // ],
  26718. reload: function () {
  26719. // 强制刷新 DbManager
  26720. instance$1.reloadForce(undefined);
  26721. },
  26722. dbToMetaAndReload: function () {
  26723. // 从数据库结构重新生成元数据
  26724. instance$1.dbToMetaAndReload();
  26725. }
  26726. };
  26727. Ext.define('com.yvan.studio.DbTree', define);
  26728. }
  26729. /**
  26730. * 将数据构建成 dbTree 需要的格式
  26731. */
  26732. function getDbTree(apiResponse) {
  26733. var rootNode = {
  26734. children: [],
  26735. expanded: true,
  26736. id: "ROOT",
  26737. leaf: false,
  26738. };
  26739. _$2.forEach(apiResponse, function (schemaRow) {
  26740. var schemaNode = {
  26741. id: 'schema$' + schemaRow.schema_name,
  26742. type: "schema",
  26743. expanded: true,
  26744. leaf: false,
  26745. iconCls: 'x-fa fa-th-large ',
  26746. text: schemaRow.schema_name,
  26747. raw: __assign({}, schemaRow),
  26748. children: [],
  26749. };
  26750. delete schemaNode.raw.table_list;
  26751. rootNode.children.push(schemaNode);
  26752. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26753. var _a;
  26754. var tableNode = {
  26755. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26756. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26757. comment: tableRow.description,
  26758. type: "table",
  26759. iconCls: 'x-fa fa-table',
  26760. expanded: false,
  26761. leaf: false,
  26762. children: [],
  26763. raw: __assign({}, tableRow)
  26764. };
  26765. delete tableNode.raw.column_list;
  26766. schemaNode.children.push(tableNode);
  26767. _$2.forEach(tableRow.column_list, function (columnRow) {
  26768. var _a;
  26769. var iconCls = 'x-fa fa-square-o';
  26770. if (columnRow.is_primary_key) {
  26771. iconCls = 'x-fa fa-key';
  26772. }
  26773. else if (columnRow.not_null) {
  26774. iconCls = 'x-fa fa-check-square';
  26775. }
  26776. var columnNode = {
  26777. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26778. type: "column",
  26779. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26780. comment: columnRow.column_comment,
  26781. leaf: true,
  26782. iconCls: iconCls,
  26783. raw: __assign({}, columnRow)
  26784. };
  26785. tableNode.children.push(columnNode);
  26786. }); // column
  26787. }); // table
  26788. }); // schema
  26789. return rootNode;
  26790. }
  26791. //# sourceMappingURL=DbTree.js.map
  26792. var ReportGridController = /** @class */ (function () {
  26793. function ReportGridController() {
  26794. }
  26795. ReportGridController.prototype.onLoad = function (sender) {
  26796. this.reload();
  26797. setReport(this);
  26798. };
  26799. ReportGridController.prototype.showSingle = function (sender) {
  26800. var _this = this;
  26801. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26802. if (record) {
  26803. handles.mainWindow.showFormSingle(record.data, function () {
  26804. _this.reload();
  26805. });
  26806. }
  26807. };
  26808. ReportGridController.prototype.filterChanged = function (sender, value) {
  26809. console.log('filterChange', sender, value);
  26810. this.view.store.clearFilter();
  26811. if (value) {
  26812. this.view.store.filterBy(function (record) {
  26813. var code = _.lowerCase(record.get('report_name'));
  26814. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26815. return (code.includes(value) ||
  26816. dict_desc_py.includes(value));
  26817. });
  26818. }
  26819. };
  26820. ReportGridController.prototype.onClearClick = function () {
  26821. var _a, _b;
  26822. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26823. };
  26824. ReportGridController.prototype.reload = function () {
  26825. var me = this;
  26826. me.getView().setLoading(true);
  26827. reportListApi().then(function (res) {
  26828. _.forEach(res.data, function (r) {
  26829. r.report_enable = r.report_enable === 1;
  26830. });
  26831. me.getView().setStore(new Ext.data.Store({
  26832. fields: ['report_id', 'report_name', 'report_enable'],
  26833. data: res.data,
  26834. }));
  26835. }).finally(function () {
  26836. me.getView().setLoading(false);
  26837. });
  26838. };
  26839. ReportGridController.prototype.reportAdd = function () {
  26840. var _this = this;
  26841. prompt$2('请输入报表名称').then(function (name) {
  26842. createReportApi(name).then(function (res) {
  26843. if (res.success) {
  26844. msg$1('添加成功');
  26845. handles.mainWindow.showReport(res.data, name, function () {
  26846. _this.reload();
  26847. });
  26848. }
  26849. _this.reload();
  26850. });
  26851. });
  26852. };
  26853. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26854. e.preventDefault();
  26855. var me = sender.up('grid').ownerGrid.getController();
  26856. var option = {
  26857. shadow: 'frame', allowOtherMenus: true,
  26858. items: [
  26859. {
  26860. text: '添加',
  26861. iconCls: 'x-fa fa-plus-circle',
  26862. handler: function (sender) {
  26863. me.reportAdd();
  26864. }
  26865. },
  26866. {
  26867. text: '编辑',
  26868. iconCls: 'x-fa fa-edit',
  26869. handler: function (sender) {
  26870. me.reportEdit();
  26871. }
  26872. },
  26873. {
  26874. text: '删除',
  26875. iconCls: 'x-fa fa-minus-circle',
  26876. handler: function (sender) {
  26877. me.reportRemove();
  26878. }
  26879. },
  26880. '-',
  26881. {
  26882. text: '注册(至菜单)',
  26883. iconCls: 'x-fa fa-sign-in',
  26884. handler: function (sender) {
  26885. me.reportRegiste(sender);
  26886. }
  26887. },
  26888. {
  26889. text: '卸载',
  26890. iconCls: 'x-fa fa-sign-out',
  26891. handler: function (sender) {
  26892. console.error('没做');
  26893. }
  26894. },
  26895. ]
  26896. };
  26897. var treeMenu = new Ext.menu.Menu(option);
  26898. treeMenu.showAt(e.getXY());
  26899. };
  26900. ReportGridController.prototype.reportRegiste = function (sender) {
  26901. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26902. if (record) {
  26903. var reportName = record.get('report_name');
  26904. var reportId = record.get('report_id');
  26905. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  26906. }
  26907. };
  26908. ReportGridController.prototype.reportRemove = function () {
  26909. var _this = this;
  26910. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26911. if (record) {
  26912. var reportName = record.get('report_name');
  26913. var reportId_1 = record.get('report_id');
  26914. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  26915. delReportApi(reportId_1).then(function (res) {
  26916. if (res.success) {
  26917. msg$1('删除成功');
  26918. _this.reload();
  26919. }
  26920. });
  26921. });
  26922. }
  26923. };
  26924. ReportGridController.prototype.reportEdit = function () {
  26925. var _this = this;
  26926. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26927. if (record) {
  26928. var reportName = record.get('report_name');
  26929. var reportId = record.get('report_id');
  26930. handles.mainWindow.showReport(reportId, reportName, function () {
  26931. _this.reload();
  26932. });
  26933. }
  26934. };
  26935. ReportGridController.prototype.onDblClick = function (sender) {
  26936. this.reportEdit();
  26937. };
  26938. return ReportGridController;
  26939. }());
  26940. //# sourceMappingURL=ReportGridController.js.map
  26941. function initReportGrid () {
  26942. var controller = new ReportGridController();
  26943. Ext.define('com.yvan.studio.ReportGrid', {
  26944. extend: 'Ext.grid.Panel',
  26945. xtype: 'reportGrid',
  26946. controller: controller,
  26947. scope: controller,
  26948. referenceHolder: true,
  26949. tooltip: '查询报表',
  26950. iconCls: 'x-fa fa-bar-chart',
  26951. useArrows: true,
  26952. reference: 'reportgrid',
  26953. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  26954. listeners: {
  26955. itemdblclick: 'onDblClick',
  26956. afterrender: 'onLoad',
  26957. },
  26958. viewConfig: {
  26959. listeners: {
  26960. itemcontextmenu: 'onGridContextMenu',
  26961. },
  26962. },
  26963. tbar: {
  26964. xtype: 'toolbar',
  26965. items: [
  26966. {
  26967. xtype: 'button',
  26968. tooltip: '测试',
  26969. iconCls: 'x-fa fa-bars',
  26970. listeners: {
  26971. click: 'showSingle'
  26972. }
  26973. },
  26974. {
  26975. xtype: 'button',
  26976. tooltip: '刷新',
  26977. iconCls: 'x-fa fa-refresh',
  26978. listeners: {
  26979. click: 'reload'
  26980. }
  26981. },
  26982. {
  26983. xtype: 'button',
  26984. tooltip: '添加',
  26985. iconCls: 'x-fa fa-plus-circle',
  26986. listeners: {
  26987. click: 'reportAdd'
  26988. }
  26989. },
  26990. {
  26991. xtype: 'button',
  26992. tooltip: '删除',
  26993. iconCls: 'x-fa fa-minus-circle',
  26994. listeners: {
  26995. click: 'reportRemove'
  26996. }
  26997. },
  26998. {
  26999. xtype: 'textfield',
  27000. flex: 1,
  27001. reference: "txtFilter",
  27002. emptyText: '搜索过滤',
  27003. enableKeyEvents: true,
  27004. listeners: {
  27005. change: {
  27006. fn: 'filterChanged',
  27007. buffer: 50
  27008. }
  27009. }
  27010. },
  27011. ]
  27012. },
  27013. columns: [
  27014. {
  27015. text: 'ID', dataIndex: 'report_id',
  27016. hidden: true,
  27017. },
  27018. {
  27019. text: '报表名称', dataIndex: 'report_name',
  27020. menuDisabled: true, flex: 1,
  27021. },
  27022. ]
  27023. });
  27024. }
  27025. //# sourceMappingURL=ReportGrid.js.map
  27026. /** 所有变量类型 */
  27027. var TypeEnum;
  27028. (function (TypeEnum) {
  27029. TypeEnum["string"] = "string";
  27030. TypeEnum["number"] = "number";
  27031. TypeEnum["object"] = "object";
  27032. TypeEnum["array"] = "array";
  27033. TypeEnum["function"] = "function";
  27034. TypeEnum["null"] = "null";
  27035. TypeEnum["boolean"] = "boolean";
  27036. TypeEnum["symbol"] = "symbol";
  27037. TypeEnum["json"] = "json";
  27038. TypeEnum["math"] = "math";
  27039. TypeEnum["regexp"] = "regexp";
  27040. TypeEnum["date"] = "date";
  27041. TypeEnum["undefined"] = "undefined";
  27042. TypeEnum["nan"] = "nan";
  27043. TypeEnum["reactNode"] = "react_node";
  27044. })(TypeEnum || (TypeEnum = {}));
  27045. /**
  27046. * 判断对象类型
  27047. * @param object 对象
  27048. */
  27049. var variableTypeOf = function (object) {
  27050. var typeStr = Object.prototype.toString.call(object);
  27051. var typeName;
  27052. switch (("" + typeStr).toLowerCase()) {
  27053. case '[object string]':
  27054. typeName = TypeEnum.string;
  27055. break;
  27056. case '[object number]':
  27057. if (Number.isNaN(object)) {
  27058. return TypeEnum.nan;
  27059. }
  27060. typeName = TypeEnum.number;
  27061. break;
  27062. case '[object object]':
  27063. if (object.$$typeof && object.props) {
  27064. var type = variableTypeOf(object.$$typeof);
  27065. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27066. return TypeEnum.reactNode;
  27067. }
  27068. }
  27069. typeName = TypeEnum.object;
  27070. break;
  27071. case '[object array]':
  27072. typeName = TypeEnum.array;
  27073. break;
  27074. case '[object function]':
  27075. typeName = TypeEnum.function;
  27076. break;
  27077. case '[object null]':
  27078. typeName = TypeEnum.null;
  27079. break;
  27080. case '[object boolean]':
  27081. typeName = TypeEnum.boolean;
  27082. break;
  27083. case '[object date]':
  27084. typeName = TypeEnum.date;
  27085. break;
  27086. // 不常用
  27087. case '[object symbol]':
  27088. typeName = TypeEnum.symbol;
  27089. break;
  27090. case '[object json]':
  27091. typeName = TypeEnum.json;
  27092. break;
  27093. case '[object math]':
  27094. typeName = TypeEnum.math;
  27095. break;
  27096. case '[object regexp]':
  27097. typeName = TypeEnum.regexp;
  27098. break;
  27099. // 貌似不会走的分支
  27100. case '[object undefined]':
  27101. typeName = TypeEnum.undefined;
  27102. break;
  27103. // 无法识别
  27104. default:
  27105. if (object === undefined) {
  27106. return TypeEnum.undefined;
  27107. }
  27108. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27109. typeName = TypeEnum.object;
  27110. }
  27111. return typeName;
  27112. };
  27113. //# sourceMappingURL=typeof.js.map
  27114. function initGroovyEditor () {
  27115. Ext.define('com.yvan.studio.GroovyEditor', {
  27116. extend: 'Ext.panel.Panel',
  27117. alias: 'widget.groovyeditor',
  27118. xtype: 'groovyeditor',
  27119. layout: 'fit',
  27120. border: false,
  27121. html: "<div class=\"editor\"/>",
  27122. config: {
  27123. value: ''
  27124. },
  27125. codeChange: undefined,
  27126. isChangeFromOuter: false,
  27127. getCode: function () {
  27128. if (this.editor) {
  27129. return this.editor.getValue();
  27130. }
  27131. else {
  27132. return this.code;
  27133. }
  27134. },
  27135. setCode: function (value) {
  27136. var _this = this;
  27137. this.code = value;
  27138. this.value = value;
  27139. _$2.defer(function () {
  27140. _this.isChangeFromOuter = true;
  27141. if (_this.editor) {
  27142. _this.editor.setValue(value);
  27143. }
  27144. });
  27145. },
  27146. applyPosition: function () {
  27147. var _this = this;
  27148. if (this.autoFocusMethod) {
  27149. if (this.editor) {
  27150. _$2.defer(function () {
  27151. if (_this.autoFocusStartLine) {
  27152. _this.editor.setPosition({
  27153. lineNumber: _this.autoFocusStartLine,
  27154. column: _this.autoFocusStartColumn
  27155. });
  27156. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27157. }
  27158. _this.editor.focus();
  27159. });
  27160. delete this.autoFocusMethod;
  27161. }
  27162. }
  27163. this.editor.layout();
  27164. },
  27165. getValue: function () {
  27166. return this.value;
  27167. },
  27168. setValue: function (value, fromEditor) {
  27169. var me = this;
  27170. if (me.value === value) {
  27171. // 值相等,不需要变化
  27172. return;
  27173. }
  27174. if (fromEditor !== true && me.editor) {
  27175. // 不是来源于编辑器的变化,才设置编辑器的值
  27176. me.editor.setValue(value);
  27177. }
  27178. // 通知mixins setValue
  27179. me.value = value;
  27180. me.fireEvent('change', value);
  27181. },
  27182. initComponent: function () {
  27183. var that = this;
  27184. this.superclass.initComponent.call(this, arguments);
  27185. that.on({
  27186. resize: function () {
  27187. if (that.editor) {
  27188. that.editor.layout();
  27189. }
  27190. },
  27191. destory: function () {
  27192. if (that.editor) {
  27193. that.editor.dispose();
  27194. delete that.editor;
  27195. }
  27196. },
  27197. afterrender: function (sender) {
  27198. var $dom = $(that.el.dom).find('.editor');
  27199. attach_3($dom[0], {
  27200. value: that.code
  27201. }).then(function (editor) {
  27202. that.editor = editor;
  27203. that.applyPosition();
  27204. that.editor.onDidChangeModelContent(function (e) {
  27205. that.fireEvent('change', that.editor, e);
  27206. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27207. that.codeChange(that.editor.getValue(), that.name, e);
  27208. }
  27209. that.isChangeFromOuter = false;
  27210. });
  27211. });
  27212. }
  27213. });
  27214. }
  27215. });
  27216. }
  27217. function attach_3(element, opts) {
  27218. return new Promise(function (resolve) {
  27219. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27220. enabled: false
  27221. } }));
  27222. editor.onKeyUp(function (e) {
  27223. // console.log(e)
  27224. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27225. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27226. }
  27227. });
  27228. resolve(editor);
  27229. });
  27230. }
  27231. //# sourceMappingURL=GroovyEditor.js.map
  27232. function initJsEditor$1 () {
  27233. Ext.define('com.yvan.studio.JsEditor', {
  27234. extend: 'Ext.panel.Panel',
  27235. alias: 'widget.jseditor',
  27236. xtype: 'jseditor',
  27237. layout: 'fit',
  27238. border: false,
  27239. html: "<div class=\"editor\"/>",
  27240. autoFocusMethod: true,
  27241. autoFocusStartLine: 0,
  27242. autoFocusStartColumn: 0,
  27243. codeChange: undefined,
  27244. funcArr: [],
  27245. modulePage: null,
  27246. isChangeFromOuter: false,
  27247. name: "",
  27248. /**
  27249. * 设置代码
  27250. */
  27251. setCode: function (value) {
  27252. var _this = this;
  27253. this.code = value;
  27254. _$2.defer(function () {
  27255. _this.isChangeFromOuter = true;
  27256. if (_this.editor) {
  27257. _this.editor.setValue(value);
  27258. if (_this.name === "controllerEditor") {
  27259. _this.funcArr = _this.getAllFunction();
  27260. }
  27261. }
  27262. });
  27263. },
  27264. getCode: function () {
  27265. var _a;
  27266. if (!this.editor) {
  27267. return this.code;
  27268. }
  27269. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27270. },
  27271. applyPosition: function () {
  27272. var _this = this;
  27273. if (this.autoFocusMethod) {
  27274. if (this.editor) {
  27275. _$2.defer(function () {
  27276. if (_this.autoFocusStartLine) {
  27277. _this.editor.setPosition({
  27278. lineNumber: _this.autoFocusStartLine,
  27279. column: _this.autoFocusStartColumn
  27280. });
  27281. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27282. }
  27283. _this.editor.focus();
  27284. });
  27285. delete this.autoFocusMethod;
  27286. }
  27287. }
  27288. this.editor.layout();
  27289. },
  27290. initComponent: function () {
  27291. var that = this;
  27292. this.superclass.initComponent.apply(this, arguments);
  27293. this.on({
  27294. resize: function (sender, width, height) {
  27295. if (that.editor) {
  27296. that.editor.layout();
  27297. }
  27298. },
  27299. destory: function () {
  27300. if (that.editor) {
  27301. that.editor.dispose();
  27302. delete that.editor;
  27303. }
  27304. },
  27305. afterrender: function () {
  27306. var $dom = $(that.el.dom).find('.editor');
  27307. attach_1($dom[0], {
  27308. value: that.code
  27309. }).then(function (editor) {
  27310. that.editor = editor;
  27311. that.applyPosition();
  27312. that.editor.onDidChangeModelContent(function (e) {
  27313. that.fireEvent('change', that.editor, e);
  27314. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27315. that.codeChange(that.editor.getValue(), that.name, e);
  27316. }
  27317. that.isChangeFromOuter = false;
  27318. });
  27319. });
  27320. }
  27321. });
  27322. },
  27323. getAllFunction: function () {
  27324. var funcArr = [];
  27325. var ast = window['YvanUI'].recast.parse(this.code);
  27326. if (ast && ast.program && ast.program.body) {
  27327. if (Array.isArray(ast.program.body)) {
  27328. for (var i = 0; i < ast.program.body.length; i++) {
  27329. var m = ast.program.body[i];
  27330. if (m.type === "ExportDefaultDeclaration") {
  27331. if (m.declaration.type === "ClassDeclaration") {
  27332. if (m.declaration.body.type === "ClassBody") {
  27333. if (Array.isArray(m.declaration.body.body)) {
  27334. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27335. var ob = m.declaration.body.body[j];
  27336. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27337. var funcItem = { name: ob.key.name, args: [] };
  27338. if (Array.isArray(ob.value.params)) {
  27339. for (var k = 0; k < ob.value.params.length; k++) {
  27340. var p = ob.value.params[k];
  27341. funcItem.args.push(p.name);
  27342. }
  27343. }
  27344. funcArr.push(funcItem);
  27345. }
  27346. }
  27347. }
  27348. }
  27349. }
  27350. }
  27351. }
  27352. }
  27353. }
  27354. return funcArr;
  27355. }
  27356. });
  27357. }
  27358. var isInited = false;
  27359. function attach_1(element, opts) {
  27360. return new Promise(function (resolve) {
  27361. var monaco = window['monaco'];
  27362. if (!isInited) {
  27363. isInited = true;
  27364. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27365. noSemanticValidation: true,
  27366. noSyntaxValidation: false
  27367. });
  27368. // compiler options
  27369. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27370. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27371. allowNonTsExtensions: true,
  27372. });
  27373. // extra libraries
  27374. var libSource = [
  27375. 'declare class Facts {',
  27376. ' /**',
  27377. ' * Returns the next fact',
  27378. ' */',
  27379. ' static next():string',
  27380. ' static next222():string',
  27381. '}',
  27382. "\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 ",
  27383. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27384. ].join('\n');
  27385. var libUri = 'file:///index.d.ts';
  27386. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27387. // When resolving definitions and references, the editor will try to use created models.
  27388. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27389. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27390. }
  27391. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27392. resolve(editor);
  27393. });
  27394. }
  27395. //# sourceMappingURL=JsEditor.js.map
  27396. function initJsonEditor$1 () {
  27397. Ext.define('com.yvan.studio.JsonEditor', {
  27398. extend: 'Ext.panel.Panel',
  27399. alias: 'widget.jsoneditor',
  27400. xtype: 'jsoneditor',
  27401. layout: 'fit',
  27402. border: false,
  27403. html: "<div class=\"editor\"/>",
  27404. autoFocusMethod: true,
  27405. autoFocusStartLine: 0,
  27406. autoFocusStartColumn: 0,
  27407. codeChange: undefined,
  27408. funcArr: [],
  27409. modulePage: null,
  27410. isChangeFromOuter: false,
  27411. name: "",
  27412. /**
  27413. * 设置代码
  27414. */
  27415. setCode: function (value) {
  27416. var _this = this;
  27417. this.code = value;
  27418. _$2.defer(function () {
  27419. _this.isChangeFromOuter = true;
  27420. if (_this.editor) {
  27421. _this.editor.setValue(value);
  27422. }
  27423. });
  27424. },
  27425. updateOptions: function (options) {
  27426. if (this.editor && options) {
  27427. this.editor.updateOptions(options);
  27428. }
  27429. },
  27430. setLanguage: function (lang) {
  27431. if (this.editor && lang) {
  27432. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27433. }
  27434. },
  27435. getCode: function () {
  27436. var _a;
  27437. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27438. },
  27439. applyPosition: function () {
  27440. var _this = this;
  27441. if (this.autoFocusMethod) {
  27442. if (this.editor) {
  27443. _$2.defer(function () {
  27444. if (_this.autoFocusStartLine) {
  27445. _this.editor.setPosition({
  27446. lineNumber: _this.autoFocusStartLine,
  27447. column: _this.autoFocusStartColumn
  27448. });
  27449. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27450. }
  27451. _this.editor.focus();
  27452. });
  27453. delete this.autoFocusMethod;
  27454. }
  27455. }
  27456. this.editor.layout();
  27457. },
  27458. initComponent: function () {
  27459. var that = this;
  27460. this.superclass.initComponent.apply(this, arguments);
  27461. this.on({
  27462. resize: function (sender, width, height) {
  27463. if (that.editor) {
  27464. that.editor.layout();
  27465. }
  27466. },
  27467. destory: function () {
  27468. if (that.editor) {
  27469. that.editor.dispose();
  27470. delete that.editor;
  27471. }
  27472. },
  27473. afterrender: function (sender) {
  27474. var $dom = $(that.el.dom).find('.editor');
  27475. attach_116($dom[0], {
  27476. value: that.code
  27477. }).then(function (editor) {
  27478. that.editor = editor;
  27479. that.applyPosition();
  27480. that.editor.onDidChangeModelContent(function (e) {
  27481. that.fireEvent('change', that.editor, e);
  27482. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27483. that.codeChange(that.editor.getValue(), that.name, e);
  27484. }
  27485. that.isChangeFromOuter = false;
  27486. });
  27487. });
  27488. }
  27489. });
  27490. },
  27491. });
  27492. }
  27493. function attach_116(element, opts) {
  27494. return new Promise(function (resolve) {
  27495. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27496. enabled: false
  27497. } }));
  27498. editor.onKeyUp(function (e) {
  27499. // console.log(e)
  27500. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27501. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27502. }
  27503. });
  27504. resolve(editor);
  27505. });
  27506. }
  27507. //# sourceMappingURL=JsonEditor.js.map
  27508. function initSqlEditor$1 () {
  27509. Ext.define('com.yvan.studio.SqlEditor', {
  27510. extend: 'Ext.panel.Panel',
  27511. alias: 'widget.sqleditor',
  27512. xtype: 'sqleditor',
  27513. layout: 'fit',
  27514. border: false,
  27515. html: "<div class=\"editor\"/>",
  27516. config: {
  27517. value: ''
  27518. },
  27519. codeChange: undefined,
  27520. isChangeFromOuter: false,
  27521. setCode: function (value) {
  27522. var _this = this;
  27523. this.code = value;
  27524. this.value = value;
  27525. _$2.defer(function () {
  27526. _this.isChangeFromOuter = true;
  27527. if (_this.editor) {
  27528. _this.editor.setValue(value);
  27529. }
  27530. });
  27531. },
  27532. getCode: function () {
  27533. return this.getValue();
  27534. },
  27535. updateOptions: function (options) {
  27536. if (this.editor && options) {
  27537. this.editor.updateOptions(options);
  27538. }
  27539. },
  27540. getValue: function () {
  27541. if (!this.editor) {
  27542. return this.code;
  27543. }
  27544. return this.editor.getValue();
  27545. },
  27546. applyPosition: function () {
  27547. var _this = this;
  27548. if (this.autoFocusMethod) {
  27549. if (this.editor) {
  27550. _$2.defer(function () {
  27551. if (_this.autoFocusStartLine) {
  27552. _this.editor.setPosition({
  27553. lineNumber: _this.autoFocusStartLine,
  27554. column: _this.autoFocusStartColumn
  27555. });
  27556. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27557. }
  27558. _this.editor.focus();
  27559. });
  27560. delete this.autoFocusMethod;
  27561. }
  27562. }
  27563. this.editor.layout();
  27564. },
  27565. setValue: function (value, fromEditor) {
  27566. this.setCode(value);
  27567. var me = this;
  27568. if (me.value === value) {
  27569. // 值相等,不需要变化
  27570. return;
  27571. }
  27572. if (fromEditor !== true && me.editor) {
  27573. // 不是来源于编辑器的变化,才设置编辑器的值
  27574. me.editor.setValue(value);
  27575. }
  27576. // 通知mixins setValue
  27577. me.value = value;
  27578. me.fireEvent('change', value);
  27579. },
  27580. initComponent: function () {
  27581. var that = this;
  27582. this.superclass.initComponent.call(this);
  27583. that.on({
  27584. resize: function () {
  27585. if (that.editor) {
  27586. that.editor.layout();
  27587. }
  27588. },
  27589. destory: function () {
  27590. if (that.editor) {
  27591. that.editor.dispose();
  27592. delete that.editor;
  27593. }
  27594. },
  27595. afterrender: function (sender) {
  27596. var $dom = $(that.el.dom).find('.editor');
  27597. attach_2($dom[0], {
  27598. value: that.code
  27599. }).then(function (editor) {
  27600. that.editor = editor;
  27601. that.applyPosition();
  27602. that.editor.onDidChangeModelContent(function (e) {
  27603. that.fireEvent('change', that.editor, e);
  27604. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27605. that.codeChange(that.editor.getValue(), that.name, e);
  27606. }
  27607. that.isChangeFromOuter = false;
  27608. });
  27609. });
  27610. }
  27611. });
  27612. }
  27613. });
  27614. }
  27615. function attach_2(element, opts) {
  27616. return new Promise(function (resolve) {
  27617. var monaco = window['monaco'];
  27618. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27619. enabled: false
  27620. } }));
  27621. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27622. // const sql = editor.getValue()
  27623. // if (_.trim(sql).length > 0) {
  27624. // editor.setValue(format(sql, {
  27625. // indent: ' ',
  27626. // uppercase: true,
  27627. // }))
  27628. // }
  27629. msg$1('没做');
  27630. });
  27631. editor.onKeyUp(function (e) {
  27632. // console.log(e)
  27633. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27634. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27635. }
  27636. });
  27637. resolve(editor);
  27638. });
  27639. }
  27640. //# sourceMappingURL=SqlEditor.js.map
  27641. function initTemplateEditor () {
  27642. Ext.define('com.yvan.studio.TemplateEditor', {
  27643. extend: 'Ext.panel.Panel',
  27644. alias: 'widget.templateeditor',
  27645. xtype: 'templateeditor',
  27646. layout: 'fit',
  27647. border: false,
  27648. html: "<div class=\"editor\"/>",
  27649. autoFocusMethod: true,
  27650. autoFocusStartLine: 0,
  27651. autoFocusStartColumn: 0,
  27652. codeChange: undefined,
  27653. funcArr: [],
  27654. modulePage: null,
  27655. isChangeFromOuter: false,
  27656. name: "",
  27657. /**
  27658. * 设置代码
  27659. */
  27660. setCode: function (value) {
  27661. var _this = this;
  27662. this.code = value;
  27663. _$2.defer(function () {
  27664. _this.isChangeFromOuter = true;
  27665. if (_this.editor) {
  27666. _this.editor.setValue(value);
  27667. }
  27668. });
  27669. },
  27670. getCode: function () {
  27671. var _a;
  27672. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27673. },
  27674. applyPosition: function () {
  27675. var _this = this;
  27676. if (this.autoFocusMethod) {
  27677. if (this.editor) {
  27678. _$2.defer(function () {
  27679. if (_this.autoFocusStartLine) {
  27680. _this.editor.setPosition({
  27681. lineNumber: _this.autoFocusStartLine,
  27682. column: _this.autoFocusStartColumn
  27683. });
  27684. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27685. }
  27686. _this.editor.focus();
  27687. });
  27688. delete this.autoFocusMethod;
  27689. }
  27690. }
  27691. this.editor.layout();
  27692. },
  27693. initComponent: function () {
  27694. var that = this;
  27695. this.superclass.initComponent.apply(this, arguments);
  27696. this.on({
  27697. resize: function (sender, width, height) {
  27698. if (that.editor) {
  27699. that.editor.layout();
  27700. }
  27701. },
  27702. destory: function () {
  27703. if (that.editor) {
  27704. that.editor.dispose();
  27705. delete that.editor;
  27706. }
  27707. },
  27708. afterrender: function (sender) {
  27709. var $dom = $(that.el.dom).find('.editor');
  27710. attach_117($dom[0], {
  27711. value: that.code
  27712. }).then(function (editor) {
  27713. that.editor = editor;
  27714. that.applyPosition();
  27715. that.editor.onDidChangeModelContent(function (e) {
  27716. that.fireEvent('change', that.editor, e);
  27717. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27718. that.codeChange(that.editor.getValue(), that.name, e);
  27719. }
  27720. that.isChangeFromOuter = false;
  27721. });
  27722. });
  27723. }
  27724. });
  27725. },
  27726. });
  27727. }
  27728. function attach_117(element, opts) {
  27729. return new Promise(function (resolve) {
  27730. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27731. enabled: false
  27732. } }));
  27733. editor.onKeyUp(function (e) {
  27734. // console.log(e)
  27735. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27736. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27737. }
  27738. });
  27739. resolve(editor);
  27740. });
  27741. }
  27742. //# sourceMappingURL=TemplateEditor.js.map
  27743. var DictStore = /** @class */ (function (_super) {
  27744. __extends(DictStore, _super);
  27745. function DictStore() {
  27746. return _super !== null && _super.apply(this, arguments) || this;
  27747. }
  27748. DictStore.prototype.getCacheKey = function (param) {
  27749. return "dict_data.json";
  27750. };
  27751. DictStore.prototype.invokeApi = function (param) {
  27752. return getDict(param);
  27753. };
  27754. DictStore.prototype.getDicts = function () {
  27755. return this.apiResponse.data.dict;
  27756. };
  27757. DictStore.prototype.getDictCodes = function () {
  27758. return new Promise(function (resolve) {
  27759. // reloadIfNeedPromise().then(() => {
  27760. // const result = []
  27761. // _.forEach(this.getDicts(), dictRow => {
  27762. // result.push({
  27763. // id: dictRow.dict_code,
  27764. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27765. // })
  27766. // })
  27767. // resolve(result)
  27768. // })
  27769. });
  27770. };
  27771. DictStore.prototype.saveDict = function (param) {
  27772. return saveDictApi(param);
  27773. };
  27774. DictStore.prototype.saveDictItems = function (param) {
  27775. return saveDictItemsApi(param);
  27776. };
  27777. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27778. var results = [];
  27779. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27780. if (dictItemRow.dict_code === dict_code) {
  27781. results.push(_$2.clone(dictItemRow));
  27782. }
  27783. });
  27784. return results;
  27785. };
  27786. return DictStore;
  27787. }(CacheStore));
  27788. var instance$2 = new DictStore();
  27789. //# sourceMappingURL=DictStore.js.map
  27790. var DictTreeController = /** @class */ (function () {
  27791. function DictTreeController() {
  27792. this._saveStateFlag = true;
  27793. }
  27794. DictTreeController.prototype.dictSave = function () {
  27795. var _this = this;
  27796. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27797. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27798. if (err) {
  27799. // 如果有异常就不保存
  27800. return;
  27801. }
  27802. // 进行业务上的逻辑校验,比如说必填校验等等
  27803. var hasError = false;
  27804. _$2.forEach(rows, function (row, i) {
  27805. if (isEmpty(row.dict_code)) {
  27806. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27807. hasError = true;
  27808. return false;
  27809. }
  27810. });
  27811. if (hasError) {
  27812. return;
  27813. }
  27814. // 设置当前界面为 "保存中..." 状态
  27815. this.view.setLoading(true);
  27816. instance$2.saveDict({
  27817. newRows: newRows,
  27818. modifyRows: modifyRows,
  27819. removeRecords: removeRecords,
  27820. }).then(function (res) {
  27821. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27822. msg$1(res.msg);
  27823. _this.reload();
  27824. }).finally(function () {
  27825. // 无论正常异常,关闭 "保存中..." 状态
  27826. _this.view.setLoading(false);
  27827. });
  27828. };
  27829. DictTreeController.prototype.dictItemSave = function () {
  27830. var _this = this;
  27831. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27832. var currentDictCode = undefined;
  27833. if (record) {
  27834. currentDictCode = record.get('dict_code');
  27835. }
  27836. if (!currentDictCode) {
  27837. msg$1('请选择一个字典');
  27838. return;
  27839. }
  27840. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27841. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27842. if (err) {
  27843. // 如果有异常就不保存
  27844. return;
  27845. }
  27846. // 进行业务上的逻辑校验,比如说必填校验等等
  27847. var hasError = false;
  27848. _$2.forEach(rows, function (row, i) {
  27849. if (!row.dict_value && row.dict_value !== 0) {
  27850. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27851. hasError = true;
  27852. return false;
  27853. }
  27854. });
  27855. if (hasError) {
  27856. return;
  27857. }
  27858. // 设置当前界面为 "保存中..." 状态
  27859. this.view.setLoading(true);
  27860. instance$2.saveDictItems({
  27861. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  27862. newRows: newRows,
  27863. modifyRows: modifyRows,
  27864. removeRecords: removeRecords,
  27865. dict_code: currentDictCode
  27866. }).then(function (res) {
  27867. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27868. msg$1(res.msg);
  27869. _this.reload();
  27870. }).finally(function () {
  27871. // 无论正常异常,关闭 "保存中..." 状态
  27872. _this.view.setLoading(false);
  27873. });
  27874. };
  27875. DictTreeController.prototype.createDictEnum = function () {
  27876. var _this = this;
  27877. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27878. var currentDictCode = undefined;
  27879. if (record) {
  27880. currentDictCode = record.get('dict_code');
  27881. }
  27882. if (!currentDictCode) {
  27883. msg$1('请选择一个字典');
  27884. return;
  27885. }
  27886. // 设置当前界面为 "保存中..." 状态
  27887. this.view.setLoading(true);
  27888. createDictEnum({ dictCode: currentDictCode })
  27889. .then(function () { return _this.reload(); })
  27890. .finally(function () { return _this.view.setLoading(false); });
  27891. };
  27892. DictTreeController.prototype.onLoad = function () {
  27893. setDictTree(this);
  27894. this.grid1 = this.view.lookupReference('grid1');
  27895. this.grid2 = this.view.lookupReference('grid2');
  27896. this.grid1.setData([]);
  27897. this.grid2.setData([]);
  27898. // this.grid1.columns[0].hide()
  27899. this.grid2.columns[0].hide();
  27900. // 找管理器订阅刷新的事件
  27901. instance$2.registe(this.refreshData.bind(this));
  27902. // 非强制性刷新 DbManager
  27903. instance$2.reloadIfNeed(undefined);
  27904. };
  27905. DictTreeController.prototype.onDestory = function () {
  27906. instance$2.unregiste(this.refreshData.bind(this));
  27907. };
  27908. // dictStore 刷新时,会回调到这个方法
  27909. DictTreeController.prototype.refreshData = function (isLoadingState) {
  27910. var me = this;
  27911. if (typeof isLoadingState === 'boolean') {
  27912. me.view.setLoading(isLoadingState);
  27913. return;
  27914. }
  27915. this.grid1.setData(instance$2.getDicts());
  27916. this.restoreState();
  27917. };
  27918. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  27919. var _this = this;
  27920. _$2.defer(function () {
  27921. _this.saveState();
  27922. });
  27923. if (!record) {
  27924. this.grid2.setData([]);
  27925. return;
  27926. }
  27927. var dict_code = record.get('dict_code');
  27928. var data = instance$2.getDictItemByDictcode(dict_code);
  27929. this.grid2.setData(data);
  27930. };
  27931. DictTreeController.prototype.reload = function () {
  27932. var _this = this;
  27933. // 强制刷新 DbManager
  27934. instance$2.reloadForce(undefined).then(function (res) {
  27935. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  27936. });
  27937. };
  27938. DictTreeController.prototype.dictAdd = function () {
  27939. this.grid1.appendEditRow({
  27940. _createFlag: true,
  27941. dict_code: '',
  27942. dict_desc: '',
  27943. }, 0);
  27944. };
  27945. DictTreeController.prototype.dictRemove = function () {
  27946. this.grid1.removeEditRow();
  27947. };
  27948. DictTreeController.prototype.dictItemAdd = function () {
  27949. var _a, _b;
  27950. 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;
  27951. if (!dict_code) {
  27952. msg$1('请先保存字典');
  27953. return;
  27954. }
  27955. this.grid2.appendEditRow({
  27956. dict_code: dict_code,
  27957. dict_text: '',
  27958. dict_value: '',
  27959. }, 0);
  27960. };
  27961. DictTreeController.prototype.dictItemRemove = function () {
  27962. var _this = this;
  27963. var rows = [];
  27964. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  27965. rows.push(r);
  27966. });
  27967. _$2.forEach(rows, function (r) {
  27968. _this.grid2.getStore().remove(r);
  27969. });
  27970. };
  27971. DictTreeController.prototype.clearSearch1 = function () {
  27972. this.grid1.store.clearFilter();
  27973. };
  27974. DictTreeController.prototype.search1 = function (sender) {
  27975. this.grid1.store.clearFilter();
  27976. this.getViewModel().set('grid1.selection', null);
  27977. this.grid1.fireEvent('itemselect');
  27978. var value = _$2.lowerCase(sender.getRawValue()).trim();
  27979. if (!value) {
  27980. return;
  27981. }
  27982. this.grid1.store.filterBy(function (record) {
  27983. if (record.get('_createFlag')) {
  27984. return true;
  27985. }
  27986. var dict_code = _$2.lowerCase(record.get('dict_code'));
  27987. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  27988. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  27989. return (dict_code.includes(value) ||
  27990. dict_desc.includes(value) ||
  27991. dict_desc_py.includes(value));
  27992. });
  27993. };
  27994. DictTreeController.prototype.clearSearch2 = function () {
  27995. this.grid2.store.clearFilter();
  27996. };
  27997. DictTreeController.prototype.search2 = function (sender) {
  27998. this.grid2.store.clearFilter();
  27999. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28000. if (!value) {
  28001. return;
  28002. }
  28003. this.grid2.store.filterBy(function (record) {
  28004. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28005. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28006. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28007. return (dict_text.includes(value) ||
  28008. dict_value === value ||
  28009. dict_text_py.includes(value));
  28010. });
  28011. };
  28012. DictTreeController.prototype.getStateFilename = function () {
  28013. return getCurrentProject().uuid + "/dicttree.json";
  28014. };
  28015. DictTreeController.prototype.restoreState = function () {
  28016. var _this = this;
  28017. var grid = this.grid1;
  28018. native.loadFile(this.getStateFilename(), function (content) {
  28019. if (!content)
  28020. return;
  28021. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28022. _this._saveStateFlag = false;
  28023. if (selection) {
  28024. var idx = grid.store.findExact('dict_code', selection);
  28025. if (idx >= 0) {
  28026. var record = grid.store.getAt(idx);
  28027. if (record) {
  28028. grid.setSelection([record]);
  28029. }
  28030. }
  28031. }
  28032. if (scrollPosition && scrollSize) {
  28033. var size = grid.scrollable.getSize();
  28034. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28035. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28036. }
  28037. }
  28038. setTimeout(function () {
  28039. _this._saveStateFlag = true;
  28040. }, 200);
  28041. });
  28042. };
  28043. DictTreeController.prototype.saveState = function () {
  28044. if (!this._saveStateFlag) {
  28045. return;
  28046. }
  28047. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28048. var selection = undefined;
  28049. if (record) {
  28050. selection = record.get('dict_code');
  28051. }
  28052. var scrollPosition = this.grid1.scrollable.position;
  28053. var scrollSize = this.grid1.scrollable.getSize();
  28054. native.saveFile(this.getStateFilename(), {
  28055. selection: selection,
  28056. scrollPosition: scrollPosition,
  28057. scrollSize: scrollSize
  28058. });
  28059. };
  28060. return DictTreeController;
  28061. }());
  28062. //# sourceMappingURL=DictTreeController.js.map
  28063. function initDict$1 () {
  28064. var controller = new DictTreeController();
  28065. Ext.define('com.yvan.studio.DictTree', {
  28066. extend: 'Ext.panel.Panel',
  28067. xtype: 'dicttree',
  28068. controller: controller,
  28069. scope: controller,
  28070. referenceHolder: true,
  28071. tooltip: '字典',
  28072. iconCls: 'x-fa fa-book',
  28073. rootVisible: false,
  28074. useArrows: true,
  28075. reference: 'dicttree',
  28076. layout: 'border',
  28077. listeners: {
  28078. afterrender: 'onLoad',
  28079. destory: 'onDestory',
  28080. },
  28081. items: [
  28082. {
  28083. region: 'center',
  28084. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28085. _mode: 'select',
  28086. tbar: [
  28087. {
  28088. xtype: 'button',
  28089. tooltip: '刷新',
  28090. iconCls: 'x-fa fa-refresh',
  28091. listeners: {
  28092. click: 'reload'
  28093. }
  28094. },
  28095. {
  28096. xtype: 'button',
  28097. tooltip: '添加',
  28098. iconCls: 'x-fa fa-plus-circle',
  28099. listeners: {
  28100. click: 'dictAdd'
  28101. }
  28102. },
  28103. {
  28104. xtype: 'button',
  28105. tooltip: '删除',
  28106. iconCls: 'x-fa fa-minus-circle',
  28107. bind: {
  28108. disabled: '{!grid1.selection}'
  28109. },
  28110. listeners: {
  28111. click: 'dictRemove'
  28112. }
  28113. },
  28114. {
  28115. xtype: 'button',
  28116. tooltip: '保存',
  28117. iconCls: 'x-fa fa-save',
  28118. bind: {
  28119. disabled: '{!grid1.ischanged}'
  28120. },
  28121. listeners: {
  28122. click: 'dictSave'
  28123. }
  28124. },
  28125. {
  28126. xtype: 'textfield',
  28127. hideClear: true,
  28128. triggers: {
  28129. clear: {
  28130. cls: 'x-form-clear-trigger',
  28131. handler: 'clearSearch1'
  28132. },
  28133. },
  28134. flex: 1,
  28135. emptyText: '搜索过滤',
  28136. enableKeyEvents: true,
  28137. listeners: {
  28138. keyup: {
  28139. fn: 'search1',
  28140. buffer: 50
  28141. }
  28142. }
  28143. },
  28144. ],
  28145. listeners: {
  28146. itemselect: 'grid1Selected',
  28147. },
  28148. idField: 'dict_code',
  28149. columns: [
  28150. {
  28151. text: '字典编号', dataIndex: 'dict_code',
  28152. menuDisabled: true, flex: 1,
  28153. editor: {
  28154. allowBlank: true,
  28155. selectOnFocus: false
  28156. }
  28157. },
  28158. {
  28159. text: '中文描述', dataIndex: 'dict_desc',
  28160. menuDisabled: true, flex: 1,
  28161. editor: {
  28162. allowBlank: true,
  28163. selectOnFocus: false
  28164. }
  28165. },
  28166. ]
  28167. },
  28168. {
  28169. region: 'south', height: '50%',
  28170. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28171. split: true,
  28172. _mode: 'edit1',
  28173. listeners: {},
  28174. tbar: [
  28175. {
  28176. xtype: 'button',
  28177. tooltip: '添加',
  28178. iconCls: 'x-fa fa-plus-circle',
  28179. bind: {
  28180. disabled: '{!grid1.selection}'
  28181. },
  28182. listeners: {
  28183. click: 'dictItemAdd'
  28184. }
  28185. },
  28186. {
  28187. xtype: 'button',
  28188. tooltip: '删除',
  28189. iconCls: 'x-fa fa-minus-circle',
  28190. bind: {
  28191. disabled: '{!grid1.selection}'
  28192. },
  28193. listeners: {
  28194. click: 'dictItemRemove'
  28195. }
  28196. },
  28197. {
  28198. xtype: 'button',
  28199. tooltip: '保存',
  28200. iconCls: 'x-fa fa-save',
  28201. bind: {
  28202. disabled: '{!grid2.ischanged}'
  28203. },
  28204. listeners: {
  28205. click: 'dictItemSave'
  28206. }
  28207. },
  28208. {
  28209. xtype: 'button',
  28210. tooltip: '刷新代码',
  28211. iconCls: 'x-fa fa-code',
  28212. bind: {
  28213. disabled: '{!grid1.selection}'
  28214. },
  28215. listeners: {
  28216. click: 'createDictEnum'
  28217. }
  28218. },
  28219. ],
  28220. columns: [
  28221. {
  28222. text: '字典项', dataIndex: 'dict_text',
  28223. menuDisabled: true, flex: 1,
  28224. editor: {
  28225. allowBlank: true,
  28226. selectOnFocus: false
  28227. }
  28228. },
  28229. {
  28230. text: '字典值', dataIndex: 'dict_value',
  28231. menuDisabled: true, flex: 1,
  28232. dataType: 'int',
  28233. editor: {
  28234. xtype: 'numberfield',
  28235. allowBlank: true,
  28236. selectOnFocus: false
  28237. }
  28238. },
  28239. {
  28240. text: '激活', dataIndex: 'is_enable',
  28241. xtype: 'checkcolumn', menuDisabled: true,
  28242. },
  28243. {
  28244. text: '变量名', dataIndex: 'var_name',
  28245. menuDisabled: true, flex: 1,
  28246. editor: {
  28247. allowBlank: true,
  28248. selectOnFocus: false
  28249. }
  28250. },
  28251. ]
  28252. }
  28253. ]
  28254. });
  28255. }
  28256. //# sourceMappingURL=DictTree.js.map
  28257. var model$g = {
  28258. data: {
  28259. form: {
  28260. path: "",
  28261. requestBody: "",
  28262. responseBody: "",
  28263. }
  28264. }
  28265. };
  28266. var vjson$f = {
  28267. title: '接口信息',
  28268. layout: 'fit',
  28269. width: 800,
  28270. height: 500,
  28271. items: [
  28272. {
  28273. xtype: 'form',
  28274. layout: {
  28275. type: 'vbox',
  28276. pack: 'start',
  28277. align: 'stretch'
  28278. },
  28279. defaults: {
  28280. border: false,
  28281. anchor: '100%',
  28282. margin: '5',
  28283. },
  28284. items: [
  28285. {
  28286. xtype: 'textfield',
  28287. fieldLabel: '接口路径',
  28288. bind: {
  28289. value: "{form.path}",
  28290. },
  28291. },
  28292. {
  28293. xtype: 'textareafield',
  28294. // height: 150,
  28295. flex: 2,
  28296. fieldLabel: '请求数据',
  28297. bind: {
  28298. value: "{form.requestBody}",
  28299. },
  28300. },
  28301. {
  28302. xtype: 'textareafield',
  28303. // height: 150,
  28304. flex: 5,
  28305. fieldLabel: '响应数据',
  28306. bind: {
  28307. value: "{form.responseBody}",
  28308. },
  28309. },
  28310. ]
  28311. }
  28312. ]
  28313. };
  28314. var ApiInfoDialog = /** @class */ (function (_super) {
  28315. __extends(ApiInfoDialog, _super);
  28316. function ApiInfoDialog() {
  28317. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28318. }
  28319. return ApiInfoDialog;
  28320. }(Scope));
  28321. //# sourceMappingURL=apiInfoDialog.js.map
  28322. var model$h = {
  28323. data: {
  28324. query: {
  28325. role_id: '',
  28326. resource_id: '',
  28327. },
  28328. form: {},
  28329. form2: {
  28330. key: "",
  28331. start_at: "",
  28332. end_at: "",
  28333. }
  28334. }
  28335. };
  28336. var vjson$g = {
  28337. title: '接口信息',
  28338. layout: 'fit',
  28339. items: [
  28340. {
  28341. layout: 'border',
  28342. border: false,
  28343. items: [
  28344. {
  28345. region: 'center',
  28346. layout: 'border',
  28347. items: [
  28348. {
  28349. region: 'north',
  28350. bind: {
  28351. title: '{form.title}',
  28352. },
  28353. xtype: 'form',
  28354. scrollable: true,
  28355. layout: {
  28356. type: 'vbox',
  28357. pack: 'start',
  28358. align: 'stretch'
  28359. },
  28360. defaults: {
  28361. border: false,
  28362. anchor: '100%',
  28363. margin: '5',
  28364. },
  28365. tbar: {
  28366. xtype: 'toolbar',
  28367. items: [
  28368. {
  28369. xtype: 'button',
  28370. text: '查询',
  28371. iconCls: 'x-fa fa-search',
  28372. listeners: {
  28373. click: 'scope.requestLogs'
  28374. },
  28375. },
  28376. {
  28377. xtype: 'button',
  28378. text: '保存',
  28379. iconCls: 'x-fa fa-save',
  28380. listeners: {},
  28381. },
  28382. {
  28383. xtype: 'button',
  28384. text: '禁用',
  28385. iconCls: 'x-fa fa-stop-circle',
  28386. bind: {},
  28387. listeners: {},
  28388. },
  28389. {
  28390. xtype: 'button',
  28391. text: '启用',
  28392. iconCls: 'x-fa fa-play-circle',
  28393. bind: {},
  28394. listeners: {},
  28395. },
  28396. ],
  28397. },
  28398. items: [
  28399. {
  28400. xtype: 'cols',
  28401. defaults: { labelWidth: 120 },
  28402. items: [
  28403. {
  28404. xtype: 'textfield',
  28405. fieldLabel: 'URL',
  28406. bind: {
  28407. value: '{form.api_url}',
  28408. },
  28409. readOnly: true,
  28410. },
  28411. {
  28412. xtype: 'textfield',
  28413. fieldLabel: '名称',
  28414. bind: {
  28415. value: '{form.api_name}',
  28416. },
  28417. readOnly: true,
  28418. },
  28419. ],
  28420. },
  28421. {
  28422. xtype: 'cols',
  28423. defaults: { labelWidth: 120 },
  28424. items: [
  28425. {
  28426. xtype: 'textfield',
  28427. fieldLabel: '实现类',
  28428. bind: {
  28429. value: '{form.api_class}',
  28430. },
  28431. readOnly: true,
  28432. },
  28433. {
  28434. border: false,
  28435. flex: 1
  28436. },
  28437. ]
  28438. },
  28439. {
  28440. xtype: 'cols',
  28441. defaults: { labelWidth: 120 },
  28442. items: [
  28443. {
  28444. xtype: 'textfield',
  28445. fieldLabel: '超时时间',
  28446. bind: {
  28447. value: '{form.timeout}',
  28448. },
  28449. readOnly: true,
  28450. },
  28451. {
  28452. border: false,
  28453. flex: 1
  28454. },
  28455. ]
  28456. },
  28457. {
  28458. xtype: 'cols',
  28459. defaults: { labelWidth: 120 },
  28460. items: [
  28461. {
  28462. xtype: 'textfield',
  28463. fieldLabel: 'Remote IP',
  28464. bind: {
  28465. value: '{form.remote_ip}',
  28466. },
  28467. readOnly: true,
  28468. },
  28469. {
  28470. border: false,
  28471. flex: 1
  28472. },
  28473. ]
  28474. },
  28475. {
  28476. xtype: 'cols',
  28477. defaults: { labelWidth: 120 },
  28478. items: [
  28479. {
  28480. xtype: 'textfield',
  28481. fieldLabel: '解析表单',
  28482. bind: {
  28483. value: '{form.chandi}',
  28484. },
  28485. readOnly: true,
  28486. },
  28487. {
  28488. border: false,
  28489. flex: 1
  28490. },
  28491. ]
  28492. },
  28493. ],
  28494. },
  28495. {
  28496. region: 'center',
  28497. // title: 'Request',
  28498. layout: 'border',
  28499. items: [
  28500. {
  28501. region: 'north',
  28502. xtype: 'form',
  28503. reference: 'form2',
  28504. split: true,
  28505. items: [
  28506. {
  28507. xtype: 'cols',
  28508. width: 700,
  28509. items: [
  28510. {
  28511. xtype: 'textfield',
  28512. fieldLabel: '关键字',
  28513. bind: {
  28514. value: "{form2.key}"
  28515. },
  28516. },
  28517. {
  28518. xtype: 'datefield',
  28519. fieldLabel: '开始时间',
  28520. bind: {
  28521. value: "{form2.start_at}"
  28522. },
  28523. },
  28524. {
  28525. xtype: 'datefield',
  28526. fieldLabel: '结束时间',
  28527. bind: {
  28528. value: "{form2.end_at}"
  28529. },
  28530. },
  28531. ]
  28532. }
  28533. ]
  28534. },
  28535. {
  28536. region: 'center',
  28537. xtype: 'yvgrid',
  28538. layout: 'fit',
  28539. reference: 'grid1',
  28540. pagination: true,
  28541. autoLoad: false,
  28542. selModel: {
  28543. selType: 'rowmodel',
  28544. mode: 'SINGLE',
  28545. },
  28546. dataSource: {
  28547. method: 'invoke',
  28548. url: '/sys/api/Api@requestLogs',
  28549. params: {
  28550. formData: '{form2}',
  28551. path: '{form.api_url}',
  28552. },
  28553. },
  28554. listeners: {
  28555. rowdblclick: 'scope.showDialog',
  28556. },
  28557. columns: [
  28558. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28559. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28560. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28561. { dataIndex: "size", header: "大小", width: 80 },
  28562. { dataIndex: "path", header: "path", flex: 1 },
  28563. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28564. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28565. ]
  28566. }
  28567. ]
  28568. },
  28569. ],
  28570. },
  28571. ],
  28572. },
  28573. ],
  28574. referenceHolder: true,
  28575. };
  28576. var Api = /** @class */ (function (_super) {
  28577. __extends(Api, _super);
  28578. function Api() {
  28579. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28580. }
  28581. Api.prototype.onLoad = function () {
  28582. _super.prototype.onLoad.call(this);
  28583. this.requestLogs();
  28584. };
  28585. Api.prototype.selectList = function (sender, selected, eOpts) {
  28586. this.viewModel.set("form", selected.data);
  28587. if (selected.data.api_type === '1') {
  28588. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28589. }
  28590. else {
  28591. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28592. }
  28593. };
  28594. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28595. var sel = [];
  28596. _$2.forEach(records, function (item) {
  28597. if (item.data.flg === 'Y') {
  28598. sel.push(item);
  28599. }
  28600. });
  28601. this.refs.methodGrid.selModel.select(sel);
  28602. };
  28603. Api.prototype.saveAll = function () {
  28604. var _this = this;
  28605. var _a, _b, _c;
  28606. var role_id = this.viewModel.get("query.role_id");
  28607. if (!role_id) {
  28608. msg$1("请先选择一个角色");
  28609. return;
  28610. }
  28611. var wh_id = this.viewModel.get("form.wh_id");
  28612. if (!wh_id) {
  28613. msg$1("请先选择一个仓库");
  28614. return;
  28615. }
  28616. var menus = this.refs.theTree.getChecked();
  28617. var rowsMenus = [];
  28618. _$2.forEach(menus, function (m) {
  28619. if (m.data.resource_id) {
  28620. rowsMenus.push(m.data.resource_id);
  28621. }
  28622. });
  28623. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28624. 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; });
  28625. _$2.remove(mm, function (x) {
  28626. return methodsArry.includes(x.resource_id);
  28627. });
  28628. var rowsBtn = [];
  28629. _$2.forEach(mm, function (m) {
  28630. rowsBtn.push({ resource_id: m.resource_id });
  28631. });
  28632. this.setLoading(true);
  28633. invokeServer$1('/sys/role/Role@saveAll', {
  28634. wh_id: wh_id,
  28635. role_id: role_id,
  28636. rowsMenus: rowsMenus,
  28637. rowsBtn: rowsBtn,
  28638. }).then(function (res) {
  28639. msg$1(res.msg);
  28640. if (res.success) {
  28641. _this.reloadTree();
  28642. // this.viewModel.set('query.role_id', '')
  28643. _this.viewModel.set('query.resource_id', '');
  28644. _this.refs.methodGrid.reload();
  28645. }
  28646. }).finally(function () {
  28647. _this.setLoading(false);
  28648. });
  28649. };
  28650. Api.prototype.editRoleSuccess = function (sender, data) {
  28651. if (data.success) {
  28652. this.refs.roleGrid.reload();
  28653. this.viewModel.set("query.JIAOS_ID", "");
  28654. this.reloadTree();
  28655. this.viewModel.set("query.CAID_ID", "");
  28656. this.refs.methodGrid.reload();
  28657. }
  28658. };
  28659. Api.prototype.deleteRole = function (sender) {
  28660. var _this = this;
  28661. var role_id = this.viewModel.get("query.role_id");
  28662. if (!role_id) {
  28663. msg$1("请先选择一个角色");
  28664. return;
  28665. }
  28666. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28667. if (btn === 'yes') {
  28668. invokeServer$1('/sys/role/Role@deleteRole', {
  28669. role_id: role_id,
  28670. wh_id: window['whId']
  28671. }).then(function (res) {
  28672. msg$1(res.msg);
  28673. if (res.success) {
  28674. _this.refs.roleGrid.reload();
  28675. _this.viewModel.set("query.role_id", "");
  28676. _this.reloadTree();
  28677. _this.refs.methodGrid.reload();
  28678. }
  28679. });
  28680. }
  28681. });
  28682. };
  28683. Api.prototype.reloadTree = function () {
  28684. showErrorDialog$1('reloadTree 不存在');
  28685. };
  28686. Api.prototype.whChange = function (sender, value) {
  28687. this.viewModel.set("form.wh_id", value);
  28688. this.reloadTree();
  28689. this.refs.methodGrid.reload();
  28690. };
  28691. Api.prototype.requestLogs = function () {
  28692. var path = this.viewModel.get("form.api_url");
  28693. if (!path)
  28694. return;
  28695. this.refs.grid1.reload();
  28696. };
  28697. Api.prototype.showDialog = function (sender) {
  28698. var _a, _b;
  28699. 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; });
  28700. if (!rows || rows.length <= 0)
  28701. return;
  28702. var dialog = new ApiInfoDialog();
  28703. dialog.showDialog(null, {}, {
  28704. data: {
  28705. form: __assign({}, rows[0])
  28706. }
  28707. });
  28708. };
  28709. return Api;
  28710. }(Scope));
  28711. //# sourceMappingURL=ApiPage.js.map
  28712. var Controller = /** @class */ (function () {
  28713. function Controller() {
  28714. }
  28715. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28716. var _a, _b, _c, _d, _e, _f, _g, _h;
  28717. // @ts-ignore
  28718. 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; });
  28719. if (!rows || rows.length <= 0)
  28720. return;
  28721. var apiPage = new Api();
  28722. apiPage.showPage({
  28723. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28724. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28725. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28726. }, {
  28727. data: {
  28728. form: __assign({}, rows[0])
  28729. }
  28730. });
  28731. };
  28732. return Controller;
  28733. }());
  28734. var controller = new Controller();
  28735. function initApiTree () {
  28736. Ext.define('com.yvan.studio.ApiGrid', {
  28737. extend: 'Ext.Panel',
  28738. xtype: 'apigrid',
  28739. controller: controller,
  28740. scope: controller,
  28741. referenceHolder: true,
  28742. layout: 'fit',
  28743. items: [
  28744. {
  28745. width: 400,
  28746. split: true,
  28747. xtype: 'yvgrid',
  28748. reference: 'roleGrid',
  28749. border: false,
  28750. pagination: false,
  28751. autoLoad: true,
  28752. remoteFilter: false,
  28753. selModel: {
  28754. selType: 'rowmodel',
  28755. mode: 'SINGLE',
  28756. },
  28757. tbar: {
  28758. xtype: 'toolbar',
  28759. items: [
  28760. {
  28761. xtype: 'button',
  28762. text: '新增',
  28763. iconCls: 'x-fa fa-plus-circle',
  28764. listeners: {},
  28765. },
  28766. {
  28767. xtype: 'button',
  28768. text: '删除',
  28769. iconCls: 'x-fa fa-trash',
  28770. bind: {
  28771. disabled: '{roleGrid.selection==null}',
  28772. },
  28773. listeners: {},
  28774. },
  28775. ],
  28776. },
  28777. dataSource: {
  28778. url: '/sys/api/Api@getApiList',
  28779. method: 'invoke',
  28780. params: {},
  28781. },
  28782. listeners: {
  28783. itemdblclick: "selectList",
  28784. },
  28785. columns: [
  28786. {
  28787. dataIndex: 'api_name',
  28788. header: '接口名称',
  28789. filter: { type: 'string' },
  28790. flex: 1,
  28791. },
  28792. ],
  28793. },
  28794. ]
  28795. });
  28796. }
  28797. //# sourceMappingURL=ApiTree.js.map
  28798. var model$i = {
  28799. data: {
  28800. iframeSrc: ''
  28801. }
  28802. };
  28803. var vjson$h = {
  28804. layout: 'fit',
  28805. border: false,
  28806. iconCls: 'x-fa fa-newspaper-o',
  28807. referenceHolder: true,
  28808. items: [
  28809. {
  28810. // title: 'view.design',
  28811. xtype: 'uxiframe',
  28812. layout: 'fit',
  28813. // cls: 'module_page_iframe',
  28814. reference: 'iframe',
  28815. listeners: {
  28816. afterrender: 'scope.iframeRender'
  28817. }
  28818. },
  28819. ]
  28820. };
  28821. var Iframe = /** @class */ (function (_super) {
  28822. __extends(Iframe, _super);
  28823. function Iframe(path) {
  28824. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28825. _this.path = "";
  28826. _this.path = path;
  28827. return _this;
  28828. }
  28829. Iframe.prototype.iframeRender = function (sender) {
  28830. var $dom = $(sender.el.dom).find('iframe');
  28831. var iframe = $dom[0];
  28832. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28833. iframe.onload = function () {
  28834. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28835. };
  28836. };
  28837. return Iframe;
  28838. }(Scope));
  28839. //# sourceMappingURL=Iframe.js.map
  28840. var Controller$1 = /** @class */ (function () {
  28841. function Controller() {
  28842. }
  28843. Controller.prototype.onDblClick = function (sender, record) {
  28844. var data = record.raw;
  28845. if (data.text === "运行报表") {
  28846. this.openIframe("/xxl-job/index", "运行报表");
  28847. }
  28848. else if (data.text === "任务管理") {
  28849. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28850. }
  28851. else if (data.text === "调度日志") {
  28852. this.openIframe("/xxl-job/joblog", "调度日志");
  28853. }
  28854. else if (data.text === "执行器管理") {
  28855. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28856. }
  28857. };
  28858. Controller.prototype.openIframe = function (path, title) {
  28859. var page = new Iframe(path);
  28860. page.showPage({
  28861. title: title,
  28862. id: 'xxljob__' + path.replaceAll("/", "_"),
  28863. path: 'xxljob__' + path.replaceAll("/", "_"),
  28864. }, {});
  28865. };
  28866. Controller.prototype.onLoad = function () {
  28867. var me = this;
  28868. me.getView().setRootNode({
  28869. expanded: true,
  28870. leaf: false,
  28871. children: [
  28872. { leaf: true, text: '运行报表' },
  28873. { leaf: true, text: '任务管理' },
  28874. { leaf: true, text: '调度日志' },
  28875. { leaf: true, text: '执行器管理' },
  28876. ]
  28877. });
  28878. };
  28879. return Controller;
  28880. }());
  28881. var controller$1 = new Controller$1();
  28882. function initTaskTree () {
  28883. Ext.define('com.yvan.studio.TaskTree', {
  28884. extend: 'Ext.tree.Panel',
  28885. xtype: 'tasktree',
  28886. controller: controller$1,
  28887. scope: controller$1,
  28888. reference: 'roleGrid',
  28889. tooltip: '表单定义',
  28890. iconCls: 'x-fa fa-bar-chart',
  28891. useArrows: true,
  28892. rootVisible: false,
  28893. colspan: 2,
  28894. lines: true,
  28895. multiSelect: false,
  28896. referenceHolder: true,
  28897. // openNode() {
  28898. // const selection = this.getSelection()
  28899. // const [record] = selection
  28900. // if (!record) {
  28901. // return
  28902. // }
  28903. //
  28904. // const {raw} = record;
  28905. // if (raw.type === 'Dir') {
  28906. // return
  28907. // }
  28908. // if (raw.type === "Module" && raw.module) {
  28909. // // eventBus.publish(EventType.ModuleOpen, raw)
  28910. // }
  28911. // },
  28912. listeners: {
  28913. itemdblclick: 'onDblClick',
  28914. afterrender: "onLoad",
  28915. },
  28916. });
  28917. }
  28918. //# sourceMappingURL=TaskTree.js.map
  28919. var model$j = {
  28920. data: {
  28921. form: {
  28922. address: "",
  28923. level: "",
  28924. logger: "",
  28925. message: "",
  28926. nodeName: "",
  28927. serverName: "",
  28928. thread: "",
  28929. whId: "",
  28930. userId: "",
  28931. }
  28932. }
  28933. };
  28934. var vjson$i = {
  28935. title: '接口信息',
  28936. layout: 'fit',
  28937. width: 800,
  28938. height: 600,
  28939. items: [
  28940. {
  28941. xtype: 'form',
  28942. layout: {
  28943. type: 'vbox',
  28944. pack: 'start',
  28945. align: 'stretch'
  28946. },
  28947. defaults: {
  28948. border: false,
  28949. anchor: '100%',
  28950. margin: '5',
  28951. },
  28952. items: [
  28953. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  28954. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  28955. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  28956. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  28957. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  28958. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  28959. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  28960. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  28961. {
  28962. xtype: 'textareafield',
  28963. flex: 5,
  28964. fieldLabel: '响应数据',
  28965. bind: {
  28966. value: "{form.message}",
  28967. },
  28968. },
  28969. ]
  28970. }
  28971. ]
  28972. };
  28973. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  28974. __extends(ApiInfoDialog, _super);
  28975. function ApiInfoDialog() {
  28976. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  28977. }
  28978. return ApiInfoDialog;
  28979. }(Scope));
  28980. //# sourceMappingURL=LogPageDialog.js.map
  28981. var model$k = {
  28982. data: {
  28983. form2: {}
  28984. }
  28985. };
  28986. var vjson$j = {
  28987. title: '日志查询',
  28988. layout: 'fit',
  28989. width: "70%",
  28990. height: "80%",
  28991. items: [
  28992. {
  28993. region: 'center',
  28994. xtype: 'yvgrid',
  28995. layout: 'fit',
  28996. reference: 'grid1',
  28997. pagination: false,
  28998. autoLoad: false,
  28999. selModel: {
  29000. selType: 'rowmodel',
  29001. mode: 'SINGLE',
  29002. },
  29003. dataSource: {
  29004. method: 'invoke',
  29005. url: '/sys/api/Api@aroundLogs',
  29006. params: {
  29007. formData: '{form2}',
  29008. },
  29009. },
  29010. listeners: {
  29011. rowdblclick: 'scope.showDialog2',
  29012. },
  29013. columns: [
  29014. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29015. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29016. { dataIndex: "thread", header: "thread", width: 150 },
  29017. { dataIndex: "message", header: "message", flex: 1 },
  29018. ]
  29019. }
  29020. ]
  29021. };
  29022. var AroundLog = /** @class */ (function (_super) {
  29023. __extends(AroundLog, _super);
  29024. function AroundLog() {
  29025. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29026. }
  29027. AroundLog.prototype.onLoad = function () {
  29028. _super.prototype.onLoad.call(this);
  29029. this.queryLog();
  29030. };
  29031. AroundLog.prototype.queryLog = function () {
  29032. this.refs.grid1.reload();
  29033. };
  29034. AroundLog.prototype.showDialog2 = function () {
  29035. var _a, _b;
  29036. 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; });
  29037. if (!rows || rows.length <= 0)
  29038. return;
  29039. var dialog = new ApiInfoDialog$1();
  29040. dialog.showDialog(null, {}, {
  29041. data: {
  29042. form: __assign({}, rows[0])
  29043. }
  29044. });
  29045. };
  29046. return AroundLog;
  29047. }(Scope));
  29048. //# sourceMappingURL=AroundLog.js.map
  29049. var model$l = {
  29050. data: {
  29051. form2: {
  29052. key: "",
  29053. start_at: "",
  29054. end_at: "",
  29055. }
  29056. }
  29057. };
  29058. var vjson$k = {
  29059. title: '日志查询',
  29060. layout: 'fit',
  29061. tbar: {
  29062. xtype: 'toolbar',
  29063. items: [
  29064. {
  29065. xtype: 'button',
  29066. text: '刷新',
  29067. listeners: {
  29068. click: 'scope.queryLog'
  29069. },
  29070. },
  29071. {
  29072. xtype: 'button',
  29073. text: '周围日志',
  29074. bind: {},
  29075. listeners: {
  29076. click: 'scope.aroundLogs'
  29077. },
  29078. },
  29079. ],
  29080. },
  29081. items: [
  29082. {
  29083. region: 'center',
  29084. xtype: 'yvgrid',
  29085. layout: 'fit',
  29086. reference: 'grid1',
  29087. pagination: true,
  29088. autoLoad: false,
  29089. selModel: {
  29090. selType: 'rowmodel',
  29091. mode: 'SINGLE',
  29092. },
  29093. dataSource: {
  29094. method: 'invoke',
  29095. url: '/sys/api/Api@queryLog',
  29096. params: {
  29097. formData: '{form2}',
  29098. path: '{form.api_url}',
  29099. },
  29100. },
  29101. listeners: {
  29102. rowdblclick: 'scope.showDialog',
  29103. },
  29104. columns: [
  29105. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29106. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29107. { dataIndex: "thread", header: "thread", width: 150 },
  29108. { dataIndex: "message", header: "message", flex: 1 },
  29109. ]
  29110. }
  29111. ]
  29112. };
  29113. var LogPage = /** @class */ (function (_super) {
  29114. __extends(LogPage, _super);
  29115. function LogPage() {
  29116. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29117. }
  29118. LogPage.prototype.onLoad = function () {
  29119. _super.prototype.onLoad.call(this);
  29120. this.queryLog();
  29121. };
  29122. LogPage.prototype.queryLog = function () {
  29123. this.refs.grid1.reload();
  29124. };
  29125. LogPage.prototype.showDialog = function () {
  29126. var _a, _b;
  29127. 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; });
  29128. if (!rows || rows.length <= 0)
  29129. return;
  29130. var dialog = new ApiInfoDialog$1();
  29131. dialog.showDialog(null, {}, {
  29132. data: {
  29133. form: __assign({}, rows[0])
  29134. }
  29135. });
  29136. };
  29137. LogPage.prototype.aroundLogs = function () {
  29138. var _a, _b;
  29139. 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; });
  29140. if (!rows || rows.length <= 0)
  29141. return;
  29142. var dialog = new AroundLog();
  29143. dialog.showDialog(null, {}, {
  29144. data: {
  29145. form2: __assign({}, rows[0])
  29146. }
  29147. });
  29148. };
  29149. return LogPage;
  29150. }(Scope));
  29151. //# sourceMappingURL=LogPage.js.map
  29152. var Controller$2 = /** @class */ (function () {
  29153. function Controller() {
  29154. }
  29155. Controller.prototype.queryLog = function () {
  29156. var form2 = this.getViewModel().get("form2");
  29157. var logPage = new LogPage();
  29158. logPage.showPage({}, {
  29159. data: {
  29160. form2: __assign({}, form2)
  29161. }
  29162. });
  29163. };
  29164. return Controller;
  29165. }());
  29166. var controller$2 = new Controller$2();
  29167. function initLogsTree () {
  29168. Ext.define('com.yvan.studio.LogsTree', {
  29169. extend: 'Ext.panel.Panel',
  29170. xtype: 'logstree',
  29171. controller: controller$2,
  29172. scope: controller$2,
  29173. viewModel: {
  29174. data: {
  29175. form2: {
  29176. key: "",
  29177. start_at: "",
  29178. end_at: "",
  29179. }
  29180. }
  29181. },
  29182. reference: 'logstree',
  29183. tooltip: '表单定义',
  29184. iconCls: 'x-fa fa-bar-chart',
  29185. useArrows: true,
  29186. rootVisible: false,
  29187. colspan: 2,
  29188. lines: true,
  29189. multiSelect: false,
  29190. referenceHolder: true,
  29191. items: [
  29192. {
  29193. region: 'north',
  29194. xtype: 'form',
  29195. reference: 'form2',
  29196. split: true,
  29197. items: [
  29198. {
  29199. xtype: 'textfield',
  29200. fieldLabel: '关键字',
  29201. bind: {
  29202. value: "{form2.key}"
  29203. },
  29204. },
  29205. {
  29206. xtype: 'datefield',
  29207. fieldLabel: '开始时间',
  29208. bind: {
  29209. value: "{form2.start_at}"
  29210. },
  29211. },
  29212. {
  29213. xtype: 'datefield',
  29214. fieldLabel: '结束时间',
  29215. bind: {
  29216. value: "{form2.end_at}"
  29217. },
  29218. },
  29219. ]
  29220. },
  29221. {
  29222. xtype: "cols",
  29223. items: [
  29224. {
  29225. xtype: "box",
  29226. },
  29227. {
  29228. xtype: "button",
  29229. text: '查询',
  29230. listeners: {
  29231. click: 'queryLog'
  29232. },
  29233. },
  29234. {
  29235. xtype: "box",
  29236. },
  29237. ]
  29238. },
  29239. ],
  29240. });
  29241. }
  29242. //# sourceMappingURL=LogsTree.js.map
  29243. var model$m = {
  29244. data: {
  29245. // opsId: "",
  29246. // name: "",
  29247. running: false,
  29248. }
  29249. };
  29250. //# sourceMappingURL=DevOpsTerminal.model.js.map
  29251. var vjson$l = {
  29252. bind: {
  29253. title: '运维-{name}',
  29254. },
  29255. layout: 'fit',
  29256. items: [
  29257. {
  29258. layout: 'border',
  29259. items: [
  29260. {
  29261. region: 'north',
  29262. items: [
  29263. {
  29264. xtype: 'toolbar',
  29265. border: false,
  29266. items: [
  29267. {
  29268. xtype: 'button',
  29269. text: '执行',
  29270. iconCls: 'x-fa fa-play',
  29271. bind: {
  29272. hidden: "{running}",
  29273. },
  29274. listeners: {
  29275. click: 'scope.start'
  29276. }
  29277. },
  29278. {
  29279. xtype: 'button',
  29280. text: '停止',
  29281. iconCls: 'x-fa fa-stop',
  29282. bind: {
  29283. hidden: "{!running}",
  29284. },
  29285. listeners: {
  29286. click: 'scope.stop'
  29287. }
  29288. },
  29289. ],
  29290. },
  29291. ]
  29292. },
  29293. {
  29294. region: 'center',
  29295. reference: 'terminal',
  29296. xtype: 'terminal',
  29297. },
  29298. ],
  29299. },
  29300. ],
  29301. };
  29302. //# sourceMappingURL=DevOpsTerminal.view.js.map
  29303. var DevOpsTerminal = /** @class */ (function (_super) {
  29304. __extends(DevOpsTerminal, _super);
  29305. function DevOpsTerminal() {
  29306. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29307. _this.websocket = undefined;
  29308. return _this;
  29309. }
  29310. DevOpsTerminal.prototype.onLoad = function () {
  29311. this.load();
  29312. };
  29313. DevOpsTerminal.prototype.onDestroy = function () {
  29314. if (this.websocket) {
  29315. this.websocket.close();
  29316. this.websocket = undefined;
  29317. }
  29318. };
  29319. DevOpsTerminal.prototype.load = function () {
  29320. var _this = this;
  29321. var opsId = this.viewModel.get('opsId');
  29322. this.setLoading(true);
  29323. devOpsById(opsId).then(function (res) {
  29324. _this.viewModel.set('devOps', res.data);
  29325. }).finally(function () {
  29326. _this.setLoading(false);
  29327. });
  29328. };
  29329. DevOpsTerminal.prototype.start = function () {
  29330. var me = this;
  29331. var running = this.viewModel.get('running');
  29332. var devOps = this.viewModel.get('devOps');
  29333. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29334. return;
  29335. var devopsServer = "ws://122.9.140.63:9999";
  29336. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29337. this.websocket.addEventListener('open', function () {
  29338. me.viewModel.set('running', true);
  29339. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29340. });
  29341. this.websocket.addEventListener('message', function (event) {
  29342. me.refs.terminal.write(event.data);
  29343. });
  29344. this.websocket.addEventListener('close', function () {
  29345. me.stop();
  29346. });
  29347. this.websocket.addEventListener('error', function () {
  29348. me.stop();
  29349. });
  29350. };
  29351. DevOpsTerminal.prototype.stop = function () {
  29352. if (this.websocket) {
  29353. this.websocket.close();
  29354. this.websocket = undefined;
  29355. }
  29356. this.viewModel.set('running', false);
  29357. };
  29358. return DevOpsTerminal;
  29359. }(Scope));
  29360. //# sourceMappingURL=DevOpsTerminal.js.map
  29361. var Controller$3 = /** @class */ (function () {
  29362. function Controller() {
  29363. }
  29364. Controller.prototype.onLoad = function (sender) {
  29365. this.reload();
  29366. };
  29367. Controller.prototype.reload = function () {
  29368. var me = this;
  29369. // @ts-ignore
  29370. var view = me.getView();
  29371. view.setLoading(true);
  29372. devOpsList().then(function (res) {
  29373. view.setStore(new Ext.data.Store({
  29374. fields: ['ops_id', 'host', 'name'],
  29375. data: res.data,
  29376. }));
  29377. }).finally(function () {
  29378. view.setLoading(false);
  29379. });
  29380. };
  29381. Controller.prototype.onDblClick = function (sender) {
  29382. this.devOpsTerminal();
  29383. };
  29384. Controller.prototype.devOpsTerminal = function () {
  29385. // @ts-ignore
  29386. var view = this.getView();
  29387. var _a = __read(view.getSelection(), 1), record = _a[0];
  29388. if (record) {
  29389. var name = record.get('name');
  29390. var opsId = record.get('ops_id');
  29391. var instance = new DevOpsTerminal();
  29392. instance.showPage({
  29393. id: 'ops_' + opsId,
  29394. path: 'ops_' + opsId,
  29395. }, {
  29396. data: {
  29397. opsId: opsId,
  29398. name: name,
  29399. }
  29400. });
  29401. instance.dialogSuccess = function () {
  29402. };
  29403. }
  29404. };
  29405. return Controller;
  29406. }());
  29407. var controller$3 = new Controller$3();
  29408. function initDevOpsTree () {
  29409. Ext.define('com.yvan.studio.DevOpsGrid', {
  29410. extend: 'Ext.grid.Panel',
  29411. xtype: 'devopsgrid',
  29412. controller: controller$3,
  29413. scope: controller$3,
  29414. referenceHolder: true,
  29415. tooltip: '运维',
  29416. iconCls: 'x-fa fa-terminal',
  29417. useArrows: true,
  29418. reference: 'devopsgrid',
  29419. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29420. listeners: {
  29421. afterrender: 'onLoad',
  29422. itemdblclick: 'onDblClick',
  29423. },
  29424. viewConfig: {
  29425. // listeners: {
  29426. // itemcontextmenu: 'onGridContextMenu',
  29427. // },
  29428. },
  29429. tbar: {
  29430. xtype: 'toolbar',
  29431. items: [
  29432. {
  29433. xtype: 'button',
  29434. tooltip: '刷新',
  29435. iconCls: 'x-fa fa-refresh',
  29436. listeners: {
  29437. click: 'reload'
  29438. }
  29439. },
  29440. {
  29441. xtype: 'textfield',
  29442. flex: 1,
  29443. emptyText: '搜索过滤',
  29444. enableKeyEvents: true,
  29445. listeners: {
  29446. change: {
  29447. fn: 'filterChanged',
  29448. buffer: 50
  29449. }
  29450. }
  29451. },
  29452. ]
  29453. },
  29454. columns: [
  29455. {
  29456. text: 'ID', dataIndex: 'report_id',
  29457. hidden: true,
  29458. },
  29459. {
  29460. text: '服务器',
  29461. dataIndex: 'host',
  29462. width: 100,
  29463. menuDisabled: true,
  29464. },
  29465. {
  29466. text: '操作名称',
  29467. dataIndex: 'name',
  29468. flex: 1,
  29469. menuDisabled: true,
  29470. },
  29471. ]
  29472. });
  29473. }
  29474. //# sourceMappingURL=DevOpsTree.js.map
  29475. function initTerminal () {
  29476. Ext.define('com.yvan.studio.Terminal', {
  29477. extend: 'Ext.panel.Panel',
  29478. alias: 'widget.terminal',
  29479. xtype: 'terminal',
  29480. layout: 'fit',
  29481. border: false,
  29482. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29483. config: {},
  29484. write: function (str) {
  29485. if (this.term) {
  29486. this.term.write(str);
  29487. }
  29488. },
  29489. initComponent: function () {
  29490. var that = this;
  29491. this.superclass.initComponent.call(this, arguments);
  29492. that.on({
  29493. resize: function () {
  29494. var _a;
  29495. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29496. that.fitAddon.fit();
  29497. }
  29498. },
  29499. destory: function () {
  29500. if (that.term) {
  29501. that.term.dispose();
  29502. delete that.term;
  29503. }
  29504. if (that.fitAddon) {
  29505. that.fitAddon.dispose();
  29506. delete that.fitAddon;
  29507. }
  29508. },
  29509. afterrender: function (sender) {
  29510. _.defer(function () {
  29511. var $dom = $(that.el.dom).find('.terminal');
  29512. that.term = new xterm.Terminal({
  29513. // cursorBlink: false,
  29514. // cursorStyle: 'bar', // block underline bar
  29515. // enableBold: false,
  29516. // bellStyle: "sound",
  29517. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29518. // scrollback: 10000,
  29519. // tabStopWidth: 4,
  29520. disableStdin: true,
  29521. theme: {
  29522. // foreground: "#111",
  29523. // background: "#fdfdfd",
  29524. // background: "#fafafa",
  29525. },
  29526. });
  29527. that.fitAddon = new xtermAddonFit.FitAddon();
  29528. that.term.loadAddon(that.fitAddon);
  29529. that.term.open($dom[0]);
  29530. that.fitAddon.fit();
  29531. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29532. });
  29533. }
  29534. });
  29535. }
  29536. });
  29537. }
  29538. //# sourceMappingURL=Terminal.js.map
  29539. var vjson$m = {
  29540. title: '接口统计',
  29541. layout: 'fit',
  29542. items: [
  29543. {
  29544. title: '接口统计',
  29545. xtype: 'yvgrid',
  29546. enableLocking: false,
  29547. reference: 'grid1',
  29548. pagination: false,
  29549. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29550. tbar: {
  29551. xtype: 'form',
  29552. items: [
  29553. {
  29554. xtype: 'cols',
  29555. items: [
  29556. {
  29557. xtype: 'textfield',
  29558. fieldLabel: '搜索',
  29559. listeners: {
  29560. change: 'scope.requestFilterChange'
  29561. }
  29562. },
  29563. ]
  29564. },
  29565. ]
  29566. },
  29567. columns: [
  29568. { text: '地址', dataIndex: 'url', flex: 1 },
  29569. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29570. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29571. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29572. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29573. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29574. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29575. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29576. ],
  29577. leadingBufferZone: 8,
  29578. trailingBufferZone: 8,
  29579. viewConfig: {
  29580. listeners: {
  29581. expandbody: 'scope.onChildExpand'
  29582. }
  29583. },
  29584. listeners: {
  29585. itemdblclick: 'scope.itemClick1'
  29586. },
  29587. plugins: {
  29588. rowwidget: {
  29589. widget: {
  29590. xtype: 'yvgrid',
  29591. hideFootbar: true,
  29592. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29593. listeners: {
  29594. itemdblclick: 'scope.itemClick1'
  29595. },
  29596. columns: [
  29597. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29598. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29599. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29600. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29601. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29602. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29603. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29604. ]
  29605. }
  29606. }
  29607. }
  29608. },
  29609. ]
  29610. };
  29611. //# sourceMappingURL=InterfaceStatistics.view.js.map
  29612. var model$n = {
  29613. data: {
  29614. count: 0,
  29615. dataSourceName: '',
  29616. sql: "",
  29617. histogram: '',
  29618. maxCost: 0,
  29619. minCost: 0,
  29620. avgCost: '',
  29621. sumCost: 0,
  29622. histogramInfos: [
  29623. // count: 1
  29624. // gteCost: 20
  29625. // ltCost: 50
  29626. // 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"
  29627. // topN: [
  29628. // cost: 24
  29629. // occurrenceTime: "1648004895171"
  29630. // 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"
  29631. // ]
  29632. ]
  29633. }
  29634. };
  29635. //# sourceMappingURL=PerformDialog.model.js.map
  29636. var vjson$n = {
  29637. title: '性能统计详情',
  29638. height: 400,
  29639. width: 800,
  29640. modal: true,
  29641. layout: 'fit',
  29642. items: [
  29643. {
  29644. xtype: 'tabpanel',
  29645. items: [
  29646. {
  29647. title: '摘要',
  29648. key: "1",
  29649. layout: 'border',
  29650. items: [
  29651. {
  29652. region: 'north',
  29653. border: false,
  29654. defaults: {
  29655. margin: '8 0 0 0'
  29656. },
  29657. items: [
  29658. {
  29659. xtype: 'cols',
  29660. defaultType: 'displayfield',
  29661. defaults: {
  29662. labelWidth: 70,
  29663. },
  29664. items: [
  29665. {
  29666. fieldLabel: 'count',
  29667. bind: {
  29668. value: '{count}'
  29669. }
  29670. },
  29671. {
  29672. fieldLabel: 'maxCost',
  29673. bind: {
  29674. value: '{maxCost}'
  29675. }
  29676. },
  29677. {
  29678. fieldLabel: 'minCost',
  29679. bind: {
  29680. value: '{minCost}'
  29681. }
  29682. },
  29683. {
  29684. fieldLabel: 'avgCost',
  29685. bind: {
  29686. value: '{avgCost}'
  29687. }
  29688. },
  29689. {
  29690. fieldLabel: 'sumCost',
  29691. bind: {
  29692. value: '{sumCost}'
  29693. }
  29694. },
  29695. ]
  29696. },
  29697. {
  29698. xtype: 'cols',
  29699. items: [
  29700. {
  29701. flex: 5,
  29702. border: false,
  29703. items: [
  29704. {
  29705. xtype: 'segmentedbutton',
  29706. reference: 'histogram',
  29707. allowToggle: false,
  29708. border: false,
  29709. items: []
  29710. }
  29711. ]
  29712. },
  29713. ]
  29714. },
  29715. ],
  29716. },
  29717. {
  29718. region: 'center',
  29719. xtype: 'sqleditor',
  29720. reference: 'sqlEditor',
  29721. },
  29722. ]
  29723. },
  29724. {
  29725. title: '直方图',
  29726. key: "2",
  29727. }
  29728. ]
  29729. }
  29730. ]
  29731. };
  29732. //# sourceMappingURL=PerformDialog.view.js.map
  29733. var PerformDialog = /** @class */ (function (_super) {
  29734. __extends(PerformDialog, _super);
  29735. function PerformDialog() {
  29736. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29737. }
  29738. PerformDialog.prototype.onLoad = function () {
  29739. var _this = this;
  29740. var sql = this.viewModel.get('sql');
  29741. var sql2 = sqlFormat.format(sql, {
  29742. indent: ' ',
  29743. uppercase: true,
  29744. });
  29745. var histogramInfos = this.viewModel.get('histogramInfos');
  29746. var vs = _$2.map(histogramInfos, function (v) {
  29747. if (v.ltCost > 2100000000) {
  29748. return {
  29749. text: "[" + v.gteCost + ", \u221E):" + v.count
  29750. };
  29751. }
  29752. return {
  29753. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29754. };
  29755. });
  29756. this.refs.sqlEditor.setCode(sql2);
  29757. _$2.forEach(vs, function (v) {
  29758. _this.refs.histogram.add(v);
  29759. });
  29760. };
  29761. return PerformDialog;
  29762. }(Scope));
  29763. //# sourceMappingURL=PerformDialog.js.map
  29764. var model$o = {
  29765. data: {}
  29766. };
  29767. var PerformStats = /** @class */ (function (_super) {
  29768. __extends(PerformStats, _super);
  29769. function PerformStats() {
  29770. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29771. _this.requestFilterChange = _.debounce(function (sender, value) {
  29772. var store = _this.refs.grid1.store;
  29773. store.clearFilter();
  29774. if (value) {
  29775. store.filterBy(function (record, id) {
  29776. var text = toString(record.get('url'));
  29777. // 用拼音筛选的方式
  29778. return text.includes(value);
  29779. });
  29780. }
  29781. }, 100);
  29782. return _this;
  29783. }
  29784. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29785. widget.setData(record.data.children);
  29786. };
  29787. PerformStats.prototype.itemClick1 = function (sender, record) {
  29788. console.log('itemClick1', record.data);
  29789. new PerformDialog().showDialog(sender, {}, {
  29790. data: record.data
  29791. });
  29792. };
  29793. PerformStats.prototype.onLoad = function () {
  29794. var _this = this;
  29795. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29796. .then(function (_a) {
  29797. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29798. var resData = reqRes.data;
  29799. var jdbcData = jdbcRes.data;
  29800. _.forEach(jdbcData, function (item) {
  29801. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29802. });
  29803. _.forEach(resData, function (item) {
  29804. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29805. if (_.isArray(item.sqls)) {
  29806. item.children = _.map(item.sqls, function (sql) {
  29807. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29808. }).filter(function (v) { return !!v; });
  29809. }
  29810. item.jdbcCount = _.size(item.children);
  29811. });
  29812. _this.refs.grid1.setData(resData);
  29813. // this.refs.grid2.setData(jdbcData)
  29814. });
  29815. };
  29816. return PerformStats;
  29817. }(Scope));
  29818. //# sourceMappingURL=InterfaceStatistics.js.map
  29819. var vjson$o = {
  29820. title: '性能统计',
  29821. layout: 'fit',
  29822. items: [
  29823. {
  29824. title: '数据库统计',
  29825. xtype: 'yvgrid',
  29826. enableLocking: false,
  29827. reference: 'grid2',
  29828. pagination: false,
  29829. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29830. tbar: {
  29831. xtype: 'form',
  29832. items: [
  29833. {
  29834. xtype: 'cols',
  29835. items: [
  29836. {
  29837. fieldLabel: '搜索',
  29838. listeners: {
  29839. change: 'scope.jdbcFilterChange'
  29840. }
  29841. },
  29842. ]
  29843. },
  29844. ]
  29845. },
  29846. listeners: {
  29847. itemdblclick: 'scope.itemClick1'
  29848. },
  29849. columns: [
  29850. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29851. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29852. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29853. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29854. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29855. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29856. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29857. ]
  29858. },
  29859. ]
  29860. };
  29861. //# sourceMappingURL=DatabaseStatistics.view.js.map
  29862. var model$p = {
  29863. data: {}
  29864. };
  29865. var PerformStats$1 = /** @class */ (function (_super) {
  29866. __extends(PerformStats, _super);
  29867. function PerformStats() {
  29868. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  29869. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  29870. var store = _this.refs.grid2.store;
  29871. store.clearFilter();
  29872. if (value) {
  29873. store.filterBy(function (record, id) {
  29874. var text = toString(record.get('sql'));
  29875. // 用拼音筛选的方式
  29876. return text.includes(value);
  29877. });
  29878. }
  29879. }, 100);
  29880. return _this;
  29881. }
  29882. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29883. widget.setData(record.data.children);
  29884. };
  29885. PerformStats.prototype.itemClick1 = function (sender, record) {
  29886. console.log('itemClick1', record.data);
  29887. new PerformDialog().showDialog(sender, {}, {
  29888. data: record.data
  29889. });
  29890. };
  29891. PerformStats.prototype.onLoad = function () {
  29892. var _this = this;
  29893. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29894. .then(function (_a) {
  29895. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29896. var resData = reqRes.data;
  29897. var jdbcData = jdbcRes.data;
  29898. _.forEach(jdbcData, function (item) {
  29899. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29900. });
  29901. _.forEach(resData, function (item) {
  29902. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29903. if (_.isArray(item.sqls)) {
  29904. item.children = _.map(item.sqls, function (sql) {
  29905. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29906. }).filter(function (v) { return !!v; });
  29907. }
  29908. item.jdbcCount = _.size(item.children);
  29909. });
  29910. _this.refs.grid2.setData(jdbcData);
  29911. });
  29912. };
  29913. return PerformStats;
  29914. }(Scope));
  29915. //# sourceMappingURL=DatabaseStatistics.js.map
  29916. var Controller$4 = /** @class */ (function () {
  29917. function Controller() {
  29918. }
  29919. Controller.prototype.onDblClick = function (sender, record) {
  29920. var data = record.raw;
  29921. if (data.text === "接口统计") {
  29922. var page = new PerformStats();
  29923. page.showPage({
  29924. title: "接口统计",
  29925. id: '_InterfaceStatistics',
  29926. path: '_InterfaceStatistics',
  29927. }, {});
  29928. }
  29929. else if (data.text === "数据库统计") {
  29930. var page = new PerformStats$1();
  29931. page.showPage({
  29932. title: "数据库统计",
  29933. id: '_DatabaseStatistics',
  29934. path: '_DatabaseStatistics',
  29935. }, {});
  29936. }
  29937. };
  29938. Controller.prototype.onLoad = function () {
  29939. var me = this;
  29940. //@ts-ignore
  29941. var view = me.getView();
  29942. view.setRootNode({
  29943. expanded: true,
  29944. leaf: false,
  29945. children: [
  29946. { leaf: true, text: '接口统计' },
  29947. { leaf: true, text: '数据库统计' },
  29948. ]
  29949. });
  29950. };
  29951. return Controller;
  29952. }());
  29953. var controller$4 = new Controller$4();
  29954. function initMonitorTree () {
  29955. Ext.define('com.yvan.studio.MonitorTree', {
  29956. extend: 'Ext.tree.Panel',
  29957. xtype: 'monitortree',
  29958. controller: controller$4,
  29959. scope: controller$4,
  29960. reference: 'roleGrid',
  29961. tooltip: '表单定义',
  29962. iconCls: 'x-fa fa-bar-chart',
  29963. useArrows: true,
  29964. rootVisible: false,
  29965. colspan: 2,
  29966. lines: true,
  29967. multiSelect: false,
  29968. referenceHolder: true,
  29969. // openNode() {
  29970. // const selection = this.getSelection()
  29971. // const [record] = selection
  29972. // if (!record) {
  29973. // return
  29974. // }
  29975. //
  29976. // const {raw} = record;
  29977. // if (raw.type === 'Dir') {
  29978. // return
  29979. // }
  29980. // if (raw.type === "Module" && raw.module) {
  29981. // // eventBus.publish(EventType.ModuleOpen, raw)
  29982. // }
  29983. // },
  29984. listeners: {
  29985. itemdblclick: 'onDblClick',
  29986. afterrender: "onLoad",
  29987. },
  29988. });
  29989. }
  29990. //# sourceMappingURL=MonitorTree.js.map
  29991. var Controller$5 = /** @class */ (function () {
  29992. function Controller() {
  29993. }
  29994. return Controller;
  29995. }());
  29996. var controller$5 = new Controller$5();
  29997. function initHomeTree () {
  29998. Ext.define('com.yvan.studio.HomeTree', {
  29999. extend: 'Ext.Panel',
  30000. xtype: 'hometree',
  30001. controller: controller$5,
  30002. scope: controller$5,
  30003. referenceHolder: true,
  30004. bodyCls: 'home',
  30005. // layout: 'fit',
  30006. tbar: {
  30007. xtype: 'toolbar',
  30008. items: [
  30009. {
  30010. xtype: 'button',
  30011. iconCls: 'x-fa fa-exchange',
  30012. text: '数据结构同步',
  30013. handler: function (sender) {
  30014. handles$1.mainWindow.showDataSync(sender);
  30015. }
  30016. },
  30017. {
  30018. xtype: 'button',
  30019. iconCls: 'x-fa fa-cubes',
  30020. text: '数据域管理',
  30021. handler: function (sender) {
  30022. handles$1.mainWindow.showColumnDomain();
  30023. }
  30024. },
  30025. ],
  30026. },
  30027. // items: [
  30028. //
  30029. // ],
  30030. layout: {
  30031. type: 'vbox',
  30032. pack: 'start',
  30033. align: 'stretch',
  30034. },
  30035. items: [
  30036. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30037. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30038. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30039. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30040. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30041. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30042. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30043. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30044. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30045. ],
  30046. });
  30047. }
  30048. //# sourceMappingURL=HomeTree.js.map
  30049. var WidgetStore = /** @class */ (function (_super) {
  30050. __extends(WidgetStore, _super);
  30051. function WidgetStore() {
  30052. return _super !== null && _super.apply(this, arguments) || this;
  30053. }
  30054. WidgetStore.prototype.getCacheKey = function (param) {
  30055. return "widget_data.json";
  30056. };
  30057. /*invokeApi(param: any): Promise<any> {
  30058. return new Promise<any>(resolve => {
  30059. //@ts-ignore
  30060. require(["../../widget/all"], function (res) {
  30061. const widgetList = res.default
  30062. resolve(widgetList)
  30063. })
  30064. })
  30065. }*/
  30066. WidgetStore.prototype.invokeApi = function (param) {
  30067. return widgetListApi(param);
  30068. };
  30069. return WidgetStore;
  30070. }(CacheStore));
  30071. var instance$3 = new WidgetStore();
  30072. //# sourceMappingURL=WidgetStore.js.map
  30073. var WidgetGridController = /** @class */ (function () {
  30074. function WidgetGridController() {
  30075. }
  30076. WidgetGridController.prototype.onLoad = function (sender) {
  30077. var me = this;
  30078. setWidget(me);
  30079. instance$3.registe(me.reloadData.bind(this));
  30080. instance$3.reloadIfNeed(undefined);
  30081. };
  30082. WidgetGridController.prototype.widgetAdd = function (sender) {
  30083. var me = this;
  30084. var win = new Ext.Window({
  30085. autoDestroy: true,
  30086. title: "新建弹框",
  30087. width: 400,
  30088. height: 220,
  30089. resizable: true,
  30090. closable: true,
  30091. maximizable: true,
  30092. minimizable: true,
  30093. plain: true,
  30094. // constrainHeader: true,
  30095. constrain: true,
  30096. layout: 'fit',
  30097. animateTarget: sender,
  30098. buttonAlign: 'center',
  30099. items: [
  30100. {
  30101. xtype: "form",
  30102. layout: "hbox",
  30103. margin: '10px 20px',
  30104. border: 0,
  30105. items: [
  30106. {
  30107. flex: 1,
  30108. layout: 'vbox',
  30109. items: [
  30110. {
  30111. xtype: "textfield",
  30112. name: "widgetcode",
  30113. fieldLabel: "弹窗文件",
  30114. flex: 1,
  30115. allowBlank: false,
  30116. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30117. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30118. labelWidth: 80,
  30119. width: "100%",
  30120. },
  30121. {
  30122. xtype: "textfield",
  30123. name: "widgetname",
  30124. fieldLabel: "弹窗名称",
  30125. flex: 1,
  30126. allowBlank: false,
  30127. labelWidth: 80,
  30128. width: "100%",
  30129. },
  30130. ]
  30131. },
  30132. ]
  30133. }
  30134. ],
  30135. //窗口按钮
  30136. buttons: [
  30137. {
  30138. xtype: 'button', text: '保存', handler: function (btn) {
  30139. //窗口获取表单
  30140. var form = win.down('form');
  30141. var vaildSuccess = form.isValid();
  30142. if (!vaildSuccess) {
  30143. return;
  30144. }
  30145. var title = form.down('textfield[name="widgetname"]').getValue();
  30146. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30147. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30148. if (res.success) {
  30149. msg$1('添加成功');
  30150. // 添加
  30151. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30152. me.reload();
  30153. });
  30154. win.close();
  30155. }
  30156. });
  30157. }
  30158. },
  30159. {
  30160. xtype: 'button', text: '取消', handler: function (btn) {
  30161. //窗口关闭
  30162. win.close();
  30163. }
  30164. }
  30165. ]
  30166. });
  30167. win.show();
  30168. };
  30169. WidgetGridController.prototype.widgetRemove = function (sender) {
  30170. var _this = this;
  30171. //@ts-ignore
  30172. var record = this.getView().selection.data;
  30173. if (!record) {
  30174. msg$1('请选择一行');
  30175. return;
  30176. }
  30177. var widgetPath = record.widget_path;
  30178. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30179. if (btn === 'yes') {
  30180. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30181. if (res.success) {
  30182. msg$1(res.msg);
  30183. _this.reload();
  30184. }
  30185. });
  30186. }
  30187. });
  30188. };
  30189. WidgetGridController.prototype.widgetEdit = function (record) {
  30190. var _this = this;
  30191. if (record) {
  30192. var widgetPath = record.widget_path;
  30193. var widgetName = record.widget_name;
  30194. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30195. _this.reload();
  30196. });
  30197. }
  30198. };
  30199. WidgetGridController.prototype.onDestory = function (sender) {
  30200. var me = this;
  30201. setWidget(undefined);
  30202. instance$3.unregiste(me.reloadData.bind(this));
  30203. };
  30204. WidgetGridController.prototype.reloadData = function (res) {
  30205. var me = this;
  30206. //@ts-ignore
  30207. var view = me.getView();
  30208. if (typeof res === 'object') {
  30209. // const data = []
  30210. // _.forOwn(res, (v, k) => {
  30211. // data.push({
  30212. // widget_path: k,
  30213. // widget_name: v.title,
  30214. // vjson : v
  30215. // })
  30216. // })
  30217. view.setStore(new Ext.data.Store({
  30218. fields: ['widget_path', 'widget_name'],
  30219. data: res.data,
  30220. }));
  30221. }
  30222. else if (typeof res === 'boolean') {
  30223. view.setLoading(res);
  30224. }
  30225. };
  30226. WidgetGridController.prototype.reload = function () {
  30227. instance$3.reloadForce(undefined);
  30228. };
  30229. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30230. //@ts-ignore
  30231. this.view.store.clearFilter();
  30232. if (value) {
  30233. //@ts-ignore
  30234. this.view.store.filterBy(function (record) {
  30235. var widget_path = record.get('widget_path');
  30236. var widget_name = record.get('widget_name');
  30237. return (window['system'].pinyinMatch(widget_name, value) ||
  30238. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30239. });
  30240. }
  30241. };
  30242. WidgetGridController.prototype.onClearClick = function () {
  30243. var _a, _b;
  30244. //@ts-ignore
  30245. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30246. };
  30247. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30248. this.widgetEdit(record.data);
  30249. };
  30250. return WidgetGridController;
  30251. }());
  30252. //# sourceMappingURL=WidgetGridController.js.map
  30253. function initWidget () {
  30254. var controller = new WidgetGridController();
  30255. Ext.define('com.yvan.studio.WidgetGrid', {
  30256. extend: 'Ext.grid.Panel',
  30257. xtype: 'widgetgrid',
  30258. controller: controller,
  30259. scope: controller,
  30260. referenceHolder: true,
  30261. tooltip: '检索窗口',
  30262. iconCls: 'x-fa fa-search',
  30263. useArrows: true,
  30264. reference: 'widgetgrid',
  30265. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30266. listeners: {
  30267. itemdblclick: 'onDblClick',
  30268. afterrender: 'onLoad',
  30269. destory: 'onDestory',
  30270. },
  30271. viewConfig: {
  30272. listeners: {
  30273. itemcontextmenu: 'onGridContextMenu',
  30274. },
  30275. },
  30276. tbar: [
  30277. {
  30278. xtype: 'button',
  30279. tooltip: '刷新',
  30280. iconCls: 'x-fa fa-refresh',
  30281. listeners: {
  30282. click: 'reload'
  30283. }
  30284. },
  30285. {
  30286. xtype: 'button',
  30287. tooltip: '添加',
  30288. iconCls: 'x-fa fa-plus-circle',
  30289. listeners: {
  30290. click: 'widgetAdd'
  30291. }
  30292. },
  30293. {
  30294. xtype: 'button',
  30295. tooltip: '删除',
  30296. iconCls: 'x-fa fa-minus-circle',
  30297. listeners: {
  30298. click: 'widgetRemove'
  30299. }
  30300. },
  30301. ],
  30302. fbar: [
  30303. {
  30304. xtype: 'textfield',
  30305. flex: 1,
  30306. reference: "txtFilter",
  30307. emptyText: '搜索过滤',
  30308. enableKeyEvents: true,
  30309. listeners: {
  30310. change: {
  30311. fn: 'filterChanged',
  30312. buffer: 50
  30313. }
  30314. }
  30315. },
  30316. ],
  30317. columns: [
  30318. {
  30319. text: '弹窗文件', dataIndex: 'widget_path',
  30320. menuDisabled: true, flex: 1,
  30321. },
  30322. {
  30323. text: '弹窗名称', dataIndex: 'widget_name',
  30324. menuDisabled: true, flex: 1,
  30325. },
  30326. ]
  30327. });
  30328. }
  30329. //# sourceMappingURL=WidgetGrid.js.map
  30330. var WhLayoutController = /** @class */ (function () {
  30331. function WhLayoutController() {
  30332. }
  30333. WhLayoutController.prototype.onLoad = function (sender) {
  30334. var _this = this;
  30335. var me = this;
  30336. setWhLayout(me);
  30337. _$2.defer(function () {
  30338. _this.reload();
  30339. });
  30340. };
  30341. WhLayoutController.prototype.reload = function () {
  30342. //@ts-ignore
  30343. var view = this.getView();
  30344. view.setLoading(true);
  30345. loadWhLayoutAll().then(function (res) {
  30346. view.setStore(new Ext.data.Store({
  30347. fields: ['layout_code', 'layout_name'],
  30348. data: res.data,
  30349. }));
  30350. }).finally(function () {
  30351. view.setLoading(false);
  30352. });
  30353. };
  30354. WhLayoutController.prototype.add = function () {
  30355. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30356. };
  30357. WhLayoutController.prototype.edit = function (data) {
  30358. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30359. };
  30360. WhLayoutController.prototype.remove = function () {
  30361. var _this = this;
  30362. var _a;
  30363. //@ts-ignore
  30364. var view = this.getView();
  30365. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30366. if (!record) {
  30367. msg$1('请选择一行数据');
  30368. return;
  30369. }
  30370. var layoutCode = record.layout_code;
  30371. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30372. if (btn === 'yes') {
  30373. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30374. if (res.success) {
  30375. msg$1(res.msg);
  30376. _this.reload();
  30377. }
  30378. });
  30379. }
  30380. });
  30381. };
  30382. WhLayoutController.prototype.onDblClick = function () {
  30383. var _a;
  30384. //@ts-ignore
  30385. var view = this.getView();
  30386. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30387. if (!record) {
  30388. msg$1('请选择一行数据');
  30389. return;
  30390. }
  30391. this.edit(record);
  30392. };
  30393. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30394. //@ts-ignore
  30395. this.view.store.clearFilter();
  30396. if (value) {
  30397. //@ts-ignore
  30398. this.view.store.filterBy(function (record) {
  30399. var widget_path = record.get('widget_path');
  30400. var widget_name = record.get('widget_name');
  30401. return (window['system'].pinyinMatch(widget_name, value) ||
  30402. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30403. });
  30404. }
  30405. };
  30406. WhLayoutController.prototype.onClearClick = function () {
  30407. var _a, _b;
  30408. //@ts-ignore
  30409. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30410. };
  30411. return WhLayoutController;
  30412. }());
  30413. //# sourceMappingURL=WhLayoutController.js.map
  30414. function initWhLayout () {
  30415. var controller = new WhLayoutController();
  30416. Ext.define('com.yvan.studio.WhLayout', {
  30417. extend: 'Ext.grid.Panel',
  30418. xtype: 'whlayout',
  30419. alias: 'widget.whlayout',
  30420. controller: controller,
  30421. scope: controller,
  30422. referenceHolder: true,
  30423. tooltip: '检索窗口',
  30424. iconCls: 'x-fa fa-search',
  30425. useArrows: true,
  30426. reference: 'whlayout',
  30427. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30428. listeners: {
  30429. itemdblclick: 'onDblClick',
  30430. afterrender: 'onLoad',
  30431. destory: 'onDestory',
  30432. },
  30433. viewConfig: {
  30434. listeners: {
  30435. itemcontextmenu: 'onGridContextMenu',
  30436. },
  30437. },
  30438. tbar: [
  30439. {
  30440. xtype: 'button',
  30441. tooltip: '刷新',
  30442. iconCls: 'x-fa fa-refresh',
  30443. listeners: {
  30444. click: 'reload'
  30445. }
  30446. },
  30447. {
  30448. xtype: 'button',
  30449. tooltip: '添加',
  30450. iconCls: 'x-fa fa-plus-circle',
  30451. listeners: {
  30452. click: 'add'
  30453. }
  30454. },
  30455. {
  30456. xtype: 'button',
  30457. tooltip: '删除',
  30458. iconCls: 'x-fa fa-minus-circle',
  30459. listeners: {
  30460. click: 'remove'
  30461. }
  30462. },
  30463. ],
  30464. fbar: [
  30465. {
  30466. xtype: 'textfield',
  30467. flex: 1,
  30468. reference: "txtFilter",
  30469. emptyText: '搜索过滤',
  30470. enableKeyEvents: true,
  30471. listeners: {
  30472. change: {
  30473. fn: 'filterChanged',
  30474. buffer: 50
  30475. }
  30476. }
  30477. },
  30478. ],
  30479. columns: [
  30480. {
  30481. text: '图编号', dataIndex: 'layout_code',
  30482. menuDisabled: true, flex: 1,
  30483. },
  30484. {
  30485. text: '图名称', dataIndex: 'layout_name',
  30486. menuDisabled: true, flex: 1,
  30487. },
  30488. ]
  30489. });
  30490. }
  30491. //# sourceMappingURL=WhLayout.js.map
  30492. var BpmnTreeController = /** @class */ (function () {
  30493. function BpmnTreeController() {
  30494. }
  30495. BpmnTreeController.prototype.onLoad = function (sender) {
  30496. this.reload();
  30497. };
  30498. BpmnTreeController.prototype.reload = function () {
  30499. var me = this;
  30500. me.getView().setLoading(true);
  30501. exporerList().then(function (res) {
  30502. // handles.mainWindow.modules = res.data
  30503. // const rootNode = modulesToTreeData(res.data)
  30504. var rootNode = res.data.tree;
  30505. me.getView().setRootNode({
  30506. expanded: true,
  30507. leaf: false,
  30508. children: rootNode
  30509. });
  30510. // const lastId = window.location.hash.substring(1);
  30511. // file.selectPath(lastId)
  30512. // if (lastId) {
  30513. // const node = getModuleById(rootNode, lastId)
  30514. // if (node) {
  30515. // showDesign(node.id, node.path, node.text, node.module)
  30516. // }
  30517. // }
  30518. // this.restoreState()
  30519. }).finally(function () {
  30520. me.getView().setLoading(false);
  30521. });
  30522. };
  30523. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30524. var _this = this;
  30525. e.preventDefault();
  30526. var raw = node.raw;
  30527. //const me = sender.up("treepanel").scope
  30528. var option;
  30529. if (raw.exporerType === 1) ;
  30530. else if (raw.exporerType === 21) {
  30531. if (raw.type === 'Dir') {
  30532. option = {
  30533. shadow: 'frame', allowOtherMenus: true,
  30534. items: [
  30535. {
  30536. text: '添加',
  30537. iconCls: 'x-fa fa-plus-circle',
  30538. handler: function (sender) {
  30539. var dirPath = raw.dirPath;
  30540. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30541. }
  30542. },
  30543. '-',
  30544. {
  30545. text: '新建文件夹',
  30546. iconCls: 'x-fa fa-folder-o',
  30547. handler: function (sender) {
  30548. }
  30549. }
  30550. ]
  30551. };
  30552. }
  30553. else if (raw.type === 'Model') {
  30554. option = {
  30555. shadow: 'frame', allowOtherMenus: true,
  30556. items: [
  30557. {
  30558. text: '编辑',
  30559. iconCls: 'x-fa fa-edit',
  30560. handler: function (sender) {
  30561. }
  30562. },
  30563. {
  30564. text: '删除',
  30565. iconCls: 'x-fa fa-minus-circle',
  30566. handler: function (sender) {
  30567. }
  30568. },
  30569. '-',
  30570. {
  30571. text: '注册(至菜单)',
  30572. iconCls: 'x-fa fa-sign-in',
  30573. handler: function (sender) {
  30574. }
  30575. },
  30576. {
  30577. text: '新建文件夹',
  30578. iconCls: 'x-fa fa-folder-o',
  30579. handler: function (sender) {
  30580. }
  30581. }
  30582. ]
  30583. };
  30584. }
  30585. }
  30586. else if (raw.exporerType === 22) {
  30587. if (raw.type === 'Dir') {
  30588. option = {
  30589. shadow: 'frame', allowOtherMenus: true,
  30590. items: [
  30591. {
  30592. text: '添加',
  30593. iconCls: 'x-fa fa-plus-circle',
  30594. handler: function (sender) {
  30595. var dirPath = raw.dirPath;
  30596. handles$1.mainWindow.showFormBill();
  30597. }
  30598. },
  30599. '-',
  30600. {
  30601. text: '新建文件夹',
  30602. iconCls: 'x-fa fa-folder-o',
  30603. handler: function (sender) {
  30604. }
  30605. }
  30606. ]
  30607. };
  30608. }
  30609. else if (raw.type === 'Model') {
  30610. option = {
  30611. shadow: 'frame', allowOtherMenus: true,
  30612. items: [
  30613. {
  30614. text: '编辑',
  30615. iconCls: 'x-fa fa-edit',
  30616. handler: function (sender) {
  30617. }
  30618. },
  30619. {
  30620. text: '删除',
  30621. iconCls: 'x-fa fa-minus-circle',
  30622. handler: function (sender) {
  30623. }
  30624. },
  30625. '-',
  30626. {
  30627. text: '注册(至菜单)',
  30628. iconCls: 'x-fa fa-sign-in',
  30629. handler: function (sender) {
  30630. }
  30631. },
  30632. {
  30633. text: '新建文件夹',
  30634. iconCls: 'x-fa fa-folder-o',
  30635. handler: function (sender) {
  30636. }
  30637. }
  30638. ]
  30639. };
  30640. }
  30641. }
  30642. else if (raw.exporerType === 3) ;
  30643. else if (raw.exporerType === 50) {
  30644. option = {
  30645. shadow: 'frame', allowOtherMenus: true,
  30646. items: [
  30647. {
  30648. text: '新建流程',
  30649. iconCls: 'x-fa fa-new',
  30650. handler: function (sender) {
  30651. _this.bpmnAdd(sender);
  30652. }
  30653. },
  30654. ]
  30655. };
  30656. }
  30657. else if (raw.exporerType === 51) {
  30658. option = {
  30659. shadow: 'frame', allowOtherMenus: true,
  30660. items: [
  30661. {
  30662. text: '新建流程',
  30663. iconCls: 'x-fa fa-new',
  30664. handler: function (sender) {
  30665. _this.bpmnAdd(sender);
  30666. }
  30667. },
  30668. {
  30669. text: '删除',
  30670. iconCls: 'x-fa fa-minus-circle',
  30671. handler: function (sender) {
  30672. _this.bpmnDelete(sender, raw);
  30673. }
  30674. },
  30675. ]
  30676. };
  30677. }
  30678. else {
  30679. throw Error('暂时不支持!');
  30680. }
  30681. if (option) {
  30682. var treeMenu = new Ext.menu.Menu(option);
  30683. treeMenu.showAt(e.getXY());
  30684. }
  30685. };
  30686. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30687. var _this = this;
  30688. prompt$2('输入工作流名称').then(function (name) {
  30689. createBpmn("", name).then(function (res) {
  30690. if (res.success) {
  30691. msg$1('添加成功');
  30692. }
  30693. _this.reload();
  30694. });
  30695. });
  30696. };
  30697. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30698. var _this = this;
  30699. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30700. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30701. if (res.success) {
  30702. msg$1('添加成功');
  30703. }
  30704. _this.reload();
  30705. });
  30706. });
  30707. };
  30708. BpmnTreeController.prototype.reportAdd = function (sender) {
  30709. var _this = this;
  30710. prompt$2('请输入报表名称').then(function (name) {
  30711. createReportApi(name).then(function (res) {
  30712. if (res.success) {
  30713. msg$1('添加成功');
  30714. handles$1.mainWindow.showReport(res.data, name, function () {
  30715. _this.reload();
  30716. });
  30717. }
  30718. _this.reload();
  30719. });
  30720. });
  30721. };
  30722. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30723. if (record) {
  30724. var reportName = record.get('report_name');
  30725. var reportId = record.get('report_id');
  30726. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30727. }
  30728. };
  30729. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30730. var _this = this;
  30731. if (record) {
  30732. var reportName = record.get('report_name');
  30733. var reportId_1 = record.get('report_id');
  30734. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30735. delReportApi(reportId_1).then(function (res) {
  30736. if (res.success) {
  30737. msg$1('删除成功');
  30738. _this.reload();
  30739. }
  30740. });
  30741. });
  30742. }
  30743. };
  30744. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30745. var _this = this;
  30746. if (!record || record.type !== 'Module') {
  30747. return;
  30748. }
  30749. var reportName = record.text;
  30750. var reportId = record.target;
  30751. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30752. _this.reload();
  30753. });
  30754. };
  30755. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30756. var data = record.raw;
  30757. if (data.type !== 'Module' && data.type !== 'Dir') {
  30758. return;
  30759. }
  30760. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30761. if (data.exporerType === 10) { // 表单
  30762. // this.reportEdit(sender, data)
  30763. handles$1.mainWindow.showReport();
  30764. }
  30765. else if (data.exporerType === 21) {
  30766. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30767. }
  30768. else if (data.exporerType === 22) {
  30769. handles$1.mainWindow.showFormBill();
  30770. }
  30771. else if (data.exporerType === 30) {
  30772. handles$1.mainWindow.showWidgetDesign();
  30773. }
  30774. else if (data.exporerType === 51) {
  30775. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30776. }
  30777. else {
  30778. throw Error('暂时不支持!');
  30779. }
  30780. };
  30781. return BpmnTreeController;
  30782. }());
  30783. var controller$6 = new BpmnTreeController();
  30784. function initBpmnTree () {
  30785. Ext.define('com.yvan.studio.BpmnTree', {
  30786. extend: 'Ext.tree.Panel',
  30787. //extend: 'com.yvan.studio.StateTree',
  30788. xtype: 'bpmntree',
  30789. controller: controller$6,
  30790. scope: controller$6,
  30791. tooltip: '表单定义',
  30792. iconCls: 'x-fa fa-random',
  30793. useArrows: true,
  30794. rootVisible: false,
  30795. colspan: 2,
  30796. lines: true,
  30797. multiSelect: true,
  30798. reload: function () {
  30799. this.controller.reload.call(this, arguments);
  30800. },
  30801. openNode: function () {
  30802. var selection = this.getSelection();
  30803. var _a = __read(selection, 1), record = _a[0];
  30804. if (!record) {
  30805. return;
  30806. }
  30807. var raw = record.raw;
  30808. if (raw.type === 'Dir') {
  30809. return;
  30810. }
  30811. if (raw.type === "Module" && raw.module) ;
  30812. },
  30813. listeners: {
  30814. itemdblclick: 'onDblClick',
  30815. afterrender: 'onLoad',
  30816. // itemverify() {
  30817. // this.openNode()
  30818. // },
  30819. itemcontextmenu: 'onLisenContextMenu'
  30820. },
  30821. tbar: {
  30822. xtype: 'toolbar',
  30823. items: [
  30824. {
  30825. xtype: 'button',
  30826. tooltip: '刷新',
  30827. iconCls: 'x-fa fa-refresh',
  30828. listeners: {
  30829. click: 'reload'
  30830. }
  30831. },
  30832. /*{
  30833. xtype: 'button',
  30834. tooltip: '添加',
  30835. iconCls: 'x-fa fa-plus-circle',
  30836. menu: [
  30837. {
  30838. text: '类别',
  30839. listeners: {
  30840. click: 'classAdd'
  30841. }
  30842. },
  30843. {
  30844. text: '查询',
  30845. listeners: {
  30846. click: 'reportAdd'
  30847. }
  30848. },
  30849. '-',
  30850. {
  30851. text: '单表定义',
  30852. listeners: {
  30853. click: 'singleTableAdd'
  30854. }
  30855. },
  30856. {
  30857. text: '多表定义',
  30858. listeners: {
  30859. click: 'complexTableAdd'
  30860. }
  30861. },
  30862. {
  30863. text: '查询窗口定义',
  30864. listeners: {
  30865. click: 'widgetAdd'
  30866. }
  30867. },
  30868. ],
  30869. },
  30870. {
  30871. xtype: 'button',
  30872. tooltip: '删除',
  30873. iconCls: 'x-fa fa-minus-circle',
  30874. listeners: {
  30875. click: 'reportRemove'
  30876. }
  30877. },*/
  30878. {
  30879. xtype: 'textfield',
  30880. flex: 1,
  30881. reference: "txtFilter",
  30882. emptyText: '搜索过滤',
  30883. enableKeyEvents: true,
  30884. listeners: {
  30885. change: {
  30886. fn: 'filterChanged',
  30887. buffer: 50
  30888. }
  30889. }
  30890. },
  30891. ]
  30892. },
  30893. });
  30894. }
  30895. //# sourceMappingURL=BpmnTree.js.map
  30896. function initToolBox () {
  30897. Ext.define('com.yvan.studio.ToolBox', {
  30898. extend: 'Ext.panel.Panel',
  30899. xtype: 'toolbox',
  30900. tooltip: '工具箱',
  30901. layout: 'fit',
  30902. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  30903. border: false,
  30904. beforeRender: function () {
  30905. console.log('beforeRender', this);
  30906. },
  30907. afterRender: function () {
  30908. var $dom = $(this.body.dom).children('div');
  30909. $dom.append(createComponent());
  30910. $dom.css("height", '100%');
  30911. // @ts-ignore
  30912. $('#_toolbox_list').find('li').each(function () {
  30913. var id = $(this).children(':first').attr('drag_id');
  30914. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  30915. setDrag(this, node);
  30916. });
  30917. }
  30918. });
  30919. }
  30920. function setDrag(el, node) {
  30921. new Ext.drag.Source({
  30922. element: el,
  30923. proxy: {
  30924. type: 'placeholder',
  30925. getElement: function (info) {
  30926. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  30927. return Ext.getBody().createChild({
  30928. html: html
  30929. });
  30930. }
  30931. },
  30932. listeners: {
  30933. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  30934. dragend: delegateDragend.bind(getDesignInstance(), node),
  30935. },
  30936. sourceVjson: node.code,
  30937. dragType: node.dragType
  30938. });
  30939. }
  30940. function createComponent() {
  30941. var template = [];
  30942. for (var i = 0; i < codeLines.length; i++) {
  30943. var item = codeLines[i];
  30944. if (!item.dragHtml) {
  30945. continue;
  30946. }
  30947. var $ele = $("<li>" + item.dragHtml + "</li>");
  30948. $ele.children(':first').attr('drag_id', item.id);
  30949. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  30950. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  30951. }
  30952. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  30953. return html;
  30954. }
  30955. var codeLines = [
  30956. {
  30957. id: '$label',
  30958. value: layoutOrXtypeNameMap.label + ' - label',
  30959. icon: "fa fa-font",
  30960. dragType: "col-item",
  30961. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30962. code: {
  30963. xtype: 'label',
  30964. text: '文本' + _$2.uniqueId('_l')
  30965. }
  30966. },
  30967. {
  30968. id: '$text',
  30969. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  30970. icon: "fa fa-edit",
  30971. dragType: "col-item",
  30972. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30973. code: {
  30974. xtype: 'textfield',
  30975. fieldLabel: '输入框' + _$2.uniqueId('_e')
  30976. }
  30977. },
  30978. {
  30979. id: '$textarea',
  30980. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  30981. icon: "fa fa-edit",
  30982. dragType: "col-item",
  30983. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30984. code: {
  30985. xtype: 'textareafield',
  30986. fieldLabel: '输入框' + _$2.uniqueId('_e')
  30987. }
  30988. },
  30989. {
  30990. id: '$number',
  30991. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  30992. icon: "fa fa-edit",
  30993. dragType: "col-item",
  30994. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  30995. code: {
  30996. xtype: 'numberfield',
  30997. fieldLabel: '数字框' + _$2.uniqueId('_n')
  30998. }
  30999. },
  31000. {
  31001. id: '$combo',
  31002. value: layoutOrXtypeNameMap.combo + ' - combo',
  31003. icon: "fa fa-angle-double-down",
  31004. dragType: "col-item",
  31005. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31006. code: {
  31007. xtype: 'combo',
  31008. fieldLabel: '请选择',
  31009. data: [
  31010. { id: 'id1', text: '选项1' },
  31011. { id: 'id2', text: '选项2' },
  31012. { id: 'id3', text: '选项3' },
  31013. ],
  31014. }
  31015. },
  31016. {
  31017. id: '$datebox',
  31018. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31019. icon: "fa fa-calendar",
  31020. dragType: "col-item",
  31021. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31022. code: {
  31023. xtype: "datefield",
  31024. fieldLabel: '日期',
  31025. }
  31026. },
  31027. {
  31028. id: '$searchbox',
  31029. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31030. icon: "fa fa-search",
  31031. dragType: "col-item",
  31032. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31033. code: {
  31034. xtype: 'searchfield',
  31035. fieldLabel: '搜索框',
  31036. }
  31037. },
  31038. {
  31039. id: '$combogrid',
  31040. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31041. icon: "fa fa-table",
  31042. dragType: "col-item",
  31043. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31044. code: {
  31045. xtype: 'combogrid',
  31046. fieldLabel: '下拉表'
  31047. }
  31048. },
  31049. {
  31050. id: '$combotree',
  31051. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31052. icon: "fa fa-tree",
  31053. dragType: "col-item",
  31054. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31055. code: {
  31056. xtype: 'combotree',
  31057. fieldLabel: '下拉树',
  31058. displayField: 'text',
  31059. rootVisible: false
  31060. }
  31061. },
  31062. {
  31063. id: '$button',
  31064. value: layoutOrXtypeNameMap.button + ' - button',
  31065. icon: 'fa fa-sign-in',
  31066. dragType: "col-item",
  31067. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31068. code: {
  31069. text: '按钮',
  31070. iconCls: 'x-fa fa-bars',
  31071. xtype: 'button'
  31072. }
  31073. },
  31074. {
  31075. id: '$checkbox',
  31076. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31077. icon: 'fa fa-check-square',
  31078. dragType: "col-item",
  31079. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31080. code: {
  31081. xtype: 'checkbox',
  31082. boxLabel: '勾选框',
  31083. hideLabel: true,
  31084. margin: '0 0 0 15',
  31085. flex: 0,
  31086. }
  31087. },
  31088. {
  31089. id: '$checkboxgroup',
  31090. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31091. icon: 'fa fa-check-square',
  31092. dragType: "col-item",
  31093. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31094. code: {
  31095. xtype: 'checkboxgroup',
  31096. fieldLabel: '勾选组',
  31097. items: [
  31098. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31099. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31100. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31101. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31102. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31103. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31104. ]
  31105. }
  31106. },
  31107. {
  31108. id: '$radio',
  31109. value: layoutOrXtypeNameMap.radio + ' - radio',
  31110. icon: 'fa fa-dot-circle-o',
  31111. dragType: "col-item",
  31112. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31113. code: {
  31114. xtype: "radio",
  31115. fieldLabel: "请选择",
  31116. }
  31117. },
  31118. {
  31119. id: '$radiogroup',
  31120. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31121. icon: 'fa fa-dot-circle-o',
  31122. dragType: "col-item",
  31123. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31124. code: {
  31125. xtype: "radiogroup",
  31126. fieldLabel: "请选择",
  31127. items: [
  31128. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31129. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31130. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31131. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31132. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31133. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31134. ]
  31135. }
  31136. },
  31137. {
  31138. id: '$cols',
  31139. value: layoutOrXtypeNameMap.cols + ' - cols',
  31140. icon: 'fa fa-list-alt',
  31141. dragType: "cols-container",
  31142. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31143. code: {
  31144. xtype: 'cols',
  31145. items: [
  31146. {
  31147. xtype: 'textfield',
  31148. fieldLabel: '输入框',
  31149. },
  31150. ],
  31151. }
  31152. },
  31153. {
  31154. id: '$container',
  31155. value: layoutOrXtypeNameMap.container + ' - container',
  31156. icon: 'fa fa-flag',
  31157. dragType: "col-item",
  31158. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31159. code: {
  31160. xtype: 'container',
  31161. border: false,
  31162. layout: 'hbox',
  31163. }
  31164. },
  31165. {
  31166. id: '$fit',
  31167. value: layoutOrXtypeNameMap.fit + ' - fit',
  31168. icon: 'fa fa-flag',
  31169. dragType: "rows-container",
  31170. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31171. code: {
  31172. border: false,
  31173. layout: 'fit',
  31174. items: [
  31175. {
  31176. xtype: 'container',
  31177. border: false,
  31178. layout: 'hbox',
  31179. }
  31180. ]
  31181. }
  31182. },
  31183. ];
  31184. // @ts-ignore
  31185. // export default ToolBoxCmp
  31186. //# sourceMappingURL=ToolBox.js.map
  31187. var that = undefined;
  31188. function initPropertyDesign () {
  31189. Ext.define('com.yvan.studio.PropertyDesign', {
  31190. extend: 'Ext.panel.Panel',
  31191. xtype: 'propertydesign',
  31192. name: "PropertyDesign",
  31193. tooltip: '属性',
  31194. iconCls: 'x-fa fa-newspaper-o',
  31195. reference: 'propertygrid',
  31196. layout: 'border',
  31197. border: false,
  31198. moduleId: null,
  31199. currentComponentVJson: null,
  31200. currentComponentPropertyEditSource: null,
  31201. vjson: null,
  31202. propertyHandle: null,
  31203. moduleSubscribe: null,
  31204. items: [
  31205. new Ext.grid.property.Grid({
  31206. sortableColumns: false,
  31207. region: 'center',
  31208. listeners: {
  31209. propertychange: function (source, propName, value, oldValue, eOpts) {
  31210. value = _.trim(value);
  31211. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31212. return item.label === propName;
  31213. });
  31214. if (a.type === 'listeners') {
  31215. if (value) {
  31216. if (that.currentComponentVJson.listeners) {
  31217. that.currentComponentVJson.listeners[propName] = value;
  31218. }
  31219. else {
  31220. var t = {};
  31221. t[propName] = value;
  31222. that.currentComponentVJson.listeners = t;
  31223. }
  31224. }
  31225. else {
  31226. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31227. if (!value1) {
  31228. delete that.currentComponentVJson.listeners[key];
  31229. }
  31230. else if (key === propName) {
  31231. delete that.currentComponentVJson.listeners[key];
  31232. }
  31233. });
  31234. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31235. delete that.currentComponentVJson.listeners;
  31236. }
  31237. }
  31238. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31239. vjson: that.vjson,
  31240. from: that.name,
  31241. ignoreRenderUI: true
  31242. });
  31243. }
  31244. else if (a.type === 'fix') {
  31245. if (!value) {
  31246. delete that.currentComponentVJson[propName];
  31247. }
  31248. else {
  31249. that.currentComponentVJson[propName] = value.split("\r\n");
  31250. }
  31251. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31252. vjson: that.vjson,
  31253. from: that.name,
  31254. ignoreRenderUI: true
  31255. });
  31256. }
  31257. else if (a.type === 'bind') {
  31258. var bind_1 = that.currentComponentVJson.bind;
  31259. if (typeof bind_1 === 'string' && a.id === "value") {
  31260. if (value) {
  31261. that.currentComponentVJson.bind = value;
  31262. }
  31263. else {
  31264. delete that.currentComponentVJson.bind;
  31265. }
  31266. }
  31267. else {
  31268. // 转成bind对象
  31269. if (typeof bind_1 === 'string') {
  31270. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31271. }
  31272. if (value) {
  31273. if (bind_1) {
  31274. bind_1[a.id] = value;
  31275. }
  31276. else {
  31277. var t = {};
  31278. t[a.id] = value;
  31279. that.currentComponentVJson.bind = t;
  31280. }
  31281. }
  31282. else {
  31283. _.forOwn(bind_1, function (value1, key) {
  31284. if (!value1) {
  31285. delete bind_1[key];
  31286. }
  31287. else if (key === a.id) {
  31288. delete bind_1[key];
  31289. }
  31290. });
  31291. if (Object.keys(bind_1).length <= 0) {
  31292. delete that.currentComponentVJson.bind;
  31293. }
  31294. }
  31295. }
  31296. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31297. vjson: that.vjson,
  31298. from: that.name,
  31299. ignoreRenderUI: true
  31300. });
  31301. }
  31302. else if (a.type === 'boolean') {
  31303. if (!value) {
  31304. delete that.currentComponentVJson[propName];
  31305. }
  31306. else if (value === 'false') {
  31307. that.currentComponentVJson[propName] = false;
  31308. }
  31309. else if (value === 'true') {
  31310. that.currentComponentVJson[propName] = true;
  31311. }
  31312. else {
  31313. that.currentComponentVJson[propName] = value;
  31314. }
  31315. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31316. vjson: that.vjson,
  31317. from: that.name
  31318. });
  31319. }
  31320. else {
  31321. that.currentComponentVJson[propName] = value;
  31322. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31323. vjson: that.vjson,
  31324. from: that.name
  31325. });
  31326. }
  31327. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31328. },
  31329. }
  31330. })
  31331. ],
  31332. listeners: {
  31333. // afterrender() {
  31334. // this.propertyHandle.setSource({
  31335. // "(name)": "My Object",
  31336. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31337. // "Available": false, // boolean type
  31338. // "Version": .01, // decimal type
  31339. // "Description": "A test object"
  31340. // });
  31341. // }
  31342. },
  31343. initComponent: function () {
  31344. var _this = this;
  31345. this.propertyHandle = this.items[0];
  31346. setPropertyPanel(this);
  31347. that = this;
  31348. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31349. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31350. _this.setVjson(moduleId, from, ignoreRenderUI);
  31351. });
  31352. return this.superclass.initComponent.apply(this, arguments);
  31353. },
  31354. setVjson: function (moduleId, from, ignoreRenderUI) {
  31355. var _this = this;
  31356. // if (this.moduleId === null && moduleId) {
  31357. // this.moduleId = moduleId
  31358. // }
  31359. if (moduleId !== this.moduleId || from === this.name) {
  31360. return;
  31361. }
  31362. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31363. if (!moduleObj) {
  31364. return;
  31365. }
  31366. this.vjson = moduleObj.moduleObj.vjson;
  31367. this.setPropertyAndEventSource();
  31368. if (this.componentSelectionChangeSubscribe) {
  31369. this.componentSelectionChangeSubscribe.cancel();
  31370. this.componentSelectionChangeSubscribe = null;
  31371. }
  31372. if (this.updateVjsonChangeSubscribe) {
  31373. this.updateVjsonChangeSubscribe.cancel();
  31374. this.updateVjsonChangeSubscribe = null;
  31375. }
  31376. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31377. var id = _a.id, from = _a.from;
  31378. _this.onComponentSelectionChange(id, from);
  31379. });
  31380. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31381. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31382. _this.updateVjson(vjson, from, ignoreRenderUI);
  31383. });
  31384. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31385. this.onComponentSelectionChange(id, from);
  31386. },
  31387. updateVjson: function (vjson, from, ignoreRenderUI) {
  31388. if (!vjson || from === this.name) {
  31389. return;
  31390. }
  31391. this.vjson = vjson;
  31392. this.setPropertyAndEventSource();
  31393. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31394. this.onComponentSelectionChange(id, from);
  31395. },
  31396. onComponentSelectionChange: function (id, from) {
  31397. if (from !== this.name) {
  31398. this.currentComponentVJson = findInCode(this.vjson, id);
  31399. this.setPropertyAndEventSource();
  31400. }
  31401. },
  31402. setPropertyAndEventSource: function () {
  31403. var _this = this;
  31404. this.propertyHandle.setSource({});
  31405. if (!this.currentComponentVJson) {
  31406. return;
  31407. }
  31408. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31409. var v = xtype;
  31410. // 选中的对象可能是组
  31411. if (!v) {
  31412. if (_.has(this.currentComponentVJson, "cols")) {
  31413. v = "cols";
  31414. }
  31415. else if (_.has(this.currentComponentVJson, "rows")) {
  31416. v = "rows";
  31417. }
  31418. }
  31419. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31420. if (!pd) {
  31421. // 这个组件没有属性
  31422. this.propertyHandle.setSource({});
  31423. return;
  31424. }
  31425. var funcArr = this.getAllfuncs();
  31426. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31427. // disabled: true,
  31428. displayField: 'name',
  31429. valueField: 'name',
  31430. store: funcArr,
  31431. }); };
  31432. // ====================== 属性
  31433. var elements = [];
  31434. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31435. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31436. var props = pd.getPropsByGroup(group);
  31437. if (props.length <= 0)
  31438. return; //没有这一组属性
  31439. // 显示 group 的中文名
  31440. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31441. if (caption[i] === '绑定') {
  31442. _.each(props, function (prop) {
  31443. elements.push({
  31444. label: "_" + prop.name,
  31445. type: "bind",
  31446. id: prop.name,
  31447. desc: prop.desc,
  31448. editor: new Ext.form.field.Text()
  31449. });
  31450. });
  31451. }
  31452. else {
  31453. _.each(props, function (prop) {
  31454. if (_.isArray(prop.type)) {
  31455. elements.push({
  31456. label: prop.name,
  31457. type: "combo",
  31458. options: prop.type,
  31459. id: prop.name,
  31460. desc: prop.desc
  31461. });
  31462. return;
  31463. }
  31464. switch (prop.type) {
  31465. case 'boolean': {
  31466. elements.push({
  31467. label: prop.name,
  31468. id: prop.name,
  31469. desc: prop.desc,
  31470. type: 'boolean',
  31471. editor: new Ext.form.field.ComboBox({
  31472. displayField: 'text',
  31473. valueField: 'id',
  31474. store: new Ext.data.Store({
  31475. field: ['id', 'text'],
  31476. data: [
  31477. { id: 'true', text: 'True' },
  31478. { id: 'false', text: 'False' },
  31479. ]
  31480. })
  31481. }),
  31482. });
  31483. break;
  31484. }
  31485. case 'number': {
  31486. elements.push({
  31487. label: prop.name,
  31488. type: "number",
  31489. id: prop.name,
  31490. isNum: true,
  31491. desc: prop.desc,
  31492. editor: new Ext.form.field.Number()
  31493. });
  31494. break;
  31495. }
  31496. case 'string': {
  31497. elements.push({
  31498. label: prop.name,
  31499. type: "string",
  31500. id: prop.name,
  31501. desc: prop.desc,
  31502. editor: new Ext.form.field.Text()
  31503. });
  31504. break;
  31505. }
  31506. case 'listeners': {
  31507. elements.push({
  31508. label: prop.name,
  31509. type: "listeners",
  31510. id: prop.name,
  31511. desc: prop.desc,
  31512. editor: createFuncEditor()
  31513. });
  31514. break;
  31515. }
  31516. case 'fix': {
  31517. elements.push({
  31518. label: prop.name,
  31519. type: "fix",
  31520. id: prop.name,
  31521. desc: prop.desc,
  31522. editor: new Ext.form.field.Text()
  31523. });
  31524. break;
  31525. }
  31526. case 'object': {
  31527. break;
  31528. }
  31529. // case 'dataSource' : {
  31530. // break;
  31531. // }
  31532. case 'valid': {
  31533. break;
  31534. }
  31535. default:
  31536. elements.push({
  31537. label: prop.name,
  31538. type: prop.type,
  31539. id: prop.name,
  31540. desc: prop.desc,
  31541. editor: new Ext.form.field.Text({ disabled: true })
  31542. });
  31543. console.error('不支持的编辑类型', prop);
  31544. }
  31545. });
  31546. }
  31547. });
  31548. this.currentComponentPropertyEditSource = elements;
  31549. var panel1Source = {};
  31550. var panel1SourceConfig = {};
  31551. _.each(elements, function (item) {
  31552. var _a;
  31553. if (item.type === "listeners") {
  31554. var listeners = _this.currentComponentVJson.listeners;
  31555. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31556. }
  31557. else if (item.type === "fix") {
  31558. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31559. }
  31560. else if (item.type === "bind") {
  31561. var bind = _this.currentComponentVJson.bind;
  31562. if (typeof bind === 'string' && item.id === 'value') {
  31563. panel1Source[item.label] = bind;
  31564. }
  31565. else {
  31566. panel1Source[item.label] = bind ? bind[item.id] : '';
  31567. }
  31568. }
  31569. else {
  31570. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31571. }
  31572. panel1Source[item.label] = panel1Source[item.label] || '';
  31573. panel1SourceConfig[item.label] = { editor: item.editor };
  31574. });
  31575. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31576. },
  31577. getAllfuncs: function () {
  31578. var _a, _b;
  31579. 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;
  31580. var scopeFuncs = [];
  31581. _.forEach(arr, function (item) {
  31582. scopeFuncs.push({ name: "scope." + item.name });
  31583. });
  31584. return scopeFuncs;
  31585. }
  31586. });
  31587. }
  31588. //# sourceMappingURL=PropertyDesign.js.map
  31589. function initViewOutlineTree () {
  31590. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31591. extend: 'Ext.tree.Panel',
  31592. xtype: 'viewoutlinetree',
  31593. name: "ViewOutlineTree",
  31594. tooltip: '设计大纲',
  31595. iconCls: 'x-fa fa-list',
  31596. rootVisible: false,
  31597. useArrows: true,
  31598. allowDeselect: true,
  31599. colspan: 2,
  31600. lines: false,
  31601. reference: 'viewoutlinetree',
  31602. multiSelect: true,
  31603. _saveStateFlag: true,
  31604. keyMapEnabled: true,
  31605. moduleId: null,
  31606. vjson: null,
  31607. columns: [
  31608. {
  31609. xtype: 'treecolumn',
  31610. text: '布局',
  31611. dataIndex: 'layoutNameDesc',
  31612. flex: 2,
  31613. sortable: true
  31614. }, {
  31615. text: '组件',
  31616. dataIndex: 'xtype',
  31617. flex: 1,
  31618. sortable: true,
  31619. align: 'center',
  31620. }
  31621. ],
  31622. listeners: {
  31623. itemcontextmenu: function (sender, node, element, idx, e) {
  31624. e.preventDefault();
  31625. this.rightClickTreeNode(sender, node, element, idx, e);
  31626. },
  31627. select: function (sender, node, index, e) {
  31628. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31629. },
  31630. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31631. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31632. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31633. }
  31634. }
  31635. },
  31636. initComponent: function () {
  31637. var _this = this;
  31638. setViewoutlinetree(this);
  31639. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31640. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31641. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31642. });
  31643. return this.superclass.initComponent.apply(this, arguments);
  31644. },
  31645. clear: function () {
  31646. this.setRootNode(null);
  31647. },
  31648. onChangModule: function (moduleId, oldModuleId, from) {
  31649. if (!moduleId || moduleId !== this.moduleId) {
  31650. return;
  31651. }
  31652. if (moduleStore.getModuleObject(moduleId)) {
  31653. this.setVjson(moduleId, from);
  31654. }
  31655. },
  31656. setVjson: function (moduleId, from, ignoreRenderUI) {
  31657. var _this = this;
  31658. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31659. return;
  31660. }
  31661. this.moduleId = moduleId;
  31662. // if (from === this.name) {
  31663. // return
  31664. // }
  31665. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31666. this.setTreeValue();
  31667. if (this.componentSelectionChangeSubscribe) {
  31668. this.componentSelectionChangeSubscribe.cancel();
  31669. this.componentSelectionChangeSubscribe = null;
  31670. }
  31671. if (this.setVjsonChangeSubscribe) {
  31672. this.setVjsonChangeSubscribe.cancel();
  31673. this.setVjsonChangeSubscribe = null;
  31674. }
  31675. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31676. var id = _a.id, from = _a.from;
  31677. return _this.onComponentSelectionChange(id, from);
  31678. });
  31679. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31680. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31681. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31682. });
  31683. },
  31684. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31685. if (!vjson || from === this.name) {
  31686. return;
  31687. }
  31688. this.vjson = vjson;
  31689. this.setTreeValue();
  31690. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31691. if (id) {
  31692. this.selectPath(id);
  31693. }
  31694. },
  31695. onComponentSelectionChange: function (id, from) {
  31696. if (from !== this.name) {
  31697. if (id) {
  31698. this.selectPath(id);
  31699. }
  31700. else {
  31701. this.setTreeValue();
  31702. }
  31703. }
  31704. },
  31705. setTreeValue: function () {
  31706. var outlineVj = {};
  31707. _.forOwn(this.vjson, function (obj, key) {
  31708. if (key !== 'viewModel' && key !== 'store') {
  31709. outlineVj[key] = _.cloneDeep(obj);
  31710. }
  31711. });
  31712. getLayoutOutline(outlineVj);
  31713. this.setRootNode(outlineVj);
  31714. },
  31715. rightClickTreeNode: function (sender, node, element, idx, e) {
  31716. var raw = node.data;
  31717. var option = {};
  31718. // 右键
  31719. option = {
  31720. shadow: 'frame',
  31721. allowOtherMenus: true,
  31722. items: []
  31723. };
  31724. var switchType = raw.layoutName;
  31725. if (raw.layoutName === 'north' ||
  31726. raw.layoutName === 'south' ||
  31727. raw.layoutName === 'west' ||
  31728. raw.layoutName === 'east' ||
  31729. raw.layoutName === 'center' ||
  31730. raw.layoutName === 'tbar' ||
  31731. raw.layoutName === 'fbar') {
  31732. switchType = raw.xtype || raw.layout;
  31733. }
  31734. var itemArr = [];
  31735. var hasTbar = false, hasFbar = false, hasBody = false;
  31736. if (raw.hasOwnProperty("children")) {
  31737. _.forEach(raw.children, function (value) {
  31738. if (value.layoutName === 'tbar') {
  31739. hasTbar = true;
  31740. }
  31741. else if (value.layoutName === 'fbar') {
  31742. hasFbar = true;
  31743. }
  31744. else {
  31745. hasBody = true;
  31746. }
  31747. });
  31748. }
  31749. switch (switchType) {
  31750. case 'fit':
  31751. if (!hasTbar) {
  31752. itemArr.push('tbar');
  31753. }
  31754. if (!hasFbar) {
  31755. itemArr.push('fbar');
  31756. }
  31757. if (!hasBody) {
  31758. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31759. }
  31760. option.items = this.menuNew(itemArr, raw);
  31761. break;
  31762. case 'border':
  31763. if (!hasTbar) {
  31764. itemArr.push('tbar');
  31765. }
  31766. if (!hasFbar) {
  31767. itemArr.push('fbar');
  31768. }
  31769. itemArr.push('cnsew');
  31770. option.items = this.menuNew(itemArr, raw);
  31771. break;
  31772. // case 'tbar':
  31773. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31774. // break;
  31775. // case 'fbar':
  31776. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31777. // break;
  31778. case 'tabpanel':
  31779. if (!hasTbar) {
  31780. itemArr.push('tbar');
  31781. }
  31782. if (!hasFbar) {
  31783. itemArr.push('fbar');
  31784. }
  31785. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31786. option.items = this.menuNew(itemArr, raw);
  31787. break;
  31788. case 'yvgrid':
  31789. if (!hasTbar) {
  31790. itemArr.push('tbar');
  31791. }
  31792. option.items = this.menuNew(itemArr, raw);
  31793. break;
  31794. case 'tree':
  31795. if (!hasTbar) {
  31796. itemArr.push('tbar');
  31797. }
  31798. if (!hasFbar) {
  31799. itemArr.push('fbar');
  31800. }
  31801. option.items = this.menuNew(itemArr, raw);
  31802. break;
  31803. case 'fieldset':
  31804. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31805. break;
  31806. case 'form':
  31807. if (!hasTbar) {
  31808. itemArr.push('tbar');
  31809. }
  31810. if (!hasFbar) {
  31811. itemArr.push('fbar');
  31812. }
  31813. itemArr.push('form', 'fieldset', 'cols');
  31814. option.items = this.menuNew(itemArr, raw);
  31815. break;
  31816. case 'toolbar':
  31817. itemArr.push('button', 'textfield', 'label', 'combo');
  31818. option.items = this.menuNew(itemArr, raw);
  31819. break;
  31820. // case 'fbar':
  31821. // itemArr.push('button', 'textfield', 'label', 'combo')
  31822. // option.items = this.menuNew(itemArr, raw)
  31823. // break
  31824. default:
  31825. option.items = this.menuNew(itemArr, raw);
  31826. break;
  31827. }
  31828. var treeMenu = new Ext.menu.Menu(option);
  31829. treeMenu.showAt(e.getXY());
  31830. },
  31831. newItem: function (viewType, raw, region) {
  31832. var itemVjson = {};
  31833. switch (viewType) {
  31834. case 'fit':
  31835. itemVjson.layout = 'fit';
  31836. itemVjson.items = [];
  31837. break;
  31838. case 'border':
  31839. itemVjson.layout = 'border';
  31840. itemVjson.items = [];
  31841. break;
  31842. case 'toolbar':
  31843. itemVjson.xtype = 'toolbar';
  31844. itemVjson.title = 'toolbar';
  31845. itemVjson.items = [
  31846. {
  31847. xtype: 'button',
  31848. text: 'button'
  31849. }
  31850. ];
  31851. break;
  31852. case 'tabpanel':
  31853. itemVjson.xtype = 'tabpanel';
  31854. itemVjson.layout = 'fit';
  31855. itemVjson.items = [];
  31856. break;
  31857. case 'yvgrid':
  31858. itemVjson.xtype = 'yvgrid';
  31859. itemVjson.layout = 'fit';
  31860. itemVjson.pagination = false;
  31861. itemVjson.columns = [
  31862. {
  31863. dataIndex: "skuId",
  31864. header: "SKU_ID",
  31865. },
  31866. ];
  31867. break;
  31868. case 'tree':
  31869. itemVjson.xtype = 'treepanel';
  31870. itemVjson.layout = 'fit';
  31871. break;
  31872. case 'fieldset':
  31873. case 'form':
  31874. itemVjson.xtype = viewType;
  31875. itemVjson.title = viewType;
  31876. itemVjson.items = [
  31877. {
  31878. xtype: 'cols',
  31879. items: [
  31880. {
  31881. xtype: 'textfield',
  31882. fieldLabel: '输入框'
  31883. }
  31884. ]
  31885. }
  31886. ];
  31887. break;
  31888. case 'cols':
  31889. itemVjson.xtype = 'cols';
  31890. itemVjson.items = [
  31891. {
  31892. xtype: 'textfield',
  31893. fieldLabel: '输入框'
  31894. }
  31895. ];
  31896. break;
  31897. case 'button':
  31898. itemVjson.xtype = 'button';
  31899. itemVjson.text = '按钮';
  31900. itemVjson.iconCls = 'x-fa fa-plus';
  31901. break;
  31902. case 'textfield':
  31903. itemVjson.xtype = 'textfield';
  31904. itemVjson.fieldLabel = '输入框';
  31905. break;
  31906. case 'combo':
  31907. itemVjson.xtype = 'combo';
  31908. itemVjson.fieldLabel = '下拉框';
  31909. break;
  31910. case 'label':
  31911. itemVjson.xtype = 'label';
  31912. itemVjson.text = '文本';
  31913. break;
  31914. }
  31915. var target = findInCode(this.vjson, raw.id);
  31916. if (region) {
  31917. if (region === 'tbar' || region === 'fbar') {
  31918. target[region] = itemVjson;
  31919. }
  31920. else {
  31921. itemVjson.region = region;
  31922. itemVjson.split = true;
  31923. if (region === 'north' || region === 'south') {
  31924. itemVjson.height = '30%';
  31925. itemVjson.collapsible = true;
  31926. }
  31927. else if (region === 'west' || region === 'east') {
  31928. itemVjson.width = '30%';
  31929. itemVjson.collapsible = true;
  31930. }
  31931. target.items.push(itemVjson);
  31932. }
  31933. }
  31934. else {
  31935. if (target.xtype === 'tabpanel') {
  31936. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  31937. }
  31938. target.items.push(itemVjson);
  31939. }
  31940. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  31941. },
  31942. menuNew: function (typeArr, raw, region) {
  31943. var that = this;
  31944. var reArr = [];
  31945. typeArr.forEach(function (value) {
  31946. if (value === 'cnsew') {
  31947. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  31948. }
  31949. else if (value === 'tbar' || value === 'fbar') {
  31950. reArr.push(that.menuNewTFBar(value, raw));
  31951. }
  31952. else {
  31953. reArr.push({
  31954. text: '新建' + layoutOrXtypeNameMap[value],
  31955. iconCls: 'x-fa fa-plus',
  31956. handler: function (sender) {
  31957. that.newItem(value, raw, region);
  31958. }
  31959. });
  31960. }
  31961. reArr.push("-");
  31962. });
  31963. if (region) {
  31964. reArr.pop();
  31965. return reArr;
  31966. }
  31967. reArr.push({
  31968. text: '高级属性',
  31969. iconCls: 'x-fa fa-cog',
  31970. handler: function (sender) {
  31971. var vj = findInCode(that.vjson, raw.id);
  31972. that.advancedSettingWindow(vj);
  31973. }
  31974. }, {
  31975. text: '上移',
  31976. iconCls: 'x-fa fa-trash',
  31977. handler: function (sender) {
  31978. that.moveCmp(raw.id, 'up');
  31979. }
  31980. }, {
  31981. text: '置顶',
  31982. iconCls: 'x-fa fa-trash',
  31983. handler: function (sender) {
  31984. that.moveCmp(raw.id, 'top');
  31985. }
  31986. }, {
  31987. text: '置底',
  31988. iconCls: 'x-fa fa-trash',
  31989. handler: function (sender) {
  31990. that.moveCmp(raw.id, 'bottom');
  31991. }
  31992. }, {
  31993. text: '下移',
  31994. iconCls: 'x-fa fa-trash',
  31995. handler: function (sender) {
  31996. that.moveCmp(raw.id, 'down');
  31997. }
  31998. }, {
  31999. text: '删除',
  32000. iconCls: 'x-fa fa-trash',
  32001. handler: function (sender) {
  32002. deletVjsonById(that.vjson, raw.id);
  32003. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32004. }
  32005. });
  32006. return reArr;
  32007. },
  32008. menuNewCNSEW: function (raw) {
  32009. var that = this;
  32010. var arr = ['center', 'north', 'south', 'west', 'east'];
  32011. if (raw.hasOwnProperty("children")) {
  32012. _.forEach(raw.children, function (value) {
  32013. _.remove(arr, function (it) {
  32014. return it === value.layoutName;
  32015. });
  32016. });
  32017. }
  32018. var reArr = [];
  32019. arr.forEach(function (value) {
  32020. reArr.push({
  32021. text: layoutOrXtypeNameMap[value],
  32022. iconCls: 'x-fa fa-plus',
  32023. menu: {
  32024. showSeparator: true,
  32025. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32026. }
  32027. });
  32028. reArr.push("-");
  32029. });
  32030. reArr.pop();
  32031. return reArr;
  32032. },
  32033. menuNewTFBar: function (barType, raw) {
  32034. var that = this;
  32035. var reObj = {
  32036. text: layoutOrXtypeNameMap[barType],
  32037. iconCls: 'x-fa fa-plus',
  32038. menu: {
  32039. showSeparator: true,
  32040. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32041. }
  32042. };
  32043. return reObj;
  32044. },
  32045. moveCmp: function (id, moveType) {
  32046. var arr = findArrayContainer(this.vjson, id);
  32047. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32048. if (index < 0) {
  32049. return;
  32050. }
  32051. switch (moveType) {
  32052. case 'up':
  32053. if (index > 0) {
  32054. var o = arr[index];
  32055. arr[index] = arr[index - 1];
  32056. arr[index - 1] = o;
  32057. }
  32058. else {
  32059. return;
  32060. }
  32061. break;
  32062. case 'down':
  32063. if (index < arr.length - 1) {
  32064. var o = arr[index];
  32065. arr[index] = arr[index + 1];
  32066. arr[index + 1] = o;
  32067. }
  32068. else {
  32069. return;
  32070. }
  32071. break;
  32072. case 'top':
  32073. if (index > 0) {
  32074. var o = arr[index];
  32075. arr[index] = arr[0];
  32076. arr[0] = o;
  32077. }
  32078. else {
  32079. return;
  32080. }
  32081. break;
  32082. case 'bottom':
  32083. if (index < arr.length - 1) {
  32084. var o = arr[index];
  32085. arr[index] = arr[arr.length - 1];
  32086. arr[arr.length - 1] = o;
  32087. }
  32088. else {
  32089. return;
  32090. }
  32091. break;
  32092. }
  32093. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32094. }
  32095. });
  32096. }
  32097. //# sourceMappingURL=ViewOutlineTree.js.map
  32098. function init$2 () {
  32099. window['native'] = native;
  32100. native.init();
  32101. init();
  32102. initStateTree();
  32103. initDashboard();
  32104. initFileTree();
  32105. initDbTree();
  32106. initReportGrid();
  32107. initGroovyEditor();
  32108. initJsEditor$1();
  32109. initJsonEditor$1();
  32110. initSqlEditor$1();
  32111. initTemplateEditor();
  32112. initDict$1();
  32113. initBpmnTree();
  32114. initToolBox();
  32115. initPropertyDesign();
  32116. initViewOutlineTree();
  32117. initWidget();
  32118. initWhLayout();
  32119. initApiTree();
  32120. initTaskTree();
  32121. initLogsTree();
  32122. initDevOpsTree();
  32123. initTerminal();
  32124. initMonitorTree();
  32125. initHomeTree();
  32126. }
  32127. //# sourceMappingURL=init.js.map
  32128. var studio = {
  32129. init: init$2,
  32130. handles: handles$1,
  32131. Workbench: Workbench
  32132. };
  32133. //# sourceMappingURL=index.js.map
  32134. exports.axios = axios;
  32135. exports.qs = Qs;
  32136. exports.lodash = _$2;
  32137. exports.jquery = $$2;
  32138. exports.moment = moment$1;
  32139. exports.recast = recast;
  32140. exports.XLSX = XLSX;
  32141. exports.Defaults = Defaults;
  32142. exports.ExcelImportDialog = ExcelImportDialog;
  32143. exports.Lib = Lib;
  32144. exports.LibParam = LibParam;
  32145. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32146. exports.ReportScope = ReportScope;
  32147. exports.SIMPLE_RE = SIMPLE_RE;
  32148. exports.Scope = Scope;
  32149. exports.ScopeEngine = ScopeEngine;
  32150. exports.SystemEventFu = SystemEventFu;
  32151. exports.ajax = ajax;
  32152. exports.baseConfigProcess = baseConfigProcess;
  32153. exports.baseConfigProcessList = baseConfigProcessList;
  32154. exports.buildPlus = buildPlus;
  32155. exports.buildReportScope = buildReportScope;
  32156. exports.calcExpress = calcExpress;
  32157. exports.calcObject = calcObject;
  32158. exports.calcObjectFlat = calcObjectFlat;
  32159. exports.clearViewModel = clearViewModel;
  32160. exports.clearViewModelByLookup = clearViewModelByLookup;
  32161. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32162. exports.clearViewModelValues = clearViewModelValues;
  32163. exports.commitMe = commitMe;
  32164. exports.confirm = confirm;
  32165. exports.createAjax = createAjax;
  32166. exports.createUUID = createUUID;
  32167. exports.downLoad = downLoad;
  32168. exports.evalFunction = evalFunction;
  32169. exports.extend = extend;
  32170. exports.flatRow = flatRow;
  32171. exports.getApiConvert = getApiConvert;
  32172. exports.getGridEditRows = getGridEditRows;
  32173. exports.getParentGrid = getParentGrid;
  32174. exports.getPinyin = getPinyin;
  32175. exports.getRegList = getRegList;
  32176. exports.getRegParamList = getRegParamList;
  32177. exports.getScopeOnCreate = getScopeOnCreate;
  32178. exports.init = init$1;
  32179. exports.insertGridRow = insertGridRow;
  32180. exports.invokeServer = invokeServer$1;
  32181. exports.isDesignMode = isDesignMode;
  32182. exports.isEmpty = isEmpty;
  32183. exports.json5 = dist;
  32184. exports.keywordFilter = keywordFilter;
  32185. exports.lookupFn = lookupFn;
  32186. exports.lookupScope = lookupScope;
  32187. exports.mergeViewModel = mergeViewModel;
  32188. exports.moveDownGridRow = moveDownGridRow;
  32189. exports.moveUpGridRow = moveUpGridRow;
  32190. exports.msg = msg$1;
  32191. exports.msgError = msgError;
  32192. exports.normId = normId;
  32193. exports.pinyinMatch = pinyinMatch;
  32194. exports.prompt = prompt$2;
  32195. exports.raiseClick = raiseClick;
  32196. exports.reloadGrid = reloadGrid;
  32197. exports.removeGridRow = removeGridRow;
  32198. exports.replaceNA = replaceNA;
  32199. exports.saveGridRow = saveGridRow;
  32200. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32201. exports.setComboStore = setComboStore;
  32202. exports.showErrorDialog = showErrorDialog$1;
  32203. exports.showInfoDialog = showInfoDialog;
  32204. exports.showWidget = showWidget;
  32205. exports.sqlUrlTransform = sqlUrlTransform;
  32206. exports.stopEvent = stopEvent;
  32207. exports.studio = studio;
  32208. exports.toPlainObject = toPlainObject;
  32209. exports.toString = toString;
  32210. exports.tryEnable = tryEnable;
  32211. exports.tryVarSimple = tryVarSimple;
  32212. exports.tryWriteByExpress = tryWriteByExpress;
  32213. exports.tryWriteObject = tryWriteObject;
  32214. exports.watch = watch;
  32215. Object.defineProperty(exports, '__esModule', { value: true });
  32216. });
  32217. //# sourceMappingURL=yvan-ext.js.map