form-create.esm.js 120 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224
  1. /*!
  2. * FormCreate 低代码表单渲染器
  3. * @form-create/element-ui v2.6.3
  4. * (c) 2018-2024 xaboy
  5. * Github https://github.com/xaboy/form-create
  6. * Site https://form-create.com/
  7. * Released under the MIT License.
  8. */
  9. (function(){"use strict";try{if(typeof document!="undefined"){var o=document.createElement("style");o.appendChild(document.createTextNode('._fc-frame .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-frame .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-frame .fc-files:hover .fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame .fc-upload-btn,.fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-upload .fc-files img{width:100%;height:100%;display:inline-block;vertical-align:top}._fc-upload .fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-upload .fc-upload-cover{opacity:0;position:absolute;inset:0;background:#0009;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-upload .fc-upload-cover i{color:#fff;font-size:20px;cursor:pointer;margin:0 2px}._fc-upload .fc-files:hover .fc-upload-cover{opacity:1}._fc-upload .el-upload{display:block}._fc-upload .fc-upload-btn,._fc-upload .fc-files{display:inline-block;width:58px;height:58px;text-align:center;line-height:58px;border:1px solid #c0ccda;border-radius:4px;overflow:hidden;background:#fff;position:relative;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px #0000001a;margin-right:4px;-webkit-box-sizing:border-box;box-sizing:border-box}._fc-group{display:flex;min-height:42px;justify-content:center;flex-direction:column}._fc-group-disabled ._fc-group-btn,._fc-group-disabled ._fc-group-add{cursor:not-allowed}._fc-group-handle{display:flex;flex-direction:row;position:absolute;bottom:-15px;right:30px;border-radius:15px;border:1px dashed #d9d9d9;padding:3px 8px;background-color:#fff}._fc-group-btn{cursor:pointer}._fc-group-idx{position:absolute;bottom:-15px;left:10px;width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#eee;border-radius:15px;font-weight:700}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{position:relative;display:flex;flex-direction:column;border:1px dashed #d9d9d9;padding:20px 20px 25px;margin:5px 5px 25px;border-radius:5px}._fc-group-arrow{position:relative;width:20px;height:20px}._fc-group-arrow:before{content:"";position:absolute;top:8px;left:5px;width:9px;height:9px;border-left:2px solid #999;border-top:2px solid #999}._fc-group-arrow:before{transform:rotate(45deg)}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{width:20px;height:20px;position:relative;cursor:pointer}._fc-group-plus-minus:before,._fc-group-plus-minus:after{content:"";position:absolute;top:50%;left:50%;width:60%;height:2px;background-color:#409eff;transform:translate(-50%,-50%)}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{cursor:pointer;width:25px;height:25px;border:1px solid rgb(64 158 255 / 50%);border-radius:15px}._fc-group-add._fc-group-plus-minus:before,._fc-group-add._fc-group-plus-minus:after{width:50%}.form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}')),document.head.appendChild(o)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
  10. var pt = Object.defineProperty, mt = Object.defineProperties;
  11. var yt = Object.getOwnPropertyDescriptors;
  12. var Ee = Object.getOwnPropertySymbols;
  13. var gt = Object.prototype.hasOwnProperty, $t = Object.prototype.propertyIsEnumerable;
  14. var Se = (t, e, r) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, y = (t, e) => {
  15. for (var r in e || (e = {}))
  16. gt.call(e, r) && Se(t, r, e[r]);
  17. if (Ee)
  18. for (var r of Ee(e))
  19. $t.call(e, r) && Se(t, r, e[r]);
  20. return t;
  21. }, N = (t, e) => mt(t, yt(e));
  22. import T from "vue";
  23. function vt(t) {
  24. return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
  25. }
  26. function ae() {
  27. return ae = Object.assign ? Object.assign.bind() : function(t) {
  28. for (var e, r = 1; r < arguments.length; r++) for (var i in e = arguments[r], e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
  29. return t;
  30. }, ae.apply(this, arguments);
  31. }
  32. var bt = ["attrs", "props", "domProps"], Ct = ["class", "style", "directives"], _t = ["on", "nativeOn"], Ot = function(t) {
  33. return t.reduce(function(e, r) {
  34. for (var i in r) if (!e[i]) e[i] = r[i];
  35. else if (bt.indexOf(i) !== -1) e[i] = ae({}, e[i], r[i]);
  36. else if (Ct.indexOf(i) !== -1) {
  37. var s = e[i] instanceof Array ? e[i] : [e[i]], n = r[i] instanceof Array ? r[i] : [r[i]];
  38. e[i] = [].concat(s, n);
  39. } else if (_t.indexOf(i) !== -1)
  40. for (var o in r[i]) if (e[i][o]) {
  41. var a = e[i][o] instanceof Array ? e[i][o] : [e[i][o]], u = r[i][o] instanceof Array ? r[i][o] : [r[i][o]];
  42. e[i][o] = [].concat(a, u);
  43. } else e[i][o] = r[i][o];
  44. else if (i === "hook") for (var l in r[i]) e[i][l] = e[i][l] ? kt(e[i][l], r[i][l]) : r[i][l];
  45. else e[i] = r[i];
  46. return e;
  47. }, {});
  48. }, kt = function(t, e) {
  49. return function() {
  50. t && t.apply(this, arguments), e && e.apply(this, arguments);
  51. };
  52. }, wt = Ot;
  53. const F = /* @__PURE__ */ vt(wt);
  54. function Y(t, e) {
  55. return Object.keys(t).reduce((r, i) => ((!e || e.indexOf(i) === -1) && r.push(t[i]), r), []);
  56. }
  57. const Ft = "fcCheckbox", Et = {
  58. name: Ft,
  59. props: {
  60. formCreateInject: {
  61. type: Object,
  62. required: !0
  63. },
  64. value: {
  65. type: Array,
  66. default: () => []
  67. },
  68. type: String
  69. },
  70. watch: {
  71. "formCreateInject.options": {
  72. handler() {
  73. this.update();
  74. },
  75. deep: !0
  76. },
  77. value() {
  78. this.update();
  79. }
  80. },
  81. data() {
  82. return {
  83. trueValue: []
  84. };
  85. },
  86. methods: {
  87. options() {
  88. const t = this.formCreateInject.options;
  89. return Array.isArray(t) ? t : [];
  90. },
  91. onInput(t) {
  92. this.$emit("input", this.options().filter((e) => t.indexOf(e.label) !== -1).map((e) => e.value).filter((e) => e !== void 0));
  93. },
  94. update() {
  95. const t = Array.isArray(this.value) ? this.value : [this.value];
  96. this.trueValue = this.options().filter((e) => t.indexOf(e.value) !== -1).map((e) => e.label);
  97. }
  98. },
  99. created() {
  100. this.update();
  101. },
  102. render() {
  103. const t = arguments[0];
  104. return t("ElCheckboxGroup", F([{}, this.formCreateInject.prop, {}, {
  105. props: {
  106. value: this.trueValue
  107. }
  108. }, {
  109. ref: "el",
  110. on: {
  111. input: this.onInput
  112. }
  113. }]), [this.options().map((e, r) => {
  114. const i = y({}, e), s = this.type === "button" ? "ElCheckboxButton" : "ElCheckbox";
  115. return delete i.value, t(s, F([{}, {
  116. props: i
  117. }, {
  118. key: s + r + "-" + e.value
  119. }]));
  120. }), Y(this.$slots)]);
  121. },
  122. mounted() {
  123. this.$emit("fc.el", this.$refs.el);
  124. }
  125. };
  126. function j(t) {
  127. return Array.isArray(t) ? t : [null, void 0, ""].indexOf(t) > -1 ? [] : [t];
  128. }
  129. const St = "fcFrame", Rt = {
  130. name: St,
  131. props: {
  132. formCreateInject: {
  133. type: Object,
  134. required: !0
  135. },
  136. type: {
  137. type: String,
  138. default: "input"
  139. },
  140. field: String,
  141. helper: {
  142. type: Boolean,
  143. default: !0
  144. },
  145. disabled: {
  146. type: Boolean,
  147. default: !1
  148. },
  149. src: {
  150. type: String,
  151. required: !0
  152. },
  153. icon: {
  154. type: String,
  155. default: "el-icon-upload2"
  156. },
  157. width: {
  158. type: String,
  159. default: "500px"
  160. },
  161. height: {
  162. type: String,
  163. default: "370px"
  164. },
  165. maxLength: {
  166. type: Number,
  167. default: 0
  168. },
  169. okBtnText: {
  170. type: String,
  171. default: "确定"
  172. },
  173. closeBtnText: {
  174. type: String,
  175. default: "关闭"
  176. },
  177. modalTitle: String,
  178. handleIcon: {
  179. type: [String, Boolean],
  180. default: void 0
  181. },
  182. title: String,
  183. allowRemove: {
  184. type: Boolean,
  185. default: !0
  186. },
  187. onOpen: {
  188. type: Function,
  189. default: () => {
  190. }
  191. },
  192. onOk: {
  193. type: Function,
  194. default: () => {
  195. }
  196. },
  197. onCancel: {
  198. type: Function,
  199. default: () => {
  200. }
  201. },
  202. onLoad: {
  203. type: Function,
  204. default: () => {
  205. }
  206. },
  207. onBeforeRemove: {
  208. type: Function,
  209. default: () => {
  210. }
  211. },
  212. onRemove: {
  213. type: Function,
  214. default: () => {
  215. }
  216. },
  217. onHandle: {
  218. type: Function,
  219. default(t) {
  220. this.previewImage = this.getSrc(t), this.previewVisible = !0;
  221. }
  222. },
  223. modal: {
  224. type: Object,
  225. default: () => ({})
  226. },
  227. srcKey: {
  228. type: [String, Number]
  229. },
  230. value: [Array, String, Number, Object],
  231. previewMask: void 0,
  232. footer: {
  233. type: Boolean,
  234. default: !0
  235. },
  236. reload: {
  237. type: Boolean,
  238. default: !0
  239. },
  240. closeBtn: {
  241. type: Boolean,
  242. default: !0
  243. },
  244. okBtn: {
  245. type: Boolean,
  246. default: !0
  247. }
  248. },
  249. data() {
  250. return {
  251. fileList: j(this.value),
  252. previewVisible: !1,
  253. frameVisible: !1,
  254. previewImage: ""
  255. };
  256. },
  257. watch: {
  258. value(t) {
  259. this.fileList = j(t);
  260. },
  261. fileList(t) {
  262. const e = this.maxLength === 1 ? t[0] || "" : t;
  263. this.$emit("input", e), this.$emit("change", e);
  264. },
  265. src(t) {
  266. this.modalVm && (this.modalVm.src = t);
  267. }
  268. },
  269. methods: {
  270. key(t) {
  271. return t;
  272. },
  273. closeModel(t) {
  274. this.$emit(t ? "$close" : "$ok"), this.reload && (this.$off("$ok"), this.$off("$close")), this.frameVisible = !1;
  275. },
  276. handleCancel() {
  277. this.previewVisible = !1;
  278. },
  279. showModel() {
  280. this.disabled || this.onOpen() === !1 || (this.frameVisible = !0);
  281. },
  282. makeInput() {
  283. const t = this.$createElement, e = {
  284. type: "text",
  285. value: this.fileList.map((r) => this.getSrc(r)).toString(),
  286. readonly: !0
  287. };
  288. return t("ElInput", F([{}, {
  289. props: e
  290. }, {
  291. key: this.key("input")
  292. }]), [this.fileList.length ? t("i", {
  293. slot: "suffix",
  294. class: "el-input__icon el-icon-circle-close",
  295. on: {
  296. click: () => this.fileList = []
  297. }
  298. }) : null, t("ElButton", F([{
  299. attrs: {
  300. icon: this.icon
  301. }
  302. }, {
  303. on: {
  304. click: () => this.showModel()
  305. }
  306. }, {
  307. slot: "append"
  308. }]))]);
  309. },
  310. makeGroup(t) {
  311. const e = this.$createElement;
  312. return (!this.maxLength || this.fileList.length < this.maxLength) && t.push(this.makeBtn()), e("div", {
  313. key: this.key("group")
  314. }, [...t]);
  315. },
  316. makeItem(t, e) {
  317. const r = this.$createElement;
  318. return r("div", {
  319. class: "fc-files",
  320. key: this.key("file" + t)
  321. }, [...e]);
  322. },
  323. valid(t) {
  324. const e = this.formCreateInject.field || this.field;
  325. if (e && t !== e)
  326. throw new Error("[frame]无效的字段值");
  327. },
  328. makeIcons(t, e) {
  329. const r = this.$createElement;
  330. if (this.handleIcon !== !1 || this.allowRemove === !0) {
  331. const i = [];
  332. return (this.type !== "file" && this.handleIcon !== !1 || this.type === "file" && this.handleIcon) && i.push(this.makeHandleIcon(t, e)), this.allowRemove && i.push(this.makeRemoveIcon(t, e)), r("div", {
  333. class: "fc-upload-cover",
  334. key: this.key("uc")
  335. }, [i]);
  336. }
  337. },
  338. makeHandleIcon(t, e) {
  339. const r = this.$createElement;
  340. return r("i", {
  341. class: this.handleIcon === !0 || this.handleIcon === void 0 ? "el-icon-view" : this.handleIcon,
  342. on: {
  343. click: () => this.handleClick(t)
  344. },
  345. key: this.key("hi" + e)
  346. });
  347. },
  348. makeRemoveIcon(t, e) {
  349. const r = this.$createElement;
  350. return r("i", {
  351. class: "el-icon-delete",
  352. on: {
  353. click: () => this.handleRemove(t)
  354. },
  355. key: this.key("ri" + e)
  356. });
  357. },
  358. makeFiles() {
  359. const t = this.$createElement;
  360. return this.makeGroup(this.fileList.map((e, r) => this.makeItem(r, [t("i", {
  361. class: "el-icon-tickets",
  362. on: {
  363. click: () => this.handleClick(e)
  364. }
  365. }), this.makeIcons(e, r)])));
  366. },
  367. makeImages() {
  368. const t = this.$createElement;
  369. return this.makeGroup(this.fileList.map((e, r) => this.makeItem(r, [t("img", {
  370. attrs: {
  371. src: this.getSrc(e)
  372. }
  373. }), this.makeIcons(e, r)])));
  374. },
  375. makeBtn() {
  376. const t = this.$createElement;
  377. return t("div", {
  378. class: "fc-upload-btn",
  379. on: {
  380. click: () => this.showModel()
  381. },
  382. key: this.key("btn")
  383. }, [t("i", {
  384. class: this.icon
  385. })]);
  386. },
  387. handleClick(t) {
  388. return this.onHandle(t);
  389. },
  390. handleRemove(t) {
  391. this.disabled || this.onBeforeRemove(t) !== !1 && (this.fileList.splice(this.fileList.indexOf(t), 1), this.onRemove(t));
  392. },
  393. getSrc(t) {
  394. return this.srcKey ? t[this.srcKey] : t;
  395. },
  396. frameLoad(t) {
  397. this.onLoad(t);
  398. try {
  399. this.helper === !0 && (t.form_create_helper = {
  400. api: this.formCreateInject.api,
  401. close: (e) => {
  402. this.valid(e), this.closeModel();
  403. },
  404. set: (e, r) => {
  405. this.valid(e), this.disabled || this.$emit("input", r);
  406. },
  407. get: (e) => (this.valid(e), this.value),
  408. onOk: (e) => this.$on("$ok", e),
  409. onClose: (e) => this.$on("$close", e)
  410. });
  411. } catch (e) {
  412. console.log(e);
  413. }
  414. },
  415. makeFooter() {
  416. const t = this.$createElement, {
  417. okBtnText: e,
  418. closeBtnText: r,
  419. closeBtn: i,
  420. okBtn: s,
  421. footer: n
  422. } = this.$props;
  423. if (n)
  424. return t("div", {
  425. slot: "footer"
  426. }, [i ? t("ElButton", {
  427. on: {
  428. click: () => this.onCancel() !== !1 && (this.frameVisible = !1)
  429. }
  430. }, [r]) : null, s ? t("ElButton", {
  431. attrs: {
  432. type: "primary"
  433. },
  434. on: {
  435. click: () => this.onOk() !== !1 && this.closeModel()
  436. }
  437. }, [e]) : null]);
  438. }
  439. },
  440. render() {
  441. const t = arguments[0], e = this.type;
  442. let r;
  443. e === "input" ? r = this.makeInput() : e === "image" ? r = this.makeImages() : r = this.makeFiles();
  444. const {
  445. width: i = "30%",
  446. height: s,
  447. src: n,
  448. title: o,
  449. modalTitle: a
  450. } = this.$props;
  451. return this.$nextTick(() => {
  452. this.$refs.frame && this.frameLoad(this.$refs.frame.contentWindow || {});
  453. }), t("div", {
  454. class: "_fc-frame"
  455. }, [r, t("el-dialog", F([{}, {
  456. props: {
  457. appendToBody: !0,
  458. modal: this.previewMask,
  459. title: a,
  460. visible: this.previewVisible
  461. }
  462. }, {
  463. on: {
  464. close: this.handleCancel
  465. }
  466. }]), [t("img", {
  467. style: "width: 100%",
  468. attrs: {
  469. src: this.previewImage
  470. }
  471. })]), t("el-dialog", F([{}, {
  472. props: N(y({
  473. width: i,
  474. title: o,
  475. appendToBody: !0
  476. }, this.modal), {
  477. visible: this.frameVisible
  478. })
  479. }, {
  480. on: {
  481. close: () => this.closeModel(!0)
  482. }
  483. }]), [this.frameVisible || !this.reload ? t("iframe", {
  484. ref: "frame",
  485. attrs: {
  486. src: n,
  487. frameBorder: "0"
  488. },
  489. style: {
  490. height: s,
  491. border: "0 none",
  492. width: "100%"
  493. }
  494. }) : null, this.makeFooter()])]);
  495. },
  496. mounted() {
  497. this.$on("fc.closeModal", this.closeModal);
  498. }
  499. }, jt = "fcRadio", It = {
  500. name: jt,
  501. props: {
  502. formCreateInject: {
  503. type: Object,
  504. required: !0
  505. },
  506. value: {},
  507. type: String
  508. },
  509. watch: {
  510. "formCreateInject.options": {
  511. handler() {
  512. this.update();
  513. },
  514. deep: !0
  515. },
  516. value() {
  517. this.update();
  518. }
  519. },
  520. data() {
  521. return {
  522. trueValue: []
  523. };
  524. },
  525. methods: {
  526. options() {
  527. const t = this.formCreateInject.options;
  528. return Array.isArray(t) ? t : [];
  529. },
  530. onInput(t) {
  531. this.$emit("input", this.options().filter((e) => e.label === t).reduce((e, r) => r.value, ""));
  532. },
  533. update() {
  534. this.trueValue = this.options().filter((t) => t.value === this.value).reduce((t, e) => e.label, "");
  535. }
  536. },
  537. created() {
  538. this.update();
  539. },
  540. render() {
  541. const t = arguments[0];
  542. return t("ElRadioGroup", F([{}, this.formCreateInject.prop, {
  543. ref: "el"
  544. }, {
  545. props: {
  546. value: this.trueValue
  547. }
  548. }, {
  549. on: {
  550. input: this.onInput
  551. }
  552. }]), [this.options().map((e, r) => {
  553. const i = y({}, e), s = this.type === "button" ? "ElRadioButton" : "ElRadio";
  554. return delete i.value, t(s, F([{}, {
  555. props: i
  556. }, {
  557. key: s + r + "-" + e.value
  558. }]));
  559. }), Y(this.$slots)]);
  560. },
  561. mounted() {
  562. this.$emit("fc.el", this.$refs.el);
  563. }
  564. }, h = {
  565. type(t, e) {
  566. return Object.prototype.toString.call(t) === "[object " + e + "]";
  567. },
  568. Undef(t) {
  569. return t == null;
  570. },
  571. Element(t) {
  572. return typeof t == "object" && t !== null && t.nodeType === 1 && !h.Object(t);
  573. },
  574. trueArray(t) {
  575. return Array.isArray(t) && t.length > 0;
  576. },
  577. Function(t) {
  578. const e = this.getType(t);
  579. return e === "Function" || e === "AsyncFunction";
  580. },
  581. getType(t) {
  582. const e = Object.prototype.toString.call(t);
  583. return /^\[object (.*)\]$/.exec(e)[1];
  584. },
  585. empty(t) {
  586. return t == null || Array.isArray(t) && Array.isArray(t) && !t.length ? !0 : typeof t == "string" && !t;
  587. }
  588. };
  589. ["Date", "Object", "String", "Boolean", "Array", "Number"].forEach((t) => {
  590. h[t] = function(e) {
  591. return h.type(e, t);
  592. };
  593. });
  594. function k(t, e) {
  595. return {}.hasOwnProperty.call(t, e);
  596. }
  597. const At = "fcSelect", Vt = {
  598. name: At,
  599. functional: !0,
  600. props: {
  601. formCreateInject: {
  602. type: Object,
  603. required: !0
  604. }
  605. },
  606. render(t, e) {
  607. const r = (n, o) => {
  608. const a = n.slot;
  609. return t("ElOption", F([{}, {
  610. props: n
  611. }, {
  612. key: "" + o + "-" + n.value
  613. }]), [a ? t("template", {
  614. slot: n.slotName || "default"
  615. }, [h.Function(a) ? n.slot(t) : a]) : null]);
  616. }, i = (n, o) => t("ElOptionGroup", {
  617. attrs: {
  618. label: n.label
  619. },
  620. key: "" + o + "-" + n.label
  621. }, [h.trueArray(n.options) && n.options.map((a, u) => r(a, u))]), s = e.props.formCreateInject.options;
  622. return t("ElSelect", F([{}, e.data, {
  623. ref: "el"
  624. }]), [(Array.isArray(s) ? s : []).map((n, o) => k(n || "", "options") ? i(n, o) : r(n, o)), e.children]);
  625. },
  626. mounted() {
  627. this.$emit("fc.el", this.$refs.el);
  628. }
  629. }, Pt = "fcTree", Tt = {
  630. name: Pt,
  631. formCreateParser: {
  632. mergeProp(t) {
  633. const e = t.prop.props;
  634. e.nodeKey || (e.nodeKey = "id"), e.props || (e.props = {
  635. label: "title"
  636. });
  637. }
  638. },
  639. props: {
  640. formCreateInject: {
  641. type: Object,
  642. required: !0
  643. },
  644. type: {
  645. type: String,
  646. default: "checked"
  647. },
  648. value: {
  649. type: [Array, String, Number],
  650. default: () => []
  651. }
  652. },
  653. watch: {
  654. value() {
  655. this.setValue();
  656. }
  657. },
  658. methods: {
  659. onChange() {
  660. this.updateValue();
  661. },
  662. updateValue() {
  663. if (!this.$refs.tree) return;
  664. const t = this.type.toLocaleLowerCase();
  665. let e;
  666. t === "selected" ? e = this.$refs.tree.getCurrentKey() : e = this.$refs.tree.getCheckedKeys(), this.$emit("input", e);
  667. },
  668. setValue() {
  669. this.type.toLocaleLowerCase() === "selected" ? this.$refs.tree.setCurrentKey(this.value) : this.$refs.tree.setCheckedKeys(j(this.value));
  670. }
  671. },
  672. render() {
  673. const t = arguments[0];
  674. return t("ElTree", F([{}, this.formCreateInject.prop, {
  675. ref: "tree",
  676. on: {
  677. check: () => this.updateValue(),
  678. "node-click": () => this.updateValue()
  679. }
  680. }]), [Y(this.$slots)]);
  681. },
  682. mounted() {
  683. this.setValue(), this.$emit("fc.el", this.$refs.tree);
  684. }
  685. };
  686. function Re(t, e) {
  687. return {
  688. url: t,
  689. name: Dt(t),
  690. uid: e
  691. };
  692. }
  693. function Dt(t) {
  694. return ("" + t).split("/").pop();
  695. }
  696. const Bt = "fcUpload", Lt = {
  697. name: Bt,
  698. props: {
  699. formCreateInject: {
  700. type: Object,
  701. required: !0
  702. },
  703. onHandle: {
  704. type: Function,
  705. default(t) {
  706. this.previewImage = t.url, this.previewVisible = !0;
  707. }
  708. },
  709. uploadType: {
  710. type: String,
  711. default: "file"
  712. },
  713. limit: {
  714. type: Number,
  715. default: 0
  716. },
  717. allowRemove: {
  718. type: Boolean,
  719. default: !0
  720. },
  721. previewMask: void 0,
  722. modalTitle: String,
  723. handleIcon: {
  724. type: [String, Boolean],
  725. default: () => {
  726. }
  727. },
  728. value: [Array, String]
  729. },
  730. data() {
  731. return {
  732. uploadList: [],
  733. previewVisible: !1,
  734. previewImage: "",
  735. cacheFiles: []
  736. };
  737. },
  738. created() {
  739. this.formCreateInject.prop.props.showFileList === void 0 && (this.formCreateInject.prop.props.showFileList = !1), this.formCreateInject.prop.props.fileList = j(this.value).map(Re);
  740. },
  741. watch: {
  742. value(t) {
  743. this.$refs.upload.uploadFiles.every((e) => !e.status || e.status === "success") && (this.$refs.upload.uploadFiles = j(t).map(Re), this.uploadList = this.$refs.upload.uploadFiles);
  744. },
  745. limit(t, e) {
  746. (e === 1 || t === 1) && this.update();
  747. }
  748. },
  749. methods: {
  750. key(t) {
  751. return t;
  752. },
  753. isDisabled() {
  754. return this.formCreateInject.prop.props.disabled === !0;
  755. },
  756. onRemove(t) {
  757. this.isDisabled() || this.$refs.upload.handleRemove(t);
  758. },
  759. handleClick(t) {
  760. this.onHandle(t);
  761. },
  762. makeItem(t, e) {
  763. const r = this.$createElement;
  764. return this.uploadType === "image" ? r("img", {
  765. attrs: {
  766. src: t.url
  767. },
  768. key: this.key("img" + e)
  769. }) : r("i", {
  770. class: "el-icon-tickets",
  771. key: this.key("i" + e)
  772. });
  773. },
  774. makeRemoveIcon(t, e) {
  775. const r = this.$createElement;
  776. return r("i", {
  777. class: "el-icon-delete",
  778. on: {
  779. click: () => this.onRemove(t)
  780. },
  781. key: this.key("ri" + e)
  782. });
  783. },
  784. makeHandleIcon(t, e) {
  785. const r = this.$createElement;
  786. return r("i", {
  787. class: this.handleIcon === !0 || this.handleIcon === void 0 ? "el-icon-view" : this.handleIcon,
  788. on: {
  789. click: () => this.handleClick(t)
  790. },
  791. key: this.key("hi" + e)
  792. });
  793. },
  794. makeProgress(t, e) {
  795. const r = this.$createElement;
  796. return r("ElProgress", F([{}, {
  797. props: {
  798. percentage: t.percentage,
  799. type: "circle",
  800. width: 52
  801. }
  802. }, {
  803. style: "margin-top:2px;",
  804. key: this.key("pg" + e)
  805. }]));
  806. },
  807. makeIcons(t, e) {
  808. const r = this.$createElement, i = [];
  809. if (this.allowRemove || this.handleIcon !== !1)
  810. return (this.uploadType !== "file" && this.handleIcon !== !1 || this.uploadType === "file" && this.handleIcon) && i.push(this.makeHandleIcon(t, e)), this.allowRemove && i.push(this.makeRemoveIcon(t, e)), r("div", {
  811. class: "fc-upload-cover"
  812. }, [i]);
  813. },
  814. makeFiles() {
  815. const t = this.$createElement;
  816. return this.uploadList.map((e, r) => this.$scopedSlots.fileList ? this.$scopedSlots.fileList({
  817. file: e,
  818. index: r,
  819. vm: this
  820. }) : t("div", {
  821. key: this.key(r),
  822. class: "fc-files"
  823. }, [e.percentage !== void 0 && e.status !== "success" ? this.makeProgress(e, r) : [this.makeItem(e, r), this.makeIcons(e, r)]]));
  824. },
  825. makeUpload() {
  826. const t = this.$createElement, e = !this.limit || this.limit > this.uploadList.length;
  827. return t("ElUpload", F([{}, this.formCreateInject.prop, {}, {
  828. style: {
  829. display: "inline-block"
  830. },
  831. key: this.key("upload"),
  832. ref: "upload"
  833. }]), [e ? t("template", {
  834. slot: "default"
  835. }, [this.$slots.default || t("div", {
  836. class: "fc-upload-btn"
  837. }, [t("i", {
  838. class: "el-icon-upload2"
  839. })])]) : null, Y(this.$slots, ["default"])]);
  840. },
  841. update() {
  842. let t = this.$refs.upload.uploadFiles.map((e) => e.url).filter((e) => e !== void 0 && e.indexOf("blob:") !== 0);
  843. JSON.stringify(t) !== JSON.stringify(this.cacheFiles) && (this.cacheFiles = [...t], this.$emit("input", this.limit === 1 ? t[0] || "" : t));
  844. },
  845. handleCancel() {
  846. this.previewVisible = !1;
  847. }
  848. },
  849. render() {
  850. const t = arguments[0];
  851. return this.$refs.upload && (this.formCreateInject.prop.props.showFileList === void 0 && (this.formCreateInject.prop.props.showFileList = this.$refs.upload.showFileList), this.formCreateInject.prop.props.fileList = this.$refs.upload.fileList), t("div", {
  852. class: "_fc-upload"
  853. }, [[this.formCreateInject.prop.props.showFileList ? [] : this.makeFiles(), this.makeUpload()], t("el-dialog", F([{}, {
  854. props: {
  855. appendToBody: !0,
  856. modal: this.previewMask,
  857. title: this.modalTitle,
  858. visible: this.previewVisible
  859. }
  860. }, {
  861. on: {
  862. close: this.handleCancel
  863. }
  864. }]), [t("img", {
  865. attrs: {
  866. alt: "example",
  867. src: this.previewImage
  868. },
  869. style: "width: 100%"
  870. })])]);
  871. },
  872. mounted() {
  873. this.uploadList = this.$refs.upload.uploadFiles, this.$watch(() => this.$refs.upload.uploadFiles, () => {
  874. this.update();
  875. }, {
  876. deep: !0
  877. }), this.$emit("fc.el", this.$refs.upload);
  878. }
  879. };
  880. function w(t, e, r) {
  881. T.set(t, e, r);
  882. }
  883. function B(t, e) {
  884. T.delete(t, e);
  885. }
  886. function K(t, e = {}, r) {
  887. let i = !1;
  888. for (let s in e)
  889. if (Object.prototype.hasOwnProperty.call(e, s)) {
  890. let n = e[s];
  891. if ((i = Array.isArray(n)) || h.Object(n)) {
  892. let o = t[s] === void 0;
  893. if (i)
  894. i = !1, o && w(t, s, []);
  895. else if (n._clone && r !== void 0)
  896. if (r)
  897. n = n.getRule(), o && w(t, s, {});
  898. else {
  899. w(t, s, n._clone());
  900. continue;
  901. }
  902. else
  903. o && w(t, s, {});
  904. t[s] = K(t[s], n, r);
  905. } else
  906. w(t, s, n), h.Undef(n) || (h.Undef(n.__json) || (t[s].__json = n.__json), h.Undef(n.__origin) || (t[s].__origin = n.__origin));
  907. }
  908. return r !== void 0 && Array.isArray(t) ? t.filter((s) => !s || !s.__ctrl) : t;
  909. }
  910. function L(t) {
  911. return K({}, { value: t }).value;
  912. }
  913. const Mt = Object.assign || function(t) {
  914. for (let e, r = 1; r < arguments.length; r++)
  915. for (let i in e = arguments[r], e)
  916. Object.prototype.hasOwnProperty.call(e, i) && w(t, i, e[i]);
  917. return t;
  918. };
  919. function p() {
  920. return Mt.apply(this, arguments);
  921. }
  922. const Nt = "fcGroup", qt = {
  923. name: Nt,
  924. props: {
  925. field: String,
  926. rule: [Array, Object],
  927. rules: Array,
  928. expand: Number,
  929. options: Object,
  930. formCreateInject: {
  931. type: Object,
  932. required: !0
  933. },
  934. button: {
  935. type: Boolean,
  936. default: !0
  937. },
  938. max: {
  939. type: Number,
  940. default: 0
  941. },
  942. min: {
  943. type: Number,
  944. default: 0
  945. },
  946. value: {
  947. type: Array,
  948. default: () => []
  949. },
  950. sortBtn: {
  951. type: Boolean,
  952. default: !0
  953. },
  954. defaultValue: Object,
  955. disabled: {
  956. type: Boolean,
  957. default: !1
  958. },
  959. syncDisabled: {
  960. type: Boolean,
  961. default: !0
  962. },
  963. onBeforeRemove: {
  964. type: Function,
  965. default: () => {
  966. }
  967. },
  968. onBeforeAdd: {
  969. type: Function,
  970. default: () => {
  971. }
  972. },
  973. parse: Function
  974. },
  975. data() {
  976. return {
  977. len: 0,
  978. cacheRule: {},
  979. cacheValue: {},
  980. sort: [],
  981. type: void 0
  982. };
  983. },
  984. computed: {
  985. formRule() {
  986. return this.rules ? this.rules : this.rule ? Array.isArray(this.rule) ? this.rule : [this.rule] : [];
  987. }
  988. },
  989. watch: {
  990. cacheRule: {
  991. handler(t) {
  992. this.sort = Object.keys(t);
  993. },
  994. immediate: !0
  995. },
  996. formRule: {
  997. handler(t, e) {
  998. Object.keys(this.cacheRule).forEach((r) => {
  999. const i = this.cacheRule[r];
  1000. if (i.$f) {
  1001. const s = i.$f.formData();
  1002. if (t === e)
  1003. i.$f.deferSyncValue(() => {
  1004. K(i.rule, t), i.$f.setValue(s);
  1005. }, !0);
  1006. else {
  1007. const n = i.$f.formData();
  1008. i.$f.once("reloading", () => {
  1009. i.$f.setValue(n);
  1010. }), i.rule = L(t);
  1011. }
  1012. }
  1013. });
  1014. },
  1015. deep: !0
  1016. },
  1017. expand(t) {
  1018. let e = t - this.value.length;
  1019. e > 0 && this.expandRule(e);
  1020. },
  1021. value(t, e) {
  1022. t = t || [];
  1023. let r = this.sort, i = r.length, s = i - t.length;
  1024. if (s < 0) {
  1025. for (let n = s; n < 0; n++)
  1026. this.addRule(t.length + n);
  1027. this.sort = Object.keys(this.cacheRule);
  1028. for (let n = 0; n < i; n++)
  1029. this.setValue(r[n], t[n]);
  1030. } else {
  1031. if (s > 0) {
  1032. for (let n = 0; n < s; n++)
  1033. this.removeRule(r[i - n - 1]);
  1034. this.sort = Object.keys(this.cacheRule);
  1035. }
  1036. t.forEach((n, o) => {
  1037. this.setValue(r[o], t[o]);
  1038. });
  1039. }
  1040. }
  1041. },
  1042. methods: {
  1043. _value(t) {
  1044. return t && k(t, this.field) ? t[this.field] : t;
  1045. },
  1046. cache(t, e) {
  1047. this.cacheValue[t] = JSON.stringify(e);
  1048. },
  1049. input(t) {
  1050. this.$emit("input", t), this.$emit("change", t);
  1051. },
  1052. formData(t, e) {
  1053. const r = this.cacheRule, i = this.sort;
  1054. if (i.filter((n) => r[n].$f).length !== i.length)
  1055. return;
  1056. const s = i.map((n) => {
  1057. const o = t === n ? e : y({}, this.cacheRule[n].$f.form), a = this.field ? o[this.field] || null : o;
  1058. return this.cache(n, a), a;
  1059. });
  1060. this.input(s);
  1061. },
  1062. setValue(t, e) {
  1063. const r = this.field, i = this.cacheRule[t].$f;
  1064. r && (e = {
  1065. [r]: this._value(e)
  1066. }), this.cacheValue[t] !== JSON.stringify(r ? e[r] : e) && (this.cache(t, e), i && i.coverValue(e || {}));
  1067. },
  1068. addRule(t, e) {
  1069. const r = this.formCreateInject.form.copyRules(this.formRule), i = this.options ? y({}, this.options) : {
  1070. submitBtn: !1,
  1071. resetBtn: !1
  1072. };
  1073. if (this.defaultValue) {
  1074. i.formData || (i.formData = {});
  1075. const s = L(this.defaultValue);
  1076. p(i.formData, this.field ? {
  1077. [this.field]: s
  1078. } : s);
  1079. }
  1080. this.parse && this.parse({
  1081. rule: r,
  1082. options: i,
  1083. index: this.sort.length
  1084. }), this.$set(this.cacheRule, ++this.len, {
  1085. rule: r,
  1086. options: i
  1087. }), e && this.$nextTick(() => this.$emit("add", r, Object.keys(this.cacheRule).length - 1));
  1088. },
  1089. add$f(t, e, r) {
  1090. this.cacheRule[e].$f = r, this.$nextTick(() => {
  1091. this.$emit("itemMounted", r, Object.keys(this.cacheRule).indexOf(e));
  1092. });
  1093. },
  1094. removeRule(t, e) {
  1095. const r = Object.keys(this.cacheRule).indexOf(t);
  1096. this.$delete(this.cacheRule, t), this.$delete(this.cacheValue, t), e && this.$nextTick(() => this.$emit("remove", r));
  1097. },
  1098. add(t) {
  1099. this.disabled || this.onBeforeAdd(this.value) === !1 || this.addRule(t, !0);
  1100. },
  1101. del(t, e) {
  1102. if (this.disabled || this.onBeforeRemove(this.value, t) === !1)
  1103. return;
  1104. this.removeRule(e, !0);
  1105. const r = [...this.value];
  1106. r.splice(t, 1), this.input(r);
  1107. },
  1108. addIcon(t) {
  1109. const e = this.$createElement;
  1110. return e("div", {
  1111. class: "_fc-group-btn _fc-group-plus-minus",
  1112. on: {
  1113. click: this.add
  1114. }
  1115. });
  1116. },
  1117. delIcon(t, e) {
  1118. const r = this.$createElement;
  1119. return r("div", {
  1120. class: "_fc-group-btn _fc-group-plus-minus _fc-group-minus",
  1121. on: {
  1122. click: () => this.del(t, e)
  1123. }
  1124. });
  1125. },
  1126. sortUpIcon(t) {
  1127. const e = this.$createElement;
  1128. return e("div", {
  1129. class: "_fc-group-btn _fc-group-arrow _fc-group-up",
  1130. on: {
  1131. click: () => this.changeSort(t, -1)
  1132. }
  1133. });
  1134. },
  1135. sortDownIcon(t) {
  1136. const e = this.$createElement;
  1137. return e("div", {
  1138. class: "_fc-group-btn _fc-group-arrow _fc-group-down",
  1139. on: {
  1140. click: () => this.changeSort(t, 1)
  1141. }
  1142. });
  1143. },
  1144. changeSort(t, e) {
  1145. const r = this.sort[t];
  1146. this.$set(this.sort, t, this.sort[t + e]), this.sort[t + e] = r, this.formData(0);
  1147. },
  1148. makeIcon(t, e, r) {
  1149. if (this.$scopedSlots.button)
  1150. return this.$scopedSlots.button({
  1151. total: t,
  1152. index: e,
  1153. vm: this,
  1154. key: r,
  1155. del: () => this.del(e, r),
  1156. add: this.add
  1157. });
  1158. const i = [];
  1159. return (!this.max || t < this.max) && t === e + 1 && i.push(this.addIcon(r)), t > this.min && i.push(this.delIcon(e, r)), this.sortBtn && e && i.push(this.sortUpIcon(e)), this.sortBtn && e !== t - 1 && i.push(this.sortDownIcon(e)), i;
  1160. },
  1161. emitEvent(t, e, r, i) {
  1162. this.$emit(t, ...e, this.cacheRule[i].$f, r);
  1163. },
  1164. expandRule(t) {
  1165. for (let e = 0; e < t; e++)
  1166. this.value.push(this.field ? null : {});
  1167. }
  1168. },
  1169. created() {
  1170. this.type = this.formCreateInject.form.$form();
  1171. const t = (this.expand || 0) - this.value.length;
  1172. t > 0 && this.expandRule(t);
  1173. for (let e = 0; e < this.value.length; e++)
  1174. this.addRule(e);
  1175. },
  1176. render() {
  1177. const t = arguments[0], e = this.sort, r = this.button, i = this.type, s = this.disabled, n = e.length === 0 ? this.$scopedSlots.default ? this.$scopedSlots.default({
  1178. vm: this,
  1179. add: this.add
  1180. }) : t("div", {
  1181. key: "a_def",
  1182. class: "_fc-group-plus-minus _fc-group-add",
  1183. on: {
  1184. click: this.add
  1185. }
  1186. }) : e.map((o, a) => {
  1187. const {
  1188. rule: u,
  1189. options: l
  1190. } = this.cacheRule[o], c = r && !s ? this.makeIcon(e.length, a, o) : [];
  1191. return t("div", {
  1192. class: "_fc-group-container",
  1193. key: o
  1194. }, [t(i, F([{
  1195. key: o
  1196. }, {
  1197. on: {
  1198. "update:value": (m) => this.formData(o, m),
  1199. "emit-event": (m, ...v) => this.emitEvent(m, v, a, o),
  1200. input: (m) => this.add$f(a, o, m)
  1201. }
  1202. }, {}, {
  1203. props: {
  1204. disabled: s,
  1205. inFor: !0,
  1206. value: this.field ? {
  1207. [this.field]: this._value(this.value[a])
  1208. } : this.value[a],
  1209. rule: u,
  1210. option: l,
  1211. extendOption: !0
  1212. }
  1213. }])), t("div", {
  1214. class: "_fc-group-idx"
  1215. }, [a + 1]), c.length ? t("div", {
  1216. class: "_fc-group-handle"
  1217. }, [c]) : null]);
  1218. });
  1219. return t("div", {
  1220. key: "con",
  1221. class: "_fc-group " + (s ? "_fc-group-disabled" : "")
  1222. }, [n]);
  1223. }
  1224. }, Ut = "fcSubForm", Ht = {
  1225. name: Ut,
  1226. props: {
  1227. rule: Array,
  1228. options: Object,
  1229. formCreateInject: {
  1230. type: Object,
  1231. required: !0
  1232. },
  1233. value: {
  1234. type: Object,
  1235. default: () => ({})
  1236. },
  1237. disabled: {
  1238. type: Boolean,
  1239. default: !1
  1240. },
  1241. syncDisabled: {
  1242. type: Boolean,
  1243. default: !0
  1244. }
  1245. },
  1246. data() {
  1247. return {
  1248. cacheRule: {},
  1249. cacheValue: {},
  1250. type: void 0
  1251. };
  1252. },
  1253. watch: {
  1254. value(t) {
  1255. this.setValue(t);
  1256. }
  1257. },
  1258. methods: {
  1259. formData(t) {
  1260. this.cacheValue = JSON.stringify(t), this.$emit("input", t), this.$emit("change", t);
  1261. },
  1262. setValue(t) {
  1263. const e = JSON.stringify(t);
  1264. this.cacheValue !== e && (this.cacheValue = e, this.cacheRule.$f.coverValue(t || {}));
  1265. },
  1266. addRule() {
  1267. const t = this.options ? this.options : {
  1268. submitBtn: !1,
  1269. resetBtn: !1
  1270. };
  1271. t.formData = y({}, this.value || {}), this.cacheRule = {
  1272. rule: this.rule,
  1273. options: t
  1274. };
  1275. },
  1276. add$f(t) {
  1277. this.cacheRule.$f = t, this.$nextTick(() => {
  1278. this.$emit("itemMounted", t);
  1279. });
  1280. },
  1281. emitEvent(t, ...e) {
  1282. this.$emit(t, ...e);
  1283. }
  1284. },
  1285. created() {
  1286. this.addRule(), this.type = this.formCreateInject.form.$form();
  1287. },
  1288. render() {
  1289. const t = arguments[0], {
  1290. rule: e,
  1291. options: r
  1292. } = this.cacheRule, i = this.type;
  1293. return t(i, F([{}, {
  1294. on: {
  1295. "update:value": this.formData,
  1296. "emit-event": this.emitEvent,
  1297. input: this.add$f
  1298. }
  1299. }, {}, {
  1300. props: {
  1301. rule: e,
  1302. option: r,
  1303. disabled: this.disabled,
  1304. extendOption: !0
  1305. }
  1306. }]));
  1307. }
  1308. }, Jt = [
  1309. Et,
  1310. Rt,
  1311. It,
  1312. Vt,
  1313. Tt,
  1314. Lt,
  1315. qt,
  1316. Ht
  1317. ], je = "FormCreate", le = (t, e) => {
  1318. if (!(!t || t === e)) {
  1319. if (t.formCreateInject)
  1320. return t.formCreateInject;
  1321. if (t.$parent)
  1322. return le(t.$parent, e);
  1323. }
  1324. };
  1325. function xt(t, e, r) {
  1326. return {
  1327. name: je,
  1328. componentName: je,
  1329. model: {
  1330. prop: "api"
  1331. },
  1332. components: e,
  1333. directives: r,
  1334. provide() {
  1335. return {
  1336. $pfc: this
  1337. };
  1338. },
  1339. inject: { $pfc: { default: null } },
  1340. props: {
  1341. rule: {
  1342. type: Array,
  1343. required: !0
  1344. },
  1345. option: {
  1346. type: Object,
  1347. default: () => ({})
  1348. },
  1349. extendOption: Boolean,
  1350. disabled: {
  1351. type: Boolean,
  1352. default: void 0
  1353. },
  1354. value: Object,
  1355. api: Object,
  1356. name: String,
  1357. subForm: {
  1358. type: Boolean,
  1359. default: !0
  1360. },
  1361. inFor: Boolean
  1362. },
  1363. data() {
  1364. return {
  1365. formData: void 0,
  1366. destroyed: !1,
  1367. validate: {},
  1368. $f: void 0,
  1369. isShow: !0,
  1370. unique: 1,
  1371. renderRule: [...this.rule || []],
  1372. ctxInject: {},
  1373. updateValue: JSON.stringify(this.value || {}),
  1374. isMore: !!this.inFor
  1375. };
  1376. },
  1377. render() {
  1378. return this.formCreate.render();
  1379. },
  1380. methods: {
  1381. _refresh() {
  1382. ++this.unique;
  1383. },
  1384. _renderRule() {
  1385. this.renderRule = [...this.rule || []];
  1386. },
  1387. _updateValue(i) {
  1388. this.destroyed || (this.updateValue = JSON.stringify(i), this.$emit("update:value", i));
  1389. }
  1390. },
  1391. watch: {
  1392. value: {
  1393. handler(i) {
  1394. JSON.stringify(i || {}) !== this.updateValue && (this.$f.config.forceCoverValue ? this.$f.coverValue(i || {}) : this.$f.setValue(i || {}));
  1395. },
  1396. deep: !0
  1397. },
  1398. option: {
  1399. handler() {
  1400. this.formCreate.initOptions(), this.$f.refresh();
  1401. },
  1402. deep: !0
  1403. },
  1404. rule(i, s) {
  1405. i.length === this.renderRule.length && i.every((n) => this.renderRule.indexOf(n) > -1) || (this.formCreate.$handle.reloadRule(i), this._renderRule(), i !== s && this.formCreate.$handle.targetReload());
  1406. },
  1407. disabled() {
  1408. this.$f.refresh();
  1409. }
  1410. },
  1411. beforeCreate() {
  1412. this.formCreate = new t(this), Object.keys(this.formCreate.prop).forEach((i) => {
  1413. p(this.$options[i], this.formCreate.prop[i]);
  1414. }), this.$emit("beforeCreate", this.formCreate.api());
  1415. },
  1416. created() {
  1417. const i = this, s = this.formCreate.api(), n = () => {
  1418. if (i.$pfc) {
  1419. const a = le(i, i.$pfc);
  1420. if (a) {
  1421. let u;
  1422. i.isMore ? (u = j(a.getSubForm()), u.push(s)) : u = s, a.subForm(u);
  1423. }
  1424. }
  1425. }, o = () => {
  1426. const a = le(i, i.$pfc);
  1427. if (a)
  1428. if (i.isMore) {
  1429. const u = j(a.getSubForm()), l = u.indexOf(s);
  1430. l > -1 && u.splice(l, 1);
  1431. } else
  1432. a.subForm();
  1433. };
  1434. i.$on("hook:beforeDestroy", () => {
  1435. o();
  1436. }), this.$watch(() => this.subForm, (a) => {
  1437. a ? n() : o();
  1438. }, { immediate: !0 });
  1439. }
  1440. };
  1441. }
  1442. const Ke = ["attrs", "props", "domProps", "scopedSlots"], We = ["class", "style", "directives"], Ge = ["on", "nativeOn"], D = (t, e = {}, r = {}) => {
  1443. const i = [...Ke, ...r.normal || []], s = [...We, ...r.array || []], n = [...Ge, ...r.functional || []], o = r.props || [];
  1444. return t.reduce((a, u) => {
  1445. for (const l in u)
  1446. if (a[l])
  1447. if (o.indexOf(l) > -1)
  1448. a[l] = D([u[l]], a[l]);
  1449. else if (i.indexOf(l) > -1)
  1450. a[l] = y(y({}, a[l]), u[l]);
  1451. else if (s.indexOf(l) > -1) {
  1452. const c = a[l] instanceof Array ? a[l] : [a[l]], m = u[l] instanceof Array ? u[l] : [u[l]];
  1453. a[l] = [...c, ...m];
  1454. } else if (n.indexOf(l) > -1)
  1455. for (const c in u[l])
  1456. if (a[l][c]) {
  1457. const m = a[l][c] instanceof Array ? a[l][c] : [a[l][c]], v = u[l][c] instanceof Array ? u[l][c] : [u[l][c]];
  1458. a[l][c] = [...m, ...v];
  1459. } else
  1460. a[l][c] = u[l][c];
  1461. else if (l === "hook")
  1462. for (let c in u[l])
  1463. a[l][c] ? a[l][c] = Kt(a[l][c], u[l][c]) : a[l][c] = u[l][c];
  1464. else
  1465. a[l] = u[l];
  1466. else
  1467. i.indexOf(l) > -1 || n.indexOf(l) > -1 || o.indexOf(l) > -1 ? a[l] = y({}, u[l]) : s.indexOf(l) > -1 ? a[l] = u[l] instanceof Array ? [...u[l]] : typeof u[l] == "object" ? y({}, u[l]) : u[l] : a[l] = u[l];
  1468. return a;
  1469. }, e);
  1470. }, Kt = (t, e) => function() {
  1471. t && t.apply(this, arguments), e && e.apply(this, arguments);
  1472. }, Xe = ["type", "slot", "emitPrefix", "value", "name", "native", "hidden", "display", "inject", "options", "emit", "nativeEmit", "link", "prefix", "suffix", "update", "sync", "optionsTo", "key", "preview", "component", "cache"], pe = ["validate", "children", "control"], me = ["effect", "deep"];
  1473. function Wt() {
  1474. return [...Xe, ...Ke, ...We, ...Ge, ...pe, ...me];
  1475. }
  1476. function ye(t, e, r) {
  1477. return `[form-create ${t}]: ${e}`;
  1478. }
  1479. function Gt(t, e) {
  1480. console.warn(ye("tip", t));
  1481. }
  1482. function ge(t, e) {
  1483. console.error(ye("err", t));
  1484. }
  1485. function Xt(t) {
  1486. ge(t.toString()), console.error(t);
  1487. }
  1488. const ue = "[[FORM-CREATE-PREFIX-", fe = "-FORM-CREATE-SUFFIX]]";
  1489. function ze(t, e) {
  1490. return JSON.stringify(K(Array.isArray(t) ? [] : {}, t, !0), function(r, i) {
  1491. if (!(i && i._isVue === !0)) {
  1492. if (typeof i != "function")
  1493. return i;
  1494. if (i.__json)
  1495. return i.__json;
  1496. if (i.__origin && (i = i.__origin), !i.__emit)
  1497. return ue + i + fe;
  1498. }
  1499. }, e);
  1500. }
  1501. function te(t) {
  1502. return new Function("return " + t)();
  1503. }
  1504. function q(t, e) {
  1505. if (t && h.String(t) && t.length > 4) {
  1506. let r = t.trim(), i = !1;
  1507. try {
  1508. if (r.indexOf(fe) > 0 && r.indexOf(ue) === 0)
  1509. r = r.replace(fe, "").replace(ue, ""), i = !0;
  1510. else if (r.indexOf("$FN:") === 0)
  1511. r = r.substring(4), i = !0;
  1512. else if (r.indexOf("$EXEC:") === 0)
  1513. r = r.substring(6), i = !0;
  1514. else if (r.indexOf("$GLOBAL:") === 0) {
  1515. const n = r.substring(8);
  1516. return r = function(...o) {
  1517. const a = o[0].api.getGlobalEvent(n);
  1518. if (a)
  1519. return a.call(this, ...o);
  1520. }, r.__json = t, r.__inject = !0, r;
  1521. } else {
  1522. if (r.indexOf("$FNX:") === 0)
  1523. return r = te("function($inject){" + r.substring(5) + "}"), r.__json = t, r.__inject = !0, r;
  1524. (!e && r.indexOf("function ") === 0 && r !== "function " || !e && r.indexOf("function(") === 0 && r !== "function(") && (i = !0);
  1525. }
  1526. if (!i) return t;
  1527. let s;
  1528. try {
  1529. s = te(r);
  1530. } catch (n) {
  1531. s = te("function " + r);
  1532. }
  1533. return s.__json = t, s;
  1534. } catch (s) {
  1535. ge(`解析失败:${r}
  1536. err: ${s}`);
  1537. return;
  1538. }
  1539. }
  1540. return t;
  1541. }
  1542. function zt(t, e) {
  1543. return JSON.parse(t, function(r, i) {
  1544. return h.Undef(i) || !i.indexOf ? i : q(i, e);
  1545. });
  1546. }
  1547. function he(t, e) {
  1548. return {
  1549. value: t,
  1550. enumerable: !1,
  1551. configurable: !1,
  1552. writable: !!e
  1553. };
  1554. }
  1555. function $e(t) {
  1556. return Qe([t])[0];
  1557. }
  1558. function Qe(t, e) {
  1559. return K([], [...t], e || !1);
  1560. }
  1561. function U(t, e) {
  1562. return D(Array.isArray(e) ? e : [e], t, { array: pe, normal: me }), t;
  1563. }
  1564. function Ie(t) {
  1565. const e = h.Function(t.getRule) ? t.getRule() : t;
  1566. return e.type || (e.type = "input"), e;
  1567. }
  1568. function Qt(t, e) {
  1569. return t ? (Object.keys(e || {}).forEach((r) => {
  1570. e[r] && (t[r] = U(t[r] || {}, e[r]));
  1571. }), t) : e;
  1572. }
  1573. function Ze(t, e) {
  1574. Object.defineProperties(t, Object.keys(e).reduce((r, i) => (r[i] = {
  1575. get() {
  1576. return e[i]();
  1577. }
  1578. }, r), {}));
  1579. }
  1580. function z(t) {
  1581. return t.__fc__ || (t.__origin__ ? t.__origin__.__fc__ : null);
  1582. }
  1583. function R(t, e) {
  1584. try {
  1585. e = t();
  1586. } catch (r) {
  1587. Xt(r);
  1588. }
  1589. return e;
  1590. }
  1591. const Ae = (t, e) => typeof t == "string" ? String(e) : typeof t == "number" ? Number(e) : e, x = {
  1592. "==": (t, e) => JSON.stringify(t) === JSON.stringify(Ae(t, e)),
  1593. "!=": (t, e) => !x["=="](t, e),
  1594. ">": (t, e) => t > e,
  1595. ">=": (t, e) => t >= e,
  1596. "<": (t, e) => t < e,
  1597. "<=": (t, e) => t <= e,
  1598. on(t, e) {
  1599. return t && t.indexOf && t.indexOf(Ae(t[0], e)) > -1;
  1600. },
  1601. notOn(t, e) {
  1602. return !x.on(t, e);
  1603. },
  1604. in(t, e) {
  1605. return e && e.indexOf && e.indexOf(t) > -1;
  1606. },
  1607. notIn(t, e) {
  1608. return !x.in(t, e);
  1609. },
  1610. between(t, e) {
  1611. return t > e[0] && t < e[1];
  1612. },
  1613. notBetween(t, e) {
  1614. return t < e[0] || t > e[1];
  1615. },
  1616. empty(t) {
  1617. return h.empty(t);
  1618. },
  1619. notEmpty(t) {
  1620. return !h.empty(t);
  1621. },
  1622. pattern(t, e) {
  1623. return new RegExp(e, "g").test(t);
  1624. }
  1625. };
  1626. function Ye() {
  1627. return {
  1628. props: {},
  1629. on: {},
  1630. options: [],
  1631. children: [],
  1632. effect: {},
  1633. hidden: !1,
  1634. display: !0,
  1635. value: void 0
  1636. };
  1637. }
  1638. function E(t, e) {
  1639. return (r, i, s, n = {}) => {
  1640. const o = new ve(t, r, i, s, n);
  1641. return e && (h.Function(e) ? e(o) : o.props(e)), o;
  1642. };
  1643. }
  1644. function ve(t, e, r, i, s) {
  1645. this._data = p(Ye(), { type: t, title: e, field: r, value: i, props: s || {} }), this.event = this.on;
  1646. }
  1647. p(ve.prototype, {
  1648. getRule() {
  1649. return this._data;
  1650. },
  1651. setProp(t, e) {
  1652. return w(this._data, t, e), this;
  1653. },
  1654. _clone() {
  1655. const t = new this.constructor();
  1656. return t._data = $e(this._data), t;
  1657. }
  1658. });
  1659. function et(t) {
  1660. t.forEach((e) => {
  1661. ve.prototype[e] = function(r) {
  1662. return U(this._data, { [e]: arguments.length < 2 ? r : { [r]: arguments[1] } }), this;
  1663. };
  1664. });
  1665. }
  1666. et(Wt());
  1667. const tt = E("");
  1668. function Zt(t, e, r) {
  1669. let i = tt("", e);
  1670. return i._data.type = t, i._data.title = r, i;
  1671. }
  1672. function Ve(t, e, r, i) {
  1673. let s = tt("", r);
  1674. return s._data.type = "template", s._data.template = t, s._data.title = i, s._data.vm = e, s;
  1675. }
  1676. function Yt() {
  1677. return {
  1678. create: Zt,
  1679. createTmp: Ve,
  1680. template: Ve,
  1681. factory: E
  1682. };
  1683. }
  1684. function er(t, e, r) {
  1685. const i = `fail to ${t} ${r.status}'`, s = new Error(i);
  1686. return s.status = r.status, s.url = t, s;
  1687. }
  1688. function Pe(t) {
  1689. const e = t.responseText || t.response;
  1690. if (!e)
  1691. return e;
  1692. try {
  1693. return JSON.parse(e);
  1694. } catch (r) {
  1695. return e;
  1696. }
  1697. }
  1698. function rt(t) {
  1699. if (typeof XMLHttpRequest == "undefined")
  1700. return;
  1701. const e = new XMLHttpRequest(), r = t.action;
  1702. e.onerror = function(o) {
  1703. t.onError(o);
  1704. }, e.onload = function() {
  1705. if (e.status < 200 || e.status >= 300)
  1706. return t.onError(er(r, t, e), Pe(e));
  1707. t.onSuccess(Pe(e));
  1708. }, e.open(t.method || "get", r, !0);
  1709. let i;
  1710. t.data && ((t.dataType || "").toLowerCase() !== "json" ? (i = new FormData(), Object.keys(t.data).map((n) => {
  1711. i.append(n, t.data[n]);
  1712. })) : (i = JSON.stringify(t.data), e.setRequestHeader("content-type", "application/json"))), t.withCredentials && "withCredentials" in e && (e.withCredentials = !0);
  1713. const s = t.headers || {};
  1714. Object.keys(s).forEach((n) => {
  1715. s[n] !== null && e.setRequestHeader(n, s[n]);
  1716. }), e.send(i);
  1717. }
  1718. function tr(t) {
  1719. return new Promise((e, r) => {
  1720. rt(N(y({}, t), {
  1721. onSuccess(i) {
  1722. let s = (o) => o;
  1723. const n = q(t.parse);
  1724. h.Function(n) ? s = n : n && h.String(n) && (s = (o) => (n.split(".").forEach((a) => {
  1725. o && (o = o[a]);
  1726. }), o)), e(s(i));
  1727. },
  1728. onError(i) {
  1729. r(i);
  1730. }
  1731. }));
  1732. });
  1733. }
  1734. function X(t) {
  1735. return L(t);
  1736. }
  1737. function rr(t) {
  1738. function e(n) {
  1739. return h.Undef(n) ? n = t.fields() : Array.isArray(n) || (n = [n]), n;
  1740. }
  1741. function r(n, o, a) {
  1742. e(n).forEach((u) => {
  1743. t.getCtxs(u).forEach((l) => {
  1744. w(l.rule, o, a), t.$render.clearCache(l);
  1745. });
  1746. });
  1747. }
  1748. function i() {
  1749. const n = t.subForm;
  1750. return Object.keys(n).reduce((o, a) => {
  1751. const u = n[a];
  1752. return u && (Array.isArray(u) ? o.push(...u) : o.push(u)), o;
  1753. }, []);
  1754. }
  1755. const s = {
  1756. get config() {
  1757. return t.options;
  1758. },
  1759. get options() {
  1760. return t.options;
  1761. },
  1762. get form() {
  1763. return t.form;
  1764. },
  1765. get rule() {
  1766. return t.rules;
  1767. },
  1768. get parent() {
  1769. return t.vm.$pfc && t.vm.$pfc.$f;
  1770. },
  1771. get top() {
  1772. return s.parent ? s.parent.top : s;
  1773. },
  1774. get children() {
  1775. return i();
  1776. },
  1777. formData(n) {
  1778. return e(n).reduce((o, a) => {
  1779. const u = t.getFieldCtx(a);
  1780. return u && (o[u.field] = X(u.rule.value)), o;
  1781. }, t.options.appendValue !== !1 ? X(t.appendData) : {});
  1782. },
  1783. getValue(n) {
  1784. const o = t.getFieldCtx(n);
  1785. if (o)
  1786. return X(o.rule.value);
  1787. },
  1788. coverValue(n) {
  1789. const o = y({}, n || {});
  1790. t.deferSyncValue(() => {
  1791. s.fields().forEach((a) => {
  1792. const u = t.fieldCtx[a];
  1793. if (u) {
  1794. const l = k(o, a);
  1795. u.forEach((c) => {
  1796. c.rule.value = l ? o[a] : void 0;
  1797. }), delete o[a];
  1798. }
  1799. }), p(t.appendData, o);
  1800. });
  1801. },
  1802. setValue(n) {
  1803. let o = n;
  1804. arguments.length >= 2 && (o = { [n]: arguments[1] }), t.deferSyncValue(() => {
  1805. Object.keys(o).forEach((a) => {
  1806. const u = t.fieldCtx[a];
  1807. if (!u) return t.appendData[a] = o[a];
  1808. u.forEach((l) => {
  1809. l.rule.value = o[a];
  1810. });
  1811. });
  1812. });
  1813. },
  1814. removeField(n) {
  1815. const o = t.getCtx(n);
  1816. return t.deferSyncValue(() => {
  1817. t.getCtxs(n).forEach((a) => {
  1818. a.rm();
  1819. });
  1820. }, !0), o ? o.origin : void 0;
  1821. },
  1822. removeRule(n) {
  1823. const o = n && z(n);
  1824. if (o)
  1825. return o.rm(), o.origin;
  1826. },
  1827. destroy: () => {
  1828. t.vm.$el.parentNode && t.vm.$el.parentNode.removeChild(t.vm.$el), t.vm.$destroy();
  1829. },
  1830. fields: () => t.fields(),
  1831. append: (n, o, a) => {
  1832. let u = t.sort.length - 1, l;
  1833. const c = t.getCtx(o);
  1834. c ? a ? (l = c.rule.children, u = c.rule.children.length - 1) : (u = c.root.indexOf(c.origin), l = c.root) : l = t.rules, l.splice(u + 1, 0, n);
  1835. },
  1836. prepend: (n, o, a) => {
  1837. let u = 0, l;
  1838. const c = t.getCtx(o);
  1839. c ? a ? l = c.rule.children : (u = c.root.indexOf(c.origin), l = c.root) : l = t.rules, l.splice(u, 0, n);
  1840. },
  1841. hidden(n, o) {
  1842. r(o, "hidden", !!n), t.refresh();
  1843. },
  1844. hiddenStatus(n) {
  1845. const o = t.getCtx(n);
  1846. if (o)
  1847. return !!o.rule.hidden;
  1848. },
  1849. display(n, o) {
  1850. r(o, "display", !!n), t.refresh();
  1851. },
  1852. displayStatus(n) {
  1853. const o = t.getCtx(n);
  1854. if (o)
  1855. return !!o.rule.display;
  1856. },
  1857. disabled(n, o) {
  1858. e(o).forEach((a) => {
  1859. t.getCtxs(a).forEach((u) => {
  1860. u.rule.props && w(u.rule.props, "disabled", !!n);
  1861. });
  1862. }), t.refresh();
  1863. },
  1864. all(n) {
  1865. return Object.keys(t.ctxs).map((o) => {
  1866. const a = t.ctxs[o];
  1867. return n ? a.origin : a.rule;
  1868. });
  1869. },
  1870. model(n) {
  1871. return t.fields().reduce((o, a) => {
  1872. const u = t.fieldCtx[a][0];
  1873. return o[a] = n ? u.origin : u.rule, o;
  1874. }, {});
  1875. },
  1876. component(n) {
  1877. return Object.keys(t.nameCtx).reduce((o, a) => {
  1878. const u = t.nameCtx[a].map((l) => n ? l.origin : l.rule);
  1879. return o[a] = u.length === 1 ? u[0] : u, o;
  1880. }, {});
  1881. },
  1882. bind() {
  1883. return s.form;
  1884. },
  1885. reload: (n) => {
  1886. t.reloadRule(n);
  1887. },
  1888. updateOptions(n) {
  1889. t.fc.updateOptions(n), s.refresh();
  1890. },
  1891. onSubmit(n) {
  1892. s.updateOptions({ onSubmit: n });
  1893. },
  1894. sync: (n) => {
  1895. if (Array.isArray(n)) {
  1896. n.forEach((a) => s.sync(a));
  1897. return;
  1898. }
  1899. let o = h.Object(n) ? z(n) : t.getCtxs(n);
  1900. o && (o = Array.isArray(o) ? o : [o], o.forEach((a) => {
  1901. if (!a.deleted) {
  1902. const u = t.subForm[a.id];
  1903. u && (Array.isArray(u) ? u.forEach((l) => {
  1904. l.refresh();
  1905. }) : u && u.refresh()), t.$render.clearCache(a);
  1906. }
  1907. }), t.refresh());
  1908. },
  1909. refresh: () => {
  1910. i().forEach((n) => {
  1911. n.refresh();
  1912. }), t.$render.clearCacheAll(), t.refresh();
  1913. },
  1914. refreshOptions() {
  1915. t.$manager.updateOptions(t.options), s.refresh();
  1916. },
  1917. hideForm: (n) => {
  1918. w(t.vm, "isShow", !n);
  1919. },
  1920. changeStatus: () => t.changeStatus,
  1921. clearChangeStatus: () => {
  1922. t.changeStatus = !1;
  1923. },
  1924. updateRule(n, o) {
  1925. t.getCtxs(n).forEach((a) => {
  1926. p(a.rule, o);
  1927. });
  1928. },
  1929. updateRules(n) {
  1930. Object.keys(n).forEach((o) => {
  1931. s.updateRule(o, n[o]);
  1932. });
  1933. },
  1934. mergeRule: (n, o) => {
  1935. t.getCtxs(n).forEach((a) => {
  1936. U(a.rule, o);
  1937. });
  1938. },
  1939. mergeRules(n) {
  1940. Object.keys(n).forEach((o) => {
  1941. s.mergeRule(o, n[o]);
  1942. });
  1943. },
  1944. getRule: (n, o) => {
  1945. const a = t.getCtx(n);
  1946. if (a)
  1947. return o ? a.origin : a.rule;
  1948. },
  1949. getRenderRule: (n) => {
  1950. const o = t.getCtx(n);
  1951. if (o)
  1952. return o.prop;
  1953. },
  1954. getRefRule: (n) => {
  1955. const o = t.getCtxs(n);
  1956. if (o && o.length) {
  1957. const a = o.map((u) => u.rule);
  1958. return a.length === 1 ? a[0] : a;
  1959. }
  1960. },
  1961. setEffect(n, o, a) {
  1962. const u = t.getCtx(n);
  1963. u && o && (o[0] === "$" && (o = o.substr(1)), k(u.rule, "$" + o) && w(u.rule, "$" + o, a), k(u.rule, "effect") || w(u.rule, "effect", {}), w(u.rule.effect, o, a));
  1964. },
  1965. clearEffectData(n, o) {
  1966. const a = t.getCtx(n);
  1967. a && (o && o[0] === "$" && (o = o.substr(1)), a.clearEffectData(o), s.sync(n));
  1968. },
  1969. updateValidate(n, o, a) {
  1970. a ? s.mergeRule(n, { validate: o }) : r(n, "validate", o);
  1971. },
  1972. updateValidates(n, o) {
  1973. Object.keys(n).forEach((a) => {
  1974. s.updateValidate(a, n[a], o);
  1975. });
  1976. },
  1977. refreshValidate() {
  1978. t.vm.validate = {}, s.refresh();
  1979. },
  1980. resetFields(n) {
  1981. e(n).forEach((o) => {
  1982. t.getCtxs(o).forEach((a) => {
  1983. t.$render.clearCache(a), a.rule.value = X(a.defaultValue);
  1984. });
  1985. }), t.vm.$nextTick(() => {
  1986. s.clearValidateState();
  1987. }), n == null && (h.Function(t.options.onReset) && R(() => t.options.onReset(s)), t.vm.$emit("reset", s));
  1988. },
  1989. method(n, o) {
  1990. const a = s.el(n);
  1991. if (!a || !a[o])
  1992. throw new Error(ye("err", `${o}方法不存在`));
  1993. return (...u) => a[o](...u);
  1994. },
  1995. exec(n, o, ...a) {
  1996. return R(() => s.method(n, o)(...a));
  1997. },
  1998. toJson(n) {
  1999. return ze(s.rule, n);
  2000. },
  2001. trigger(n, o, ...a) {
  2002. const u = s.el(n);
  2003. u && u.$emit(o, ...a);
  2004. },
  2005. el(n) {
  2006. const o = t.getCtx(n);
  2007. if (o) return o.exportEl || o.el || t.vm.$refs[o.ref];
  2008. },
  2009. closeModal: (n) => {
  2010. const o = s.el(n);
  2011. o && o.$emit && o.$emit("close-modal");
  2012. },
  2013. getSubForm(n) {
  2014. const o = t.getCtx(n);
  2015. return o ? t.subForm[o.id] : void 0;
  2016. },
  2017. nextTick(n) {
  2018. t.bus.$once("next-tick", n), t.refresh();
  2019. },
  2020. nextRefresh(n) {
  2021. t.nextRefresh(), n && R(n);
  2022. },
  2023. emit(n, ...o) {
  2024. t.vm.$emit(n, ...o);
  2025. },
  2026. deferSyncValue(n, o) {
  2027. t.deferSyncValue(n, o);
  2028. },
  2029. fetch(n) {
  2030. return new Promise((o, a) => {
  2031. t.beforeFetch(n).then(() => tr(n).then(o).catch(a));
  2032. });
  2033. },
  2034. getData(n, o) {
  2035. return t.fc.getData(n, o);
  2036. },
  2037. setData(n, o) {
  2038. return t.fc.setData(n, o);
  2039. },
  2040. helper: {
  2041. tidyFields: e,
  2042. props: r
  2043. }
  2044. };
  2045. return ["on", "once", "off", "set", "emit"].forEach((n) => {
  2046. s[n] = function(...o) {
  2047. t.vm[`$${n}`](...o);
  2048. };
  2049. }), s.changeValue = s.changeField = s.setValue, s;
  2050. }
  2051. function ir(t) {
  2052. p(t.prototype, {
  2053. initCache() {
  2054. this.clearCacheAll();
  2055. },
  2056. clearCache(e) {
  2057. if (e.rule.cache)
  2058. return;
  2059. if (!this.cache[e.id]) {
  2060. e.parent && this.clearCache(e.parent);
  2061. return;
  2062. }
  2063. (this.cache[e.id].use === !0 || this.cache[e.id].parent) && this.$handle.refresh();
  2064. const r = this.cache[e.id].parent;
  2065. this.cache[e.id] = null, r && this.clearCache(r);
  2066. },
  2067. clearCacheAll() {
  2068. this.cache = {};
  2069. },
  2070. setCache(e, r, i) {
  2071. this.cache[e.id] = {
  2072. vnode: r,
  2073. use: !1,
  2074. parent: i,
  2075. slot: e.rule.slot
  2076. };
  2077. },
  2078. getCache(e) {
  2079. const r = this.cache[e.id];
  2080. if (r)
  2081. return r.use = !0, r.vnode;
  2082. }
  2083. });
  2084. }
  2085. function I(t) {
  2086. const e = t.replace(/(-[a-z])/g, function(r) {
  2087. return r.replace("-", "").toLocaleUpperCase();
  2088. });
  2089. return it(e);
  2090. }
  2091. function it(t) {
  2092. return t.replace(t[0], t[0].toLowerCase());
  2093. }
  2094. function nt(t) {
  2095. return t == null ? "" : typeof t == "object" ? JSON.stringify(t, null, 2) : String(t);
  2096. }
  2097. function Q(t) {
  2098. let e = t.replace(/([A-Z])/g, "-$1").toLocaleLowerCase();
  2099. return e.indexOf("-") === 0 && (e = e.substr(1)), e;
  2100. }
  2101. let nr = 0;
  2102. function ee() {
  2103. const t = 370 + ++nr;
  2104. return "F" + Math.random().toString(36).substr(3, 3) + (+`${Date.now()}`).toString(36) + t.toString(36) + "c";
  2105. }
  2106. function Z(t, e, r) {
  2107. let i = t, s;
  2108. return (e || "").split(".").forEach((n) => {
  2109. s && ((!i[s] || typeof i[s] != "object") && (i[s] = {}), i = i[s]), s = n;
  2110. }), i[s] = r, i;
  2111. }
  2112. function sr(t) {
  2113. p(t.prototype, {
  2114. initRender() {
  2115. this.tempList = {}, this.clearOrgChildren();
  2116. },
  2117. initOrgChildren() {
  2118. const e = this.$handle.ctxs;
  2119. this.orgChildren = Object.keys(e).reduce((r, i) => {
  2120. if (e[i].parser.loadChildren !== !1) {
  2121. const s = e[i].rule.children;
  2122. r[i] = h.trueArray(s) ? [...s] : [];
  2123. }
  2124. return r;
  2125. }, {});
  2126. },
  2127. clearOrgChildren() {
  2128. this.orgChildren = {};
  2129. },
  2130. getTypeSlot(e) {
  2131. const r = (i) => {
  2132. if (i) {
  2133. let s;
  2134. return e.rule.field && (s = i.$scopedSlots["field-" + Q(e.rule.field)] || i.$scopedSlots["field-" + e.rule.field]), s || (s = i.$scopedSlots["type-" + Q(e.type)] || i.$scopedSlots["type-" + e.type]), s || r(i.$pfc);
  2135. }
  2136. };
  2137. return r(this.vm);
  2138. },
  2139. render() {
  2140. if (!this.vm.isShow)
  2141. return;
  2142. this.$h = this.vm.$createElement, this.$manager.beforeRender();
  2143. let e;
  2144. const r = () => this.renderList();
  2145. return r.renderSlot = (i) => this.renderList(i), r.renderName = (i) => this.renderId(i), r.renderField = (i) => this.renderId(i, "field"), this.vm.$scopedSlots.container ? e = [this.vm.$scopedSlots.container(r)] : e = r(), this.$manager.render(e);
  2146. },
  2147. renderList(e) {
  2148. return this.sort.map((r) => e ? this.renderSlot(this.$handle.ctxs[r], e) : this.renderCtx(this.$handle.ctxs[r])).filter((r) => r !== void 0);
  2149. },
  2150. makeVm(e) {
  2151. const r = e.vm;
  2152. if (r) {
  2153. if (h.Function(r))
  2154. return R(() => e.vm(this.$handle.getInjectData(e)));
  2155. if (!r._isVue)
  2156. return new T(r);
  2157. } else return new T();
  2158. return r;
  2159. },
  2160. mergeGlobal(e) {
  2161. const r = this.$handle.options.global;
  2162. r && (e.cacheConfig || (e.cacheConfig = r[e.originType] || r[e.type] || r[e.trueType] || {}), e.prop = U({}, [r["*"], e.cacheConfig, e.prop]));
  2163. },
  2164. setOptions(e) {
  2165. e.prop.optionsTo && e.prop.options && Z(e.prop, e.prop.optionsTo, e.prop.options);
  2166. },
  2167. deepSet(e) {
  2168. const r = e.rule.deep;
  2169. r && Object.keys(r).sort((i, s) => i.length < s.length ? -1 : 1).forEach((i) => {
  2170. Z(e.prop, i, r[i]);
  2171. });
  2172. },
  2173. setTempProps(e, r) {
  2174. if (!e.$props) return;
  2175. const { prop: i } = r, s = Object.keys(e.$props), n = this.injectProp(r), o = Object.keys(n);
  2176. s.forEach((u) => {
  2177. k(i.props, u) ? e.$props[u] = i.props[u] : o.indexOf(u) > -1 && (e.$props[u] = n[u]);
  2178. });
  2179. const a = e.$options.model && e.$options.model.prop || "value";
  2180. s.indexOf(a) > -1 && (e.$props[a] = i.value);
  2181. },
  2182. renderTemp(e) {
  2183. if (!T.compile)
  2184. return Gt("当前使用的Vue构建版本不支持compile,无法使用template功能"), [];
  2185. const r = e.prop, { id: i, key: s } = e;
  2186. if (!this.tempList[i]) {
  2187. e.el || (e.el = this.makeVm(r), this.vm.$nextTick(() => e.parser.mounted(e)));
  2188. let u = e.el;
  2189. e.input && u.$on(u.$options.model && u.$options.model.event || "input", (l) => {
  2190. this.onInput(e, l);
  2191. }), this.tempList[i] = {
  2192. vm: u,
  2193. template: T.compile(r.template)
  2194. };
  2195. }
  2196. const { vm: n, template: o } = this.tempList[i];
  2197. this.setTempProps(n, e);
  2198. const a = o.render.call(n);
  2199. return h.Undef(a.data) && (a.data = {}), a.key = s, a.data.ref = e.ref, a.data.key = s, a;
  2200. },
  2201. parseSide(e, r) {
  2202. return h.Object(e) ? U({ props: { formCreateInject: r.prop.props.formCreateInject } }, e) : e;
  2203. },
  2204. renderSides(e, r, i) {
  2205. const s = r[i ? "rule" : "prop"];
  2206. return [this.renderRule(this.parseSide(s.prefix, r)), e, this.renderRule(this.parseSide(s.suffix, r))];
  2207. },
  2208. renderSlot(e, r) {
  2209. return e.rule.slot === r ? this.renderCtx(e) : void 0;
  2210. },
  2211. renderId(e, r) {
  2212. const i = this.$handle[r === "field" ? "fieldCtx" : "nameCtx"][e];
  2213. return i ? i.map((s) => this.renderCtx(s, s.parent)) : void 0;
  2214. },
  2215. renderCtx(e, r) {
  2216. if (e.type === "hidden") return;
  2217. const i = e.rule;
  2218. if (!this.cache[e.id] || this.cache[e.id].slot !== i.slot) {
  2219. let s, n = i.cache !== !1;
  2220. const o = e.trueType, a = !(h.Undef(i.display) || i.display);
  2221. if (o === "template" && !i.template)
  2222. s = this.renderSides(this.renderChildren(e), e, !0), a && this.display(s), s = this.item(e, s);
  2223. else if (o === "fcFragment")
  2224. s = this.renderChildren(e);
  2225. else {
  2226. e.initProp(), this.mergeGlobal(e), this.$manager.tidyRule(e), this.deepSet(e), this.setOptions(e), this.ctxProp(e);
  2227. let u = e.prop;
  2228. u.preview = !!(k(u, "preview") ? u.preview : this.options.preview), u.props.formCreateInject = this.injectProp(e);
  2229. const l = u.preview;
  2230. if (u.hidden) {
  2231. this.setCache(e, void 0, r);
  2232. return;
  2233. }
  2234. if (o === "template" && u.template)
  2235. s = this.renderTemp(e), n = !1;
  2236. else {
  2237. let c = [];
  2238. e.parser.renderChildren ? c = e.parser.renderChildren(e) : e.parser.loadChildren !== !1 && (c = this.renderChildren(e));
  2239. const m = this.getTypeSlot(e);
  2240. m ? s = m({
  2241. rule: i,
  2242. prop: u,
  2243. preview: l,
  2244. children: c,
  2245. api: this.$handle.api,
  2246. model: u.model || {}
  2247. }) : s = l ? e.parser.preview(c, e) : e.parser.render(c, e);
  2248. }
  2249. s = this.renderSides(s, e), !(!e.input && h.Undef(u.native)) && u.native !== !0 && (s = this.$manager.makeWrap(e, s)), a && (s = this.display(s)), s = this.item(e, s);
  2250. }
  2251. return n && this.setCache(e, s, r), s;
  2252. }
  2253. return this.getCache(e);
  2254. },
  2255. display(e) {
  2256. if (Array.isArray(e)) {
  2257. const r = [];
  2258. return e.forEach((i) => {
  2259. if (Array.isArray(i)) return this.display(i);
  2260. this.none(i) && r.push(i);
  2261. }), r;
  2262. } else
  2263. return this.none(e);
  2264. },
  2265. none(e) {
  2266. if (e && e.data)
  2267. return Array.isArray(e.data.style) ? e.data.style.push({ display: "none" }) : h.String(e.data.style) ? e.data.style += ";display:none;" : e.data.style = [e.data.style, { display: "none" }], e;
  2268. },
  2269. item(e, r) {
  2270. return this.$h("fcFragment", {
  2271. slot: e.rule.slot,
  2272. key: e.key
  2273. }, [r]);
  2274. },
  2275. injectProp(e) {
  2276. this.vm.ctxInject[e.id] || w(this.vm.ctxInject, e.id, {
  2277. api: this.$handle.api,
  2278. form: this.fc.create,
  2279. subForm: (i) => {
  2280. this.$handle.addSubForm(e, i);
  2281. },
  2282. getSubForm: () => this.$handle.subForm[e.id],
  2283. options: [],
  2284. children: [],
  2285. prop: {},
  2286. preview: !1,
  2287. id: e.id,
  2288. field: e.field,
  2289. rule: e.rule,
  2290. input: e.input
  2291. });
  2292. const r = this.vm.ctxInject[e.id];
  2293. return p(r, {
  2294. preview: e.prop.preview,
  2295. options: e.prop.options,
  2296. children: e.rule.children,
  2297. prop: function() {
  2298. const i = y({}, e.prop);
  2299. return i.on = i.on ? y({}, i.on) : {}, delete i.model, i;
  2300. }()
  2301. }), r;
  2302. },
  2303. ctxProp(e) {
  2304. const { ref: r, key: i, rule: s } = e;
  2305. this.$manager.mergeProp(e), e.parser.mergeProp(e);
  2306. const n = [
  2307. {
  2308. ref: r,
  2309. key: s.key || `${i}fc`,
  2310. slot: void 0,
  2311. on: {
  2312. "hook:mounted": () => {
  2313. this.onMounted(e);
  2314. },
  2315. "fc.sub-form": (o) => {
  2316. this.$handle.addSubForm(e, o);
  2317. },
  2318. "fc.el": (o) => {
  2319. e.exportEl = o, o && ((o.$el || o).__rule__ = e.rule);
  2320. }
  2321. }
  2322. }
  2323. ];
  2324. return e.input && (this.vm.$props.disabled === !0 && (e.prop.props.disabled = !0), e.prop.model = {
  2325. value: this.$handle.getFormData(e),
  2326. callback: (o) => {
  2327. this.onInput(e, o);
  2328. },
  2329. expression: `formData.${e.id}`
  2330. }), D(n, e.prop), e.prop;
  2331. },
  2332. onMounted(e) {
  2333. e.el = this.vm.$refs[e.ref], e.el && ((e.el.$el || e.el).__rule__ = e.rule), e.parser.mounted(e), this.$handle.effect(e, "mounted");
  2334. },
  2335. onInput(e, r) {
  2336. this.$handle.onInput(e, r);
  2337. },
  2338. renderChildren(e) {
  2339. const { children: r } = e.rule, i = this.orgChildren[e.id], s = (n) => !h.String(n) && n.__fc__ && !this.$handle.ctxs[n.__fc__.id];
  2340. return !h.trueArray(r) && i ? (this.$handle.deferSyncValue(() => {
  2341. i.forEach((n) => {
  2342. n && s(n) && this.$handle.rmCtx(n.__fc__);
  2343. });
  2344. }), this.orgChildren[e.id] = [], []) : (i && this.$handle.deferSyncValue(() => {
  2345. i.forEach((n) => {
  2346. n && r.indexOf(n) === -1 && s(n) && this.$handle.rmCtx(n.__fc__);
  2347. });
  2348. }), r.map((n) => {
  2349. if (n) {
  2350. if (h.String(n)) return n;
  2351. if (n.__fc__)
  2352. return this.renderCtx(n.__fc__, e);
  2353. n.type && this.vm.$nextTick(() => {
  2354. this.$handle.loadChildren(r, e), this.$handle.refresh();
  2355. });
  2356. }
  2357. }));
  2358. },
  2359. defaultRender(e, r) {
  2360. const i = e.prop;
  2361. return i.component ? this.vNode.makeComponent(i.component, i, r) : this.vNode[e.type] ? this.vNode[e.type](i, r) : this.vNode[e.originType] ? this.vNode[e.originType](i, r) : this.vNode.make(it(e.originType), i, r);
  2362. },
  2363. renderRule(e, r, i) {
  2364. if (!e) return;
  2365. if (h.String(e)) return e;
  2366. let s;
  2367. if (i)
  2368. s = e.type;
  2369. else if (s = e.is, e.type) {
  2370. s = I(e.type);
  2371. const o = this.vNode.aliasMap[s];
  2372. o && (s = I(o));
  2373. }
  2374. if (!s) return;
  2375. let n = [[r]];
  2376. return h.trueArray(e.children) && n.push(e.children.map((o) => this.renderRule(o))), this.$h(s, y({}, e), n);
  2377. }
  2378. });
  2379. }
  2380. function be(t) {
  2381. p(this, {
  2382. $handle: t,
  2383. fc: t.fc,
  2384. vm: t.vm,
  2385. $manager: t.$manager,
  2386. vNode: new t.fc.CreateNode(t.vm)
  2387. }), Ze(this, {
  2388. options() {
  2389. return t.options;
  2390. },
  2391. sort() {
  2392. return t.sort;
  2393. }
  2394. }), this.initCache(), this.initRender();
  2395. }
  2396. ir(be);
  2397. sr(be);
  2398. function or(t) {
  2399. p(t.prototype, {
  2400. parseInjectEvent(e, r) {
  2401. const i = e.inject || this.options.injectEvent;
  2402. return this.parseEventLst(e, r, i);
  2403. },
  2404. parseEventLst(e, r, i, s) {
  2405. return Object.keys(r).forEach((n) => {
  2406. const o = this.parseEvent(e, r[n], i, s);
  2407. o && (r[n] = o);
  2408. }), r;
  2409. },
  2410. parseEvent(e, r, i, s) {
  2411. if (h.Function(r) && (i !== !1 && !h.Undef(i) || r.__inject))
  2412. return this.inject(e, r, i);
  2413. if (!s && Array.isArray(r) && r[0] && (h.String(r[0]) || h.Function(r[0])))
  2414. return this.parseEventLst(e, r, i, !0);
  2415. if (h.String(r)) {
  2416. const n = q(r);
  2417. if (n && r !== n)
  2418. return n.__inject ? this.parseEvent(e, n, i, !0) : n;
  2419. }
  2420. },
  2421. parseEmit(e, r) {
  2422. let i = {}, s = e.rule, { emitPrefix: n, field: o, name: a, inject: u } = s, l = s[r ? "emit" : "nativeEmit"] || [];
  2423. return h.trueArray(l) && l.forEach((c) => {
  2424. if (!c) return;
  2425. let m, v = n || o || a;
  2426. if (h.Object(c) && (m = c.inject, c = c.name, v = c.prefix || v), v) {
  2427. r || (v = `native-${v}`);
  2428. const _ = Q(`${v}-${c}`), g = (...O) => {
  2429. this.vm.$emit(_, ...O), this.vm.$emit("emit-event", _, ...O);
  2430. };
  2431. if (g.__emit = !0, !m && u === !1)
  2432. i[c] = g;
  2433. else {
  2434. let O = m || u || this.options.injectEvent;
  2435. i[c] = h.Undef(O) ? g : this.inject(s, g, O);
  2436. }
  2437. }
  2438. }), e.computed[r ? "on" : "nativeOn"] = i, i;
  2439. },
  2440. getInjectData(e, r) {
  2441. const { option: i, rule: s } = this.vm.$options.propsData;
  2442. return {
  2443. api: this.api,
  2444. $f: this.api,
  2445. rule: s,
  2446. self: e.__origin__,
  2447. option: i,
  2448. inject: r
  2449. };
  2450. },
  2451. inject(e, r, i) {
  2452. if (r.__origin) {
  2453. if (this.watching && !this.loading)
  2454. return r;
  2455. r = r.__origin;
  2456. }
  2457. const s = this, n = function(...o) {
  2458. const a = s.getInjectData(e, i);
  2459. return a.args = [...o], o.unshift(a), r.apply(this, o);
  2460. };
  2461. return n.__origin = r, n.__json = r.__json, n;
  2462. }
  2463. });
  2464. }
  2465. const Te = ["hook:updated", "hook:mounted"];
  2466. function ar(t) {
  2467. p(t.prototype, {
  2468. usePage() {
  2469. const e = this.options.page;
  2470. if (!e) return;
  2471. let r = 25, i = lr(this.rules);
  2472. h.Object(e) && (e.first && (r = parseInt(e.first, 10) || r), e.limit && (i = parseInt(e.limit, 10) || i)), p(this, {
  2473. first: r,
  2474. limit: i,
  2475. pageEnd: this.rules.length <= r
  2476. }), this.bus.$on("page-end", () => this.vm.$emit("page-end", this.api)), this.pageLoad();
  2477. },
  2478. pageLoad() {
  2479. const e = () => {
  2480. this.pageEnd ? (this.vm.$off(Te, e), this.bus.$emit("page-end")) : (this.first += this.limit, this.pageEnd = this.rules.length <= this.first, this.loadRule(), this.refresh());
  2481. };
  2482. this.vm.$on(Te, e);
  2483. }
  2484. });
  2485. }
  2486. function lr(t) {
  2487. return t.length < 31 ? 31 : Math.ceil(t.length / 3);
  2488. }
  2489. function ur(t) {
  2490. p(t.prototype, {
  2491. clearNextTick() {
  2492. this.nextTick && clearTimeout(this.nextTick), this.nextTick = null;
  2493. },
  2494. bindNextTick(e) {
  2495. this.clearNextTick(), this.nextTick = setTimeout(() => {
  2496. e(), this.nextTick = null;
  2497. }, 10);
  2498. },
  2499. render() {
  2500. return ++this.loadedId, this.vm.unique > 0 ? this.$render.render() : (this.vm.unique = 1, []);
  2501. }
  2502. });
  2503. }
  2504. function fr(t) {
  2505. Object.defineProperties(t.origin, {
  2506. __fc__: he(t, !0)
  2507. }), t.rule !== t.origin && Object.defineProperties(t.rule, {
  2508. __fc__: he(t, !0)
  2509. });
  2510. }
  2511. function st(t, e, r) {
  2512. const i = ee();
  2513. p(this, {
  2514. id: i,
  2515. ref: i,
  2516. wrapRef: i + "fi",
  2517. rule: e,
  2518. origin: e.__origin__ || e,
  2519. name: e.name,
  2520. watch: [],
  2521. linkOn: [],
  2522. root: [],
  2523. ctrlRule: [],
  2524. parent: null,
  2525. cacheConfig: null,
  2526. prop: y({}, e),
  2527. computed: {},
  2528. payload: {},
  2529. input: !!e.field,
  2530. el: void 0,
  2531. exportEl: void 0,
  2532. defaultValue: e.field ? L(r) : void 0,
  2533. field: e.field || void 0
  2534. }), this.updateKey(), fr(this), this.update(t, !0);
  2535. }
  2536. p(st.prototype, {
  2537. effectData(t) {
  2538. return this.payload[t] || (this.payload[t] = {}), this.payload[t];
  2539. },
  2540. clearEffectData(t) {
  2541. t === void 0 ? this.payload = {} : delete this.payload[t];
  2542. },
  2543. updateKey(t) {
  2544. this.key = ee(), t && this.parent && this.parent.updateKey(t);
  2545. },
  2546. updateType() {
  2547. this.originType = this.rule.type, this.type = I(this.rule.type), this.trueType = this.$handle.getType(this.originType);
  2548. },
  2549. setParser(t) {
  2550. this.parser = t, t.init(this);
  2551. },
  2552. initProp() {
  2553. const t = y({}, this.rule);
  2554. delete t.children, this.prop = U({}, [t, ...Object.keys(this.payload).map((e) => this.payload[e]), this.computed]);
  2555. },
  2556. injectValidate() {
  2557. return j(this.prop.validate).map((t) => {
  2558. if (h.Function(t.validator)) {
  2559. const e = y({}, t), r = this;
  2560. return e.validator = function(...i) {
  2561. return t.validator.call({
  2562. that: this,
  2563. id: r.id,
  2564. field: r.field,
  2565. rule: r.rule,
  2566. api: r.$handle.api
  2567. }, ...i);
  2568. }, e;
  2569. }
  2570. return t;
  2571. });
  2572. },
  2573. check(t) {
  2574. return this.vm === t.vm;
  2575. },
  2576. unwatch() {
  2577. this.watch.forEach((t) => t()), this.watch = [];
  2578. },
  2579. unlink() {
  2580. this.linkOn.forEach((t) => t()), this.linkOn = [];
  2581. },
  2582. link() {
  2583. this.unlink(), this.$handle.appendLink(this);
  2584. },
  2585. watchTo() {
  2586. this.$handle.watchCtx(this);
  2587. },
  2588. delete() {
  2589. this.unwatch(), this.unlink(), this.rmCtrl(), p(this, {
  2590. deleted: !0,
  2591. prop: y({}, this.rule),
  2592. computed: {},
  2593. el: void 0,
  2594. $handle: void 0,
  2595. $render: void 0,
  2596. $api: void 0,
  2597. vm: void 0,
  2598. vNode: void 0,
  2599. parent: null,
  2600. cacheConfig: null
  2601. });
  2602. },
  2603. rmCtrl() {
  2604. this.ctrlRule.forEach((t) => t.__fc__ && t.__fc__.rm()), this.ctrlRule = [];
  2605. },
  2606. rm() {
  2607. const t = () => {
  2608. let e = this.root.indexOf(this.origin);
  2609. e > -1 && (this.root.splice(e, 1), this.$handle && this.$handle.refresh());
  2610. };
  2611. if (this.deleted) {
  2612. t();
  2613. return;
  2614. }
  2615. this.$handle.noWatch(() => {
  2616. this.$handle.deferSyncValue(() => {
  2617. this.rmCtrl(), t(), this.$handle.rmCtx(this), p(this, {
  2618. root: []
  2619. });
  2620. }, this.input);
  2621. });
  2622. },
  2623. update(t, e) {
  2624. p(this, {
  2625. deleted: !1,
  2626. $handle: t,
  2627. $render: t.$render,
  2628. $api: t.api,
  2629. vm: t.vm,
  2630. vNode: t.$render.vNode,
  2631. updated: !1,
  2632. cacheValue: this.rule.value
  2633. }), !e && this.unwatch(), this.watchTo(), this.link(), this.updateType();
  2634. }
  2635. });
  2636. function hr(t) {
  2637. p(t.prototype, {
  2638. nextRefresh(e) {
  2639. const r = this.loadedId;
  2640. this.vm.$nextTick(() => {
  2641. r === this.loadedId && (e ? e() : this.refresh());
  2642. });
  2643. },
  2644. parseRule(e) {
  2645. const r = Ie(e);
  2646. return Object.defineProperties(r, {
  2647. __origin__: he(e, !0)
  2648. }), cr(r), this.appendValue(r), r.options = Array.isArray(r.options) ? r.options : [], [r, r.prefix, r.suffix].forEach((i) => {
  2649. i && this.loadFn(i, r);
  2650. }), this.loadCtrl(r), r.update && (r.update = q(r.update)), r;
  2651. },
  2652. loadFn(e, r) {
  2653. ["on", "props", "nativeOn", "deep"].forEach((i) => {
  2654. e[i] && this.parseInjectEvent(r, e[i]);
  2655. });
  2656. },
  2657. loadCtrl(e) {
  2658. e.control && e.control.forEach((r) => {
  2659. r.handle && (r.handle = q(r.handle));
  2660. });
  2661. },
  2662. syncProp(e) {
  2663. const r = e.rule;
  2664. h.trueArray(r.sync) && D([{
  2665. on: r.sync.reduce((i, s) => (i[`update:${s}`] = (n) => {
  2666. r.props[s] = n, this.vm.$emit("sync", s, n, r, this.fapi);
  2667. }, i), {})
  2668. }], e.computed);
  2669. },
  2670. loadRule() {
  2671. this.cycleLoad = !1, this.loading = !0, this.pageEnd && this.bus.$emit("load-start"), this.deferSyncValue(() => {
  2672. if (this._loadRule(this.rules), this.loading = !1, this.cycleLoad && this.pageEnd)
  2673. return this.loadRule();
  2674. this.pageEnd && this.bus.$emit("load-end"), this.vm._renderRule(), this.$render.initOrgChildren(), this.syncForm();
  2675. });
  2676. },
  2677. loadChildren(e, r) {
  2678. if (this.cycleLoad = !1, this.loading = !0, this.bus.$emit("load-start"), this._loadRule(e, r), this.loading = !1, this.cycleLoad)
  2679. return this.loadRule();
  2680. this.bus.$emit("load-end"), this.syncForm(), this.$render.clearCache(r);
  2681. },
  2682. _loadRule(e, r) {
  2683. const i = (n) => {
  2684. let o = e[n - 1];
  2685. if (!o || !o.__fc__)
  2686. return n > 0 ? i(n - 1) : -1;
  2687. let a = this.sort.indexOf(o.__fc__.id);
  2688. return a > -1 ? a : i(n - 1);
  2689. }, s = (n, o) => {
  2690. h.trueArray(n) && this._loadRule(n, o);
  2691. };
  2692. e.map((n, o) => {
  2693. if (r && !h.Object(n) || !this.pageEnd && !r && o >= this.first) return;
  2694. if (n.__fc__ && n.__fc__.root === e && this.ctxs[n.__fc__.id])
  2695. return s(n.__fc__.rule.children, n.__fc__), n.__fc__;
  2696. let a = Ie(n);
  2697. const u = () => !!(a.field && this.fieldCtx[a.field] && this.fieldCtx[a.field][0] !== n.__fc__);
  2698. this.ruleEffect(a, "init", { repeat: u() }), u() && this.vm.$emit("repeat-field", n, this.api);
  2699. let l, c = !1, m = !!n.__fc__, v = a.value;
  2700. if (m) {
  2701. l = n.__fc__, v = l.defaultValue;
  2702. const g = !l.check(this);
  2703. if (l.deleted) {
  2704. if (g) {
  2705. if (De(l))
  2706. return;
  2707. l.update(this);
  2708. }
  2709. } else if (g) {
  2710. if (De(l))
  2711. return;
  2712. e[o] = n = n._clone ? n._clone() : $e(n), l = null, c = !0;
  2713. }
  2714. }
  2715. if (l)
  2716. l.originType !== l.rule.type && l.updateType(), this.bindParser(l), this.appendValue(l.rule);
  2717. else {
  2718. const g = this.parseRule(n);
  2719. l = new st(this, g, v), this.bindParser(l);
  2720. }
  2721. if ([!1, !0].forEach((g) => this.parseEmit(l, g)), this.syncProp(l), l.parent = r || null, l.root = e, this.setCtx(l), !c && !m && this.effect(l, "load"), this.effect(l, "created"), l.parser.loadChildren === !1 || s(l.rule.children, l), !r) {
  2722. const g = i(o);
  2723. g > -1 || !o ? this.sort.splice(g + 1, 0, l.id) : this.sort.push(l.id);
  2724. }
  2725. const _ = l.rule;
  2726. return l.updated || (l.updated = !0, h.Function(_.update) && this.bus.$once("load-end", () => {
  2727. this.refreshUpdate(l, _.value, "init");
  2728. }), this.effect(l, "loaded")), l.input && Object.defineProperty(_, "value", this.valueHandle(l)), this.refreshControl(l) && (this.cycleLoad = !0), l;
  2729. });
  2730. },
  2731. refreshControl(e) {
  2732. return e.input && e.rule.control && this.useCtrl(e);
  2733. },
  2734. useCtrl(e) {
  2735. const r = dr(e), i = [], s = this.api;
  2736. if (!r.length) return !1;
  2737. for (let a = 0; a < r.length; a++) {
  2738. const u = r[a], l = u.handle || function(m) {
  2739. return (x[u.condition || "=="] || x["=="])(m, u.value);
  2740. };
  2741. if (!h.trueArray(u.rule)) continue;
  2742. const c = N(y({}, u), {
  2743. valid: R(() => l(e.rule.value, s)),
  2744. ctrl: pr(e, u.rule),
  2745. isHidden: h.String(u.rule[0])
  2746. });
  2747. c.valid && c.ctrl || !c.valid && !c.ctrl && !c.isHidden || i.push(c);
  2748. }
  2749. if (!i.length) return !1;
  2750. const n = [];
  2751. let o = !1;
  2752. return this.deferSyncValue(() => {
  2753. i.reverse().forEach(({ isHidden: a, valid: u, rule: l, prepend: c, append: m, child: v, ctrl: _, method: g }) => {
  2754. if (a) {
  2755. u ? e.ctrlRule.push({
  2756. __ctrl: !0,
  2757. children: l,
  2758. valid: u
  2759. }) : _ && e.ctrlRule.splice(e.ctrlRule.indexOf(_) >>> 0, 1), n[u ? "push" : "unshift"](() => {
  2760. g === "disabled" || g === "enabled" ? this.api.disabled(!u, l) : g === "display" ? this.api.display(u, l) : g === "required" ? (l.forEach((O) => {
  2761. this.api.setEffect(O, "required", u);
  2762. }), u || this.api.clearValidateState(l)) : this.api.hidden(!u, l);
  2763. });
  2764. return;
  2765. }
  2766. if (u) {
  2767. o = !0;
  2768. const O = {
  2769. type: "fcFragment",
  2770. native: !0,
  2771. __ctrl: !0,
  2772. children: l
  2773. };
  2774. e.ctrlRule.push(O), this.bus.$once("load-start", () => {
  2775. c ? s.prepend(O, c, v) : m || v ? s.append(O, m || e.id, v) : e.root.splice(e.root.indexOf(e.origin) + 1, 0, O);
  2776. });
  2777. } else {
  2778. e.ctrlRule.splice(e.ctrlRule.indexOf(_), 1);
  2779. const O = z(_);
  2780. O && O.rm();
  2781. }
  2782. });
  2783. }), n.length && this.vm.$nextTick(() => {
  2784. n.forEach((a) => a());
  2785. }), this.vm.$emit("control", e.origin, this.api), this.effect(e, "control"), o;
  2786. },
  2787. reloadRule(e) {
  2788. return this._reloadRule(e);
  2789. },
  2790. _reloadRule(e) {
  2791. e || (e = this.rules);
  2792. const r = y({}, this.ctxs);
  2793. this.clearNextTick(), this.$render.clearOrgChildren(), this.initData(e), this.fc.rules = e, this.deferSyncValue(() => {
  2794. this.bus.$once("load-end", () => {
  2795. Object.keys(r).filter((i) => this.ctxs[i] === void 0).forEach((i) => this.rmCtx(r[i])), this.$render.clearCacheAll();
  2796. }), this.reloading = !0, this.loadRule(), this.reloading = !1, this.refresh(), this.vm.$emit("reloading", this.api);
  2797. }), this.vm.$emit("update", this.api);
  2798. },
  2799. //todo 组件生成全部通过 alias
  2800. refresh() {
  2801. this.vm._refresh();
  2802. }
  2803. });
  2804. }
  2805. function cr(t) {
  2806. const e = Ye();
  2807. return Object.keys(e).forEach((r) => {
  2808. k(t, r) || w(t, r, e[r]);
  2809. }), t;
  2810. }
  2811. function dr(t) {
  2812. const e = t.rule.control || [];
  2813. return h.Object(e) ? [e] : e;
  2814. }
  2815. function pr(t, e) {
  2816. for (let r = 0; r < t.ctrlRule.length; r++) {
  2817. const i = t.ctrlRule[r];
  2818. if (i.children === e)
  2819. return i;
  2820. }
  2821. }
  2822. function De(t) {
  2823. return !!t.rule.__ctrl;
  2824. }
  2825. function mr(t) {
  2826. p(t.prototype, {
  2827. getValue(e) {
  2828. return h.Undef(e.cacheValue) && (e.cacheValue = e.parser.toValue(this.getFormData(e), e)), e.cacheValue;
  2829. },
  2830. setValue(e, r, i, s) {
  2831. e.deleted || (e.cacheValue = r, this.changeStatus = !0, this.nextRefresh(), this.$render.clearCache(e), this.setFormData(e, i), this.syncValue(), this.valueChange(e, r), this.vm.$emit("change", e.field, r, e.origin, this.api, s || !1), this.effect(e, "value"), this.emitEvent("change", e.field, r, {
  2832. rule: e.origin,
  2833. api: this.api,
  2834. setFlag: s || !1
  2835. }));
  2836. },
  2837. onInput(e, r) {
  2838. let i;
  2839. e.input && (this.isQuote(e, i = e.parser.toValue(r, e)) || this.isChange(e, i)) && this.setValue(e, i, r);
  2840. },
  2841. setFormData(e, r) {
  2842. w(this.formData, e.id, r === null ? void 0 : r);
  2843. },
  2844. getFormData(e) {
  2845. return this.formData[e.id];
  2846. },
  2847. validate() {
  2848. return Le(this.vm.validate), this.fields().forEach((e) => {
  2849. this.fieldCtx[e].forEach((r) => {
  2850. this.vm.validate[r.id] = j(r.rule.validate);
  2851. });
  2852. }), this.vm.validate;
  2853. },
  2854. syncForm() {
  2855. Le(this.form), Object.defineProperties(this.form, this.fields().reduce((e, r) => {
  2856. const i = this.getFieldCtx(r), s = this.valueHandle(i);
  2857. return s.configurable = !0, e[r] = s, e;
  2858. }, this.options.appendValue !== !1 ? Object.keys(this.appendData).reduce((e, r) => (e[r] = {
  2859. enumerable: !0,
  2860. configurable: !0,
  2861. get: () => this.appendData[r],
  2862. set: (i) => {
  2863. this.appendData[r] = i;
  2864. }
  2865. }, e), {}) : {})), this.syncValue();
  2866. },
  2867. valueHandle(e) {
  2868. return {
  2869. enumerable: !0,
  2870. get: () => this.getValue(e),
  2871. set: (r) => {
  2872. this.isChange(e, r) && this.setValue(e, r, e.parser.toFormValue(r, e), !0);
  2873. }
  2874. };
  2875. },
  2876. appendValue(e) {
  2877. !e.field || !k(this.appendData, e.field) || (e.value = this.appendData[e.field], delete this.appendData[e.field]);
  2878. },
  2879. addSubForm(e, r) {
  2880. this.subForm[e.id] = r;
  2881. },
  2882. deferSyncValue(e, r) {
  2883. this.deferSyncFn || (this.deferSyncFn = e), this.deferSyncFn.sync || (this.deferSyncFn.sync = r), R(e), this.deferSyncFn === e && (this.deferSyncFn = null, e.sync && this.syncValue());
  2884. },
  2885. syncValue() {
  2886. if (this.deferSyncFn)
  2887. return this.deferSyncFn.sync = !0;
  2888. this.vm._updateValue(y(y({}, this.options.appendValue !== !1 ? this.appendData : {}), this.form));
  2889. },
  2890. isChange(e, r) {
  2891. return JSON.stringify(e.rule.value, Be) !== JSON.stringify(r === null ? void 0 : r, Be);
  2892. },
  2893. isQuote(e, r) {
  2894. return (h.Object(r) || Array.isArray(r)) && r === e.rule.value;
  2895. },
  2896. refreshUpdate(e, r, i, s) {
  2897. if (h.Function(e.rule.update)) {
  2898. const n = R(() => e.rule.update(r, e.origin, this.api, {
  2899. origin: i || "change",
  2900. linkField: s
  2901. }));
  2902. if (n === void 0) return;
  2903. e.rule.hidden = n === !0;
  2904. }
  2905. },
  2906. valueChange(e, r) {
  2907. this.refreshRule(e, r), this.bus.$emit("change-" + e.field, r);
  2908. },
  2909. refreshRule(e, r, i, s) {
  2910. this.refreshControl(e) && (this.$render.clearCacheAll(), this.loadRule(), this.vm.$emit("update", this.api), this.refresh()), this.refreshUpdate(e, r, i, s);
  2911. },
  2912. appendLink(e) {
  2913. const r = e.rule.link;
  2914. h.trueArray(r) && r.forEach((i) => {
  2915. const s = () => this.refreshRule(e, e.rule.value, "link", i);
  2916. this.bus.$on("change-" + i, s), e.linkOn.push(() => this.bus.$off("change-" + i, s));
  2917. });
  2918. },
  2919. fields() {
  2920. return Object.keys(this.fieldCtx);
  2921. }
  2922. });
  2923. }
  2924. function Be(t, e) {
  2925. return typeof e == "function" ? "" + e : e;
  2926. }
  2927. function Le(t) {
  2928. Object.keys(t).forEach((e) => delete t[e]);
  2929. }
  2930. const ce = {
  2931. init(t) {
  2932. },
  2933. toFormValue(t, e) {
  2934. return t;
  2935. },
  2936. toValue(t, e) {
  2937. return t;
  2938. },
  2939. mounted(t) {
  2940. },
  2941. render(t, e) {
  2942. return e.$render.defaultRender(e, t);
  2943. },
  2944. preview(t, e) {
  2945. return this.render(t, e);
  2946. },
  2947. mergeProp(t) {
  2948. }
  2949. }, yr = ["field", "value", "vm", "template", "name", "config", "control", "inject", "sync", "payload", "optionsTo", "update", "component", "cache"];
  2950. function gr(t) {
  2951. p(t.prototype, {
  2952. getCtx(e) {
  2953. return this.getFieldCtx(e) || this.getNameCtx(e)[0] || this.ctxs[e];
  2954. },
  2955. getCtxs(e) {
  2956. return this.fieldCtx[e] || this.nameCtx[e] || (this.ctxs[e] ? [this.ctxs[e]] : []);
  2957. },
  2958. setIdCtx(e, r, i) {
  2959. const s = `${i}Ctx`;
  2960. this[s][r] ? this[s][r].push(e) : this[s][r] = [e];
  2961. },
  2962. rmIdCtx(e, r, i) {
  2963. const s = `${i}Ctx`, n = this[s][r];
  2964. if (!n) return !1;
  2965. const o = n.splice(n.indexOf(e) >>> 0, 1).length > 0;
  2966. return n.length || delete this[s][r], o;
  2967. },
  2968. getFieldCtx(e) {
  2969. return (this.fieldCtx[e] || [])[0];
  2970. },
  2971. getNameCtx(e) {
  2972. return this.nameCtx[e] || [];
  2973. },
  2974. setCtx(e) {
  2975. let { id: r, field: i, name: s, rule: n } = e;
  2976. this.ctxs[r] = e, s && this.setIdCtx(e, s, "name"), e.input && (this.setIdCtx(e, i, "field"), this.setFormData(e, e.parser.toFormValue(n.value, e)), this.isMounted && !this.reloading && this.vm.$emit("change", e.field, n.value, e.origin, this.api));
  2977. },
  2978. getParser(e) {
  2979. const r = this.fc.parsers;
  2980. return r[e.originType] || r[I(e.type)] || r[e.trueType] || ce;
  2981. },
  2982. bindParser(e) {
  2983. e.setParser(this.getParser(e));
  2984. },
  2985. getType(e) {
  2986. const r = this.fc.CreateNode.aliasMap, i = r[e] || r[I(e)] || e;
  2987. return I(i);
  2988. },
  2989. noWatch(e) {
  2990. this.noWatchFn || (this.noWatchFn = e), R(e), this.noWatchFn === e && (this.noWatchFn = null);
  2991. },
  2992. watchCtx(e) {
  2993. const r = this.vm;
  2994. Object.keys(e.rule).filter((i) => i[0] !== "_" && i[0] !== "$" && yr.indexOf(i) === -1).forEach((i) => {
  2995. const s = i === "children";
  2996. e.watch.push(r.$watch(() => e.rule[i], (n, o) => {
  2997. if (!(this.loading || this.noWatchFn || this.reloading)) {
  2998. if (s && e.parser.loadChildren === !1) {
  2999. this.$render.clearCache(e), this.nextRefresh();
  3000. return;
  3001. }
  3002. if (this.watching = !0, i === "link") {
  3003. e.link();
  3004. return;
  3005. } else if (["props", "on", "nativeOn", "deep"].indexOf(i) > -1)
  3006. this.parseInjectEvent(e.rule, n || {}), i === "props" && e.input && this.setFormData(e, e.parser.toFormValue(e.rule.value, e));
  3007. else if (["emit", "nativeEmit"].indexOf(i) > -1)
  3008. this.parseEmit(e, i === "emit");
  3009. else if (["prefix", "suffix"].indexOf(i) > -1)
  3010. n && this.loadFn(n, e.rule);
  3011. else if (i === "type")
  3012. e.updateType(), this.bindParser(e);
  3013. else if (i === "children") {
  3014. const a = h.trueArray(n);
  3015. this.deferSyncValue(() => {
  3016. n !== o && (this.rmSub(o, e), this.$render.initOrgChildren()), a && this.loadChildren(n, e), this.vm.$emit("update", this.api);
  3017. });
  3018. }
  3019. this.$render.clearCache(e), this.refresh(), this.watching = !1;
  3020. }
  3021. }, { deep: !s, sync: s }));
  3022. }), this.watchEffect(e);
  3023. },
  3024. rmSub(e, r) {
  3025. h.trueArray(e) && e.forEach((i) => {
  3026. i && i.__fc__ && i.__fc__.parent === r && this.rmCtx(i.__fc__);
  3027. });
  3028. },
  3029. rmCtx(e) {
  3030. if (e.deleted) return;
  3031. const { id: r, field: i, input: s, name: n } = e;
  3032. e.input && Object.defineProperty(e.rule, "value", {
  3033. value: e.rule.value,
  3034. writable: !0
  3035. }), B(this.ctxs, r), B(this.$render.tempList, r), B(this.$render.orgChildren, r), B(this.vm.ctxInject, r), B(this.formData, r), B(this.subForm, r), B(e, "cacheValue"), s && this.rmIdCtx(e, i, "field"), n && this.rmIdCtx(e, n, "name"), s && !k(this.fieldCtx, i) && B(this.form, i), this.deferSyncValue(() => {
  3036. this.reloading || (e.parser.loadChildren !== !1 && h.trueArray(e.rule.children) && e.rule.children.forEach((a) => a.__fc__ && this.rmCtx(a.__fc__)), e.root === this.rules && this.vm._renderRule());
  3037. }, s);
  3038. const o = this.sort.indexOf(r);
  3039. return o > -1 && this.sort.splice(o, 1), this.$render.clearCache(e), e.delete(), this.effect(e, "deleted"), s && !this.fieldCtx[i] && this.vm.$emit("removeField", i, e.rule, this.api), e.rule.__ctrl || this.vm.$emit("removeRule", e.rule, this.api), e;
  3040. }
  3041. });
  3042. }
  3043. function $r(t) {
  3044. p(t.prototype, {
  3045. mounted() {
  3046. const e = () => {
  3047. this.isMounted = !0, this.lifecycle("mounted");
  3048. };
  3049. this.pageEnd ? e() : this.bus.$once("page-end", e);
  3050. },
  3051. lifecycle(e) {
  3052. this.vm.$emit(e, this.api), this.emitEvent(e, this.api);
  3053. },
  3054. targetReload() {
  3055. this.bus.$off("next-tick", this.nextReload), this.bus.$once("next-tick", this.nextReload);
  3056. },
  3057. emitEvent(e, ...r) {
  3058. const i = this.options[e] || this.options[I("on-" + e)];
  3059. if (i) {
  3060. const s = q(i);
  3061. h.Function(s) && R(() => s(...r));
  3062. }
  3063. this.bus.$emit(e, ...r);
  3064. }
  3065. });
  3066. }
  3067. function vr(t) {
  3068. p(t.prototype, {
  3069. useProvider() {
  3070. const e = this.fc.providers;
  3071. Object.keys(e).forEach((r) => {
  3072. let i = e[r];
  3073. h.Function(i) && (i = i(this.fc)), i._c = Cr(i), this.onEffect(i), this.providers[r] = i;
  3074. });
  3075. },
  3076. onEffect(e) {
  3077. const r = [];
  3078. (e._c || ["*"]).forEach((i) => {
  3079. const s = i === "*" ? "*" : this.getType(i);
  3080. r.indexOf(s) > -1 || (r.push(s), this.bus.$on(`p:${e.name}:${s}:${e.input ? 1 : 0}`, (n, o) => {
  3081. e[n] && e[n](...o);
  3082. }));
  3083. }), e._used = r;
  3084. },
  3085. watchEffect(e) {
  3086. const r = this.vm;
  3087. let i = {
  3088. required: () => {
  3089. var s, n;
  3090. return (k(e.rule, "$required") ? e.rule.$required : (n = (s = e.rule) == null ? void 0 : s.effect) == null ? void 0 : n.required) || !1;
  3091. }
  3092. };
  3093. Object.keys(e.rule.effect || {}).forEach((s) => {
  3094. i[s] = () => e.rule.effect[s];
  3095. }), Object.keys(e.rule).forEach((s) => {
  3096. s[0] === "$" && (i[s.substr(1)] = () => e.rule[s]);
  3097. }), Object.keys(i || {}).forEach((s) => {
  3098. e.watch.push(r.$watch(i[s], (n) => {
  3099. this.effect(e, "watch", { [s]: n });
  3100. }, { deep: !0 }));
  3101. });
  3102. },
  3103. ruleEffect(e, r, i) {
  3104. this.emitEffect({
  3105. rule: e,
  3106. input: !!e.field,
  3107. type: this.getType(e.type)
  3108. }, r, i);
  3109. },
  3110. effect(e, r, i) {
  3111. this.emitEffect({
  3112. rule: e.rule,
  3113. input: e.input,
  3114. type: e.trueType,
  3115. ctx: e,
  3116. custom: i
  3117. }, r);
  3118. },
  3119. getEffect(e, r) {
  3120. if (k(e, "$" + r))
  3121. return e["$" + r];
  3122. if (k(e, "effect") && k(e.effect, r))
  3123. return e.effect[r];
  3124. },
  3125. emitEffect({ ctx: e, rule: r, input: i, type: s, custom: n }, o, a) {
  3126. if (!s || s === "fcFragment") return;
  3127. const u = n || Object.keys(r).reduce((l, c) => (c[0] === "$" && (l[c.substr(1)] = r[c]), l), y({}, r.effect || {}));
  3128. Object.keys(u).forEach((l) => {
  3129. const c = this.providers[l];
  3130. if (!c || c.input && !i) return;
  3131. let m;
  3132. if (!c._c)
  3133. m = "*";
  3134. else if (c._used.indexOf(s) > -1)
  3135. m = s;
  3136. else
  3137. return;
  3138. const v = y({ value: u[l], getValue: () => this.getEffect(r, l) }, a || {});
  3139. e && (v.getProp = () => e.effectData(l), v.clearProp = () => e.clearEffectData(l), v.mergeProp = (_) => U(v.getProp(), [_]), v.id = e.id), this.bus.$emit(`p:${l}:${m}:${c.input ? 1 : 0}`, o, [v, r, this.api]);
  3140. });
  3141. }
  3142. });
  3143. }
  3144. function br(t) {
  3145. return t.filter(function(e, r, i) {
  3146. return i.indexOf(e, 0) === r;
  3147. });
  3148. }
  3149. function Cr(t) {
  3150. const e = t.components;
  3151. if (Array.isArray(e)) {
  3152. const r = br(e.filter((i) => i !== "*"));
  3153. return r.length ? r : !1;
  3154. } else return h.String(e) ? [e] : !1;
  3155. }
  3156. function V(t) {
  3157. p(this, {
  3158. fc: t,
  3159. vm: t.vm,
  3160. watching: !1,
  3161. loading: !1,
  3162. reloading: !1,
  3163. noWatchFn: null,
  3164. deferSyncFn: null,
  3165. isMounted: !1,
  3166. formData: {},
  3167. subForm: {},
  3168. form: {},
  3169. appendData: {},
  3170. providers: {},
  3171. cycleLoad: null,
  3172. loadedId: 1,
  3173. nextTick: null,
  3174. changeStatus: !1,
  3175. pageEnd: !0,
  3176. nextReload: () => {
  3177. this.lifecycle("reload");
  3178. }
  3179. }), Ze(this, {
  3180. options() {
  3181. return t.options;
  3182. },
  3183. bus() {
  3184. return t.bus;
  3185. }
  3186. }), this.initData(t.rules), this.$manager = new t.manager(this), this.$render = new be(this), this.api = t.extendApi(rr(this), this);
  3187. }
  3188. p(V.prototype, {
  3189. initData(t) {
  3190. p(this, {
  3191. ctxs: {},
  3192. fieldCtx: {},
  3193. nameCtx: {},
  3194. sort: [],
  3195. rules: t
  3196. });
  3197. },
  3198. init() {
  3199. this.appendData = y(y(y({}, this.fc.options.formData || {}), this.vm.value || {}), this.appendData), this.useProvider(), this.usePage(), this.loadRule(), this.$manager.__init(), this.lifecycle("created"), this.vm.$set(this.vm, "formData", this.formData);
  3200. },
  3201. beforeFetch(t) {
  3202. return new Promise((e) => {
  3203. const r = this.options.beforeFetch && R(() => this.options.beforeFetch(t, { api: this.api }));
  3204. r && h.Function(r.then) ? r.then(e) : e();
  3205. });
  3206. }
  3207. });
  3208. or(V);
  3209. ar(V);
  3210. ur(V);
  3211. hr(V);
  3212. mr(V);
  3213. gr(V);
  3214. $r(V);
  3215. vr(V);
  3216. const _r = "fcFragment", re = {
  3217. name: _r,
  3218. functional: !0,
  3219. props: ["vnode"],
  3220. render(t, e) {
  3221. return e.props.vnode ? e.props.vnode : e.children;
  3222. }
  3223. };
  3224. function Or(t) {
  3225. return h.String(t) ? { domProps: { innerHTML: t } } : t;
  3226. }
  3227. function kr() {
  3228. const t = {};
  3229. function e(r) {
  3230. r && this.setVm(r);
  3231. }
  3232. return p(e.prototype, {
  3233. setVm(r) {
  3234. this.vm = r, this.$h = r.$createElement;
  3235. },
  3236. make(r, i, s) {
  3237. return T.config.isReservedTag(r) && i.nativeOn && delete i.nativeOn, this.makeComponent(r, i, s);
  3238. },
  3239. makeComponent(r, i, s) {
  3240. let n = this.$h(r, Or(i), s || []);
  3241. return n.context = this.vm, n;
  3242. },
  3243. aliasMap: t
  3244. }), p(e, {
  3245. aliasMap: t,
  3246. alias(r, i) {
  3247. t[r] = i;
  3248. },
  3249. use(r) {
  3250. Object.keys(r).forEach((i) => {
  3251. const s = Q(i), n = nt(i).toLocaleLowerCase(), o = r[i];
  3252. [i, s, n].forEach((a) => {
  3253. e.alias(i, o), e.prototype[a] = function(u, l) {
  3254. return this.make(o, u, l);
  3255. };
  3256. });
  3257. });
  3258. }
  3259. }), e;
  3260. }
  3261. function wr(t) {
  3262. class e extends ot {
  3263. }
  3264. return Object.assign(e.prototype, t), e;
  3265. }
  3266. function ot(t) {
  3267. p(this, {
  3268. $handle: t,
  3269. vm: t.vm,
  3270. options: {},
  3271. ref: "fcForm",
  3272. mergeOptionsRule: {
  3273. normal: ["form", "row", "info", "submitBtn", "resetBtn"]
  3274. }
  3275. }), this.updateKey(), this.init();
  3276. }
  3277. p(ot.prototype, {
  3278. __init() {
  3279. this.$render = this.$handle.$render, this.$r = (...t) => this.$render.renderRule(...t);
  3280. },
  3281. updateKey() {
  3282. this.key = ee();
  3283. },
  3284. //TODO interface
  3285. init() {
  3286. },
  3287. update() {
  3288. },
  3289. beforeRender() {
  3290. },
  3291. form() {
  3292. return this.vm.$refs[this.ref];
  3293. },
  3294. getSlot(t) {
  3295. const e = (r) => {
  3296. if (r) {
  3297. let i = r.$scopedSlots[t];
  3298. return i || e(r.$pfc);
  3299. }
  3300. };
  3301. return e(this.vm);
  3302. },
  3303. mergeOptions(t, e) {
  3304. return D(t.map((r) => this.tidyOptions(r)), e, this.mergeOptionsRule);
  3305. },
  3306. updateOptions(t) {
  3307. this.options = this.mergeOptions([t], this.getDefaultOptions()), this.update();
  3308. },
  3309. tidyOptions(t) {
  3310. return t;
  3311. },
  3312. tidyRule(t) {
  3313. },
  3314. mergeProp(t) {
  3315. },
  3316. getDefaultOptions() {
  3317. return {};
  3318. },
  3319. render(t) {
  3320. }
  3321. });
  3322. const Fr = function(t) {
  3323. const e = {
  3324. name: "loadData",
  3325. _fn: [],
  3326. created(r, i, s) {
  3327. this.deleted(r);
  3328. let n = j(r.getValue());
  3329. const o = [];
  3330. n.forEach((a) => {
  3331. if (a) {
  3332. const u = () => {
  3333. a.watch !== !1 && (t.bus.$off("p.loadData." + a.attr, u), t.bus.$once("p.loadData." + a.attr, u));
  3334. let l;
  3335. a.attr && (l = t.loadData[a.attr] || a.default, a.copy !== !1 && (l = L(l))), Z(r.getProp(), a.to || "options", l), s.sync(i);
  3336. };
  3337. o.push(() => t.bus.$off("p.loadData." + a.attr, u)), u();
  3338. }
  3339. }), this._fn[r.id] = o;
  3340. },
  3341. deleted(r) {
  3342. this._fn[r.id] && (this._fn[r.id].forEach((i) => {
  3343. i();
  3344. }), delete this._fn[r.id]), r.clearProp();
  3345. }
  3346. };
  3347. return e.watch = e.created, e;
  3348. }, at = {
  3349. name: "componentValidate",
  3350. load(t, e, r) {
  3351. const i = t.getValue();
  3352. i ? t.getProp().validate = [{
  3353. validator(...s) {
  3354. const n = z(e);
  3355. if (n)
  3356. return r.exec(n.id, i === !0 ? "formCreateValidate" : i, ...s, {
  3357. attr: t,
  3358. rule: e,
  3359. api: r
  3360. });
  3361. }
  3362. }] : (t.clearProp(), r.clearValidateState([e.field]));
  3363. },
  3364. watch(...t) {
  3365. at.load(...t);
  3366. }
  3367. }, Er = function(t) {
  3368. function e(i) {
  3369. return h.String(i) && (i = {
  3370. action: i,
  3371. to: "options"
  3372. }), i;
  3373. }
  3374. function r(i, s, n) {
  3375. let o = i.value;
  3376. const a = (m) => {
  3377. m === void 0 ? (i.clearProp(), n.sync(s)) : Z(i.getProp(), o.to || "options", m);
  3378. };
  3379. if (h.Function(o) && (o = o(s, n)), o = e(o), !o || !o.action) {
  3380. a(void 0);
  3381. return;
  3382. }
  3383. o = L(o), o.to || (o.to = "options");
  3384. const u = o.onError, l = () => {
  3385. if (!i.getValue())
  3386. return i.clearProp(), n.sync(s), !0;
  3387. }, c = N(y({
  3388. headers: {}
  3389. }, o), {
  3390. onSuccess(m, v) {
  3391. if (l()) return;
  3392. let _ = (g) => v ? g : k(g, "data") ? g.data : g;
  3393. h.Function(o.parse) ? _ = o.parse : o.parse && h.String(o.parse) && (_ = (g) => (o.parse.split(".").forEach((O) => {
  3394. g && (g = g[O]);
  3395. }), g)), a(_(m, s, n)), n.sync(s);
  3396. },
  3397. onError(m) {
  3398. a(void 0), !l() && (u || ((v) => ge(v.message || "fetch fail " + o.action)))(m, s, n);
  3399. }
  3400. });
  3401. t.$handle.beforeFetch(c, { rule: s, api: n }).then(() => {
  3402. if (h.Function(o.action)) {
  3403. o.action(s, n).then((m) => {
  3404. c.onSuccess(m, !0);
  3405. }).catch((m) => {
  3406. c.onError(m);
  3407. });
  3408. return;
  3409. }
  3410. R(() => t.create.fetch(c, { inject: i, rule: s, api: n }));
  3411. });
  3412. }
  3413. return {
  3414. name: "fetch",
  3415. loaded(...i) {
  3416. r(...i);
  3417. },
  3418. watch(...i) {
  3419. r(...i);
  3420. }
  3421. };
  3422. }, lt = {
  3423. name: "required",
  3424. load(t, e, r) {
  3425. const i = Sr(t.getValue());
  3426. if (i.required === !1)
  3427. t.clearProp(), r.clearValidateState([e.field]);
  3428. else {
  3429. const s = y({
  3430. required: !0,
  3431. validator(n, o, a) {
  3432. h.empty(o) ? a(s.message) : a();
  3433. }
  3434. }, i);
  3435. if (!s.message) {
  3436. let n = e.title || "";
  3437. s.message = ((typeof n == "object" ? n.title : n) || "") + "不能为空";
  3438. }
  3439. t.getProp().validate = [s];
  3440. }
  3441. r.sync(e);
  3442. },
  3443. watch(...t) {
  3444. lt.load(...t);
  3445. }
  3446. };
  3447. function Sr(t) {
  3448. return h.Boolean(t) ? { required: t } : h.String(t) ? { message: t } : h.Undef(t) ? { required: !1 } : h.Function(t) ? { validator: t } : h.Object(t) ? t : {};
  3449. }
  3450. const Rr = {
  3451. fetch: Er,
  3452. loadData: Fr,
  3453. required: lt,
  3454. componentValidate: at
  3455. }, jr = "html", Ir = {
  3456. name: jr,
  3457. loadChildren: !1,
  3458. render(t, e) {
  3459. return e.prop.domProps || (e.prop.domProps = {}), e.prop.domProps.innerHTML = t, e.vNode.make(e.prop.props.tag || "div", e.prop);
  3460. },
  3461. renderChildren(t) {
  3462. return Array.isArray(t.rule.children) ? t.rule.children.filter((e) => h.String(e)).join("") : "";
  3463. }
  3464. };
  3465. function Ar(t, e) {
  3466. let r;
  3467. return arguments.length === 2 ? (r = arguments[1], e = r[t]) : r = arguments[2], { id: e, prop: r };
  3468. }
  3469. function ie() {
  3470. return Ar("name", ...arguments);
  3471. }
  3472. function Me(t) {
  3473. return !t || !t.el ? window.document.body : h.Element(t.el) ? t.el : document.querySelector(t.el);
  3474. }
  3475. function Ne(t, e) {
  3476. const r = new T({
  3477. data() {
  3478. return { rule: t, option: e || {} };
  3479. },
  3480. render(i) {
  3481. return i("FormCreate", { ref: "fc", props: this.$data });
  3482. }
  3483. });
  3484. return r.$mount(), r;
  3485. }
  3486. function Vr(t) {
  3487. const e = t.key || [], r = t.array || [], i = t.normal || [];
  3488. Xe.push(...e), pe.push(...r), me.push(...i), et([...e, ...r, ...i]);
  3489. }
  3490. let Pr = 1;
  3491. const S = {};
  3492. function ut(t) {
  3493. const e = {
  3494. [re.name]: re
  3495. }, r = {}, i = {}, s = y({}, Rr), n = Yt();
  3496. let o = { global: {} };
  3497. const a = {}, u = kr(), l = {};
  3498. Vr(t.attrs || {});
  3499. function c(f) {
  3500. const d = S[f];
  3501. if (Array.isArray(d))
  3502. return d.map(($) => $.api());
  3503. if (d)
  3504. return d.api();
  3505. }
  3506. function m() {
  3507. const f = ie(...arguments);
  3508. f.id && f.prop && (i[f.id] = f.prop);
  3509. }
  3510. function v() {
  3511. const f = ie(...arguments);
  3512. f.id && f.prop && (s[f.id] = N(y({}, f.prop), { name: f.id }));
  3513. }
  3514. function _(f) {
  3515. u.use(f);
  3516. }
  3517. function g() {
  3518. const f = ie(...arguments);
  3519. if (!f.id || !f.prop) return ce;
  3520. const d = I(f.id), $ = f.prop, b = $.merge === !0 ? r[d] : void 0;
  3521. r[d] = $, Object.setPrototypeOf($, b || ce), n[d] = E(d), $.maker && p(n, $.maker);
  3522. }
  3523. function O(f, d) {
  3524. let $;
  3525. if (h.String(f)) {
  3526. if ($ = I(f), ["form-create", "formcreate"].indexOf($) > -1)
  3527. return W();
  3528. if (d === void 0)
  3529. return e[$];
  3530. } else
  3531. $ = I(f.name), d = f;
  3532. if (!$ || !d) return;
  3533. const b = I($);
  3534. e[$] = d, e[b] = d, delete u.aliasMap[$], delete u.aliasMap[b], delete r[$], delete r[b], d.formCreateParser && g($, d.formCreateParser);
  3535. }
  3536. function Ce(f) {
  3537. Object.keys(S).forEach((d) => {
  3538. (Array.isArray(S[d]) ? S[d] : [S[d]]).forEach((b) => {
  3539. b.bus.$emit("p.loadData." + f);
  3540. });
  3541. });
  3542. }
  3543. function _e(f, d) {
  3544. a[f] = d, Ce(f);
  3545. }
  3546. function Oe(f, d) {
  3547. return k(a, f) ? a[f] : d;
  3548. }
  3549. function ft(f) {
  3550. delete a[f], Ce(f);
  3551. }
  3552. function W() {
  3553. return xt(we, e, i);
  3554. }
  3555. function ke() {
  3556. return re;
  3557. }
  3558. function ht(f, d) {
  3559. return h.Function(f.install) ? f.install(M, d) : h.Function(f) && f(M, d), this;
  3560. }
  3561. function M(f, d, $) {
  3562. let b = Ne(f, d || {});
  3563. const A = b.$refs.fc.formCreate;
  3564. return A.$parent = $, Me(A.options).appendChild(b.$el), A.api();
  3565. }
  3566. Object.setPrototypeOf(M, l);
  3567. function ct(f) {
  3568. let d = y({}, t);
  3569. return f ? d.inherit = {
  3570. components: e,
  3571. parsers: r,
  3572. directives: i,
  3573. providers: s,
  3574. maker: n,
  3575. loadData: a
  3576. } : delete d.inherit, ut(d);
  3577. }
  3578. function we(f) {
  3579. const d = f.$options.propsData.rule;
  3580. p(this, {
  3581. id: Pr++,
  3582. vm: f,
  3583. create: M,
  3584. manager: wr(t.manager),
  3585. parsers: r,
  3586. providers: s,
  3587. rules: Array.isArray(d) ? d : [],
  3588. name: f.$options.propsData.name || ee(),
  3589. inFor: f.$options.propsData.inFor,
  3590. prop: {
  3591. components: e,
  3592. directives: i
  3593. },
  3594. setData: _e,
  3595. getData: Oe,
  3596. loadData: a,
  3597. CreateNode: u,
  3598. bus: new T(),
  3599. unwatch: null,
  3600. options: {},
  3601. extendApi: t.extendApi || (($) => $)
  3602. }), this.init(), this.initOptions(), this.name && (this.inFor ? (S[this.name] || (S[this.name] = []), S[this.name].push(this)) : S[this.name] = this);
  3603. }
  3604. p(we.prototype, {
  3605. init() {
  3606. const f = this.vm, d = new V(this);
  3607. this.$handle = d, f.$f = d.api, f.$emit("input", d.api), f.$on("hook:created", () => {
  3608. this.isSub() && (this.unwatch = f.$watch(() => f.$pfc.option, () => {
  3609. this.initOptions(), f.$f.refresh();
  3610. }, { deep: !0 }), this.initOptions()), this.created();
  3611. }), f.$on("hook:mounted", () => {
  3612. this.mounted();
  3613. }), f.$on("hook:beforeDestroy", () => {
  3614. if (f.destroyed = !0, this.unwatch && this.unwatch(), d.reloadRule([]), this.name)
  3615. if (this.inFor) {
  3616. const $ = S[this.name].indexOf(this);
  3617. S[this.name].splice($, 1), S[this.name].length || delete S[this.name];
  3618. } else
  3619. delete S[this.name];
  3620. }), f.$on("hook:updated", () => {
  3621. d.bindNextTick(() => this.bus.$emit("next-tick", d.api));
  3622. });
  3623. },
  3624. isSub() {
  3625. return this.vm.$pfc && this.vm.extendOption;
  3626. },
  3627. initOptions() {
  3628. this.options = {};
  3629. let f = y({ formData: {}, submitBtn: {}, resetBtn: {} }, L(o));
  3630. this.isSub() && this.mergeOptions(this.options, this.vm.$pfc.$f.config || {}, !0), f = this.mergeOptions(f, this.vm.$options.propsData.option), this.updateOptions(f);
  3631. },
  3632. mergeOptions(f, d, $) {
  3633. return d = L(d), $ && ["page", "onSubmit", "onReset", "onCreated", "onChange", "onMounted", "mounted", "onReload", "reload", "formData", "el"].forEach((b) => {
  3634. delete d[b];
  3635. }), d.global && (f.global = Qt(f.global, d.global), delete d.global), this.$handle.$manager.mergeOptions([d], f), f;
  3636. },
  3637. updateOptions(f) {
  3638. this.mergeOptions(this.options, f), this.$handle.$manager.updateOptions(this.options);
  3639. },
  3640. created() {
  3641. this.$handle.init(), this.vm.$emit("created", this.api());
  3642. },
  3643. api() {
  3644. return this.$handle.api;
  3645. },
  3646. render() {
  3647. return this.$handle.render();
  3648. },
  3649. mounted() {
  3650. this.$handle.mounted();
  3651. }
  3652. });
  3653. function Fe(f) {
  3654. p(f, {
  3655. version: t.version,
  3656. ui: t.ui,
  3657. setData: _e,
  3658. getData: Oe,
  3659. removeData: ft,
  3660. maker: n,
  3661. component: O,
  3662. directive: m,
  3663. register: v,
  3664. $vnode: ke,
  3665. parser: g,
  3666. use: ht,
  3667. factory: ct,
  3668. componentAlias: _,
  3669. copyRule: $e,
  3670. copyRules: Qe,
  3671. fetch: rt,
  3672. $form: W,
  3673. parseFn: q,
  3674. parseJson: zt,
  3675. toJson: ze,
  3676. getApi: c,
  3677. init(d, $ = {}) {
  3678. let b = Ne(d, $), A = b.$refs.fc.formCreate;
  3679. return {
  3680. mount(J) {
  3681. return J && h.Element(J) && (A.options.el = J), Me(A.options).appendChild(b.$el), A.api();
  3682. },
  3683. remove() {
  3684. b.$el.parentNode && b.$el.parentNode.removeChild(b.$el);
  3685. },
  3686. destroy() {
  3687. this.remove(), b.$destroy();
  3688. },
  3689. $f: A.api()
  3690. };
  3691. }
  3692. });
  3693. }
  3694. function dt(f) {
  3695. p(f, {
  3696. create: M,
  3697. install(d, $) {
  3698. if (o = y(y({}, o), $ || {}), d._installedFormCreate === !0) return;
  3699. d._installedFormCreate = !0;
  3700. const b = function(A, J = {}) {
  3701. return M(A, J, this);
  3702. };
  3703. Fe(b), d.prototype.$formCreate = b, d.component("FormCreate", W()), d.component("FcFragment", ke());
  3704. }
  3705. });
  3706. }
  3707. if (Fe(l), dt(l), u.use({ fragment: "fcFragment" }), g(Ir), t.install && M.use(t), t.inherit) {
  3708. const f = t.inherit;
  3709. f.components && p(e, f.components), f.parsers && p(r, f.parsers), f.directives && p(i, f.directives), f.providers && p(s, f.providers), f.maker && p(n, f.maker), f.loadData && p(a, f.loadData);
  3710. }
  3711. const G = W();
  3712. return Object.setPrototypeOf(G, l), Object.defineProperties(G, {
  3713. fetch: {
  3714. get() {
  3715. return l.fetch;
  3716. },
  3717. set(f) {
  3718. l.fetch = f;
  3719. }
  3720. }
  3721. }), G.util = l, G;
  3722. }
  3723. const qe = {
  3724. date: "yyyy-MM-dd",
  3725. month: "yyyy-MM",
  3726. datetime: "yyyy-MM-dd HH:mm:ss",
  3727. timerange: "HH:mm:ss",
  3728. daterange: "yyyy-MM-dd",
  3729. monthrange: "yyyy-MM",
  3730. datetimerange: "yyyy-MM-dd HH:mm:ss",
  3731. year: "yyyy"
  3732. }, Ue = "datePicker", Tr = {
  3733. name: Ue,
  3734. maker: function() {
  3735. return ["year", "month", "date", "dates", "week", "datetime", "datetimeRange", "dateRange", "monthRange"].reduce((t, e) => (t[e] = E(Ue, { type: e.toLowerCase() }), t), {});
  3736. }(),
  3737. mergeProp(t) {
  3738. const e = t.prop.props;
  3739. e.valueFormat || (e.valueFormat = qe[e.type] || qe.date);
  3740. }
  3741. }, ne = "hidden", Dr = {
  3742. name: ne,
  3743. maker: {
  3744. [ne]: (t, e) => E(ne)("", t, e)
  3745. },
  3746. render() {
  3747. return [];
  3748. }
  3749. }, se = "input", Br = {
  3750. name: se,
  3751. maker: function() {
  3752. const t = ["password", "url", "email", "text", "textarea"].reduce((e, r) => (e[r] = E(se, { type: r }), e), {});
  3753. return t.idate = E(se, { type: "date" }), t;
  3754. }(),
  3755. mergeProp(t) {
  3756. let { props: e } = t.prop;
  3757. e && e.autosize && e.autosize.minRows && (e.rows = e.autosize.minRows || 2);
  3758. }
  3759. }, He = "slider", Lr = {
  3760. name: He,
  3761. maker: {
  3762. sliderRange: E(He, { range: !0 })
  3763. },
  3764. toFormValue(t, e) {
  3765. let r = Array.isArray(t), i = e.prop.props, s = i.min || 0, n;
  3766. return i.range === !0 ? n = r ? t : [s, parseFloat(t) || s] : n = r ? parseFloat(t[0]) || s : parseFloat(t), n;
  3767. }
  3768. }, oe = "timePicker", Mr = {
  3769. name: oe,
  3770. maker: {
  3771. time: E(oe, (t) => t.props.isRange = !1),
  3772. timeRange: E(oe, (t) => t.props.isRange = !0)
  3773. },
  3774. mergeProp(t) {
  3775. const e = t.prop.props;
  3776. e.valueFormat || (e.valueFormat = "HH:mm:ss");
  3777. }
  3778. }, Nr = {
  3779. name: "FcRow",
  3780. render(t, e) {
  3781. return e.vNode.col({ props: { span: 24 } }, [
  3782. e.vNode.row(e.prop, t)
  3783. ]);
  3784. }
  3785. }, qr = "select", Ur = {
  3786. name: qr,
  3787. toFormValue(t, e) {
  3788. return e.prop.props.multiple && !Array.isArray(t) ? j(t) : t;
  3789. }
  3790. }, Hr = [
  3791. Tr,
  3792. Dr,
  3793. Br,
  3794. Lr,
  3795. Mr,
  3796. Nr,
  3797. Ur
  3798. ], C = "el", Jr = {
  3799. button: C + "Button",
  3800. icon: "i",
  3801. slider: C + "Slider",
  3802. rate: C + "Rate",
  3803. upload: "fcUpload",
  3804. cascader: C + "Cascader",
  3805. popover: C + "Popover",
  3806. tooltip: C + "Tooltip",
  3807. colorPicker: C + "ColorPicker",
  3808. timePicker: C + "TimePicker",
  3809. timeSelect: C + "TimeSelect",
  3810. datePicker: C + "DatePicker",
  3811. switch: C + "Switch",
  3812. select: "fcSelect",
  3813. checkbox: "fcCheckbox",
  3814. radio: "fcRadio",
  3815. inputNumber: C + "InputNumber",
  3816. number: C + "InputNumber",
  3817. input: C + "Input",
  3818. formItem: C + "FormItem",
  3819. form: C + "Form",
  3820. frame: "fcFrame",
  3821. col: C + "Col",
  3822. row: C + "Row",
  3823. tree: "fcTree",
  3824. autoComplete: C + "Autocomplete",
  3825. auto: C + "Autocomplete",
  3826. group: "fcGroup",
  3827. object: "fcSubForm",
  3828. subForm: "fcSubForm"
  3829. };
  3830. function xr() {
  3831. return {
  3832. form: {
  3833. inline: !1,
  3834. labelPosition: "right",
  3835. labelWidth: "125px",
  3836. disabled: !1,
  3837. size: void 0
  3838. },
  3839. row: {
  3840. show: !0,
  3841. gutter: 0
  3842. },
  3843. submitBtn: {
  3844. type: "primary",
  3845. loading: !1,
  3846. disabled: !1,
  3847. innerText: "提交",
  3848. show: !0,
  3849. col: void 0,
  3850. click: void 0
  3851. },
  3852. resetBtn: {
  3853. type: "default",
  3854. loading: !1,
  3855. disabled: !1,
  3856. icon: "el-icon-refresh",
  3857. innerText: "重置",
  3858. show: !1,
  3859. col: void 0,
  3860. click: void 0
  3861. }
  3862. };
  3863. }
  3864. function Kr(t) {
  3865. return t.type === "tooltip";
  3866. }
  3867. const Wr = /[A-Z]/;
  3868. function Gr(t, e) {
  3869. return !Wr.test(t) && (h.String(e) || h.Number(e));
  3870. }
  3871. function Je(t, e) {
  3872. k(t, e) && h.String(t[e]) && (t[e] = { [e]: t[e], show: !0 });
  3873. }
  3874. function P(t) {
  3875. return t === !1;
  3876. }
  3877. function Xr(t, e) {
  3878. k(t, e) && !h.Object(t[e]) && (t[e] = { show: !!t[e] });
  3879. }
  3880. const zr = {
  3881. validate() {
  3882. const t = this.form();
  3883. return t ? t.validate() : new Promise((e) => e());
  3884. },
  3885. validateField(t) {
  3886. const e = this.form();
  3887. return e ? new Promise((r, i) => {
  3888. e.validateField(t, (s) => {
  3889. s ? i(s) : r(null);
  3890. });
  3891. }) : new Promise((r) => r());
  3892. },
  3893. clearValidateState(t) {
  3894. const e = this.vm.$refs[t.wrapRef];
  3895. e && (e.validateMessage = "", e.validateState = "");
  3896. },
  3897. tidyOptions(t) {
  3898. return ["submitBtn", "resetBtn", "row", "info", "wrap", "col", "title"].forEach((e) => {
  3899. Xr(t, e);
  3900. }), t;
  3901. },
  3902. tidyRule({ prop: t }) {
  3903. return Je(t, "title"), Je(t, "info"), t;
  3904. },
  3905. mergeProp(t) {
  3906. let e = t.prop.props;
  3907. t.prop = D([{
  3908. attrs: Object.keys(e).reduce((r, i) => (Gr(i, e[i]) && (r[i] = e[i]), r), {}),
  3909. info: this.options.info || {},
  3910. wrap: this.options.wrap || {},
  3911. col: this.options.col || {},
  3912. title: this.options.title || {}
  3913. }, t.prop], {
  3914. info: {
  3915. trigger: "hover",
  3916. placement: "top-start",
  3917. icon: "el-icon-warning"
  3918. },
  3919. title: {},
  3920. col: { span: 24 },
  3921. wrap: {}
  3922. }, { normal: ["title", "info", "col", "wrap"] });
  3923. },
  3924. getDefaultOptions() {
  3925. return xr();
  3926. },
  3927. update() {
  3928. const t = this.options.form;
  3929. this.rule = {
  3930. props: y({}, t),
  3931. nativeOn: {
  3932. submit: (e) => {
  3933. e.preventDefault();
  3934. }
  3935. },
  3936. class: [t.className, t.class, "form-create"],
  3937. style: t.style,
  3938. type: "form"
  3939. };
  3940. },
  3941. beforeRender() {
  3942. const { key: t, ref: e, $handle: r } = this;
  3943. p(this.rule, { key: t, ref: e }), p(this.rule.props, {
  3944. model: r.formData
  3945. // rules: $handle.validate(),
  3946. });
  3947. },
  3948. render(t) {
  3949. return t.length && t.push(this.makeFormBtn()), this.$r(this.rule, P(this.options.row.show) ? t : [this.makeRow(t)]);
  3950. },
  3951. makeWrap(t, e) {
  3952. const r = t.prop, i = `${this.key}${t.key}`, s = r.col, n = this.isTitle(r), o = !s.labelWidth && !n ? 0 : s.labelWidth, { inline: a, col: u } = this.rule.props, l = P(r.wrap.show) ? e : this.$r(D([r.wrap, {
  3953. props: N(y({
  3954. labelWidth: o === void 0 ? o : nt(o),
  3955. label: n ? r.title.title : void 0
  3956. }, r.wrap || {}), {
  3957. prop: t.id,
  3958. rules: t.injectValidate()
  3959. }),
  3960. class: r.className,
  3961. key: `${i}fi`,
  3962. ref: t.wrapRef,
  3963. type: "formItem"
  3964. }]), [e, n ? this.makeInfo(r, i, t) : null]);
  3965. return a === !0 || P(u) || P(s.show) ? l : this.makeCol(r, i, [l]);
  3966. },
  3967. isTitle(t) {
  3968. if (this.options.form.title === !1) return !1;
  3969. const e = t.title;
  3970. return !(!e.title && !e.native || P(e.show));
  3971. },
  3972. makeInfo(t, e, r) {
  3973. const i = t.title, s = t.info, n = Kr(s), o = this.options.form, a = this.getSlot("title"), u = [a ? a({ title: i.title || "", rule: r.rule, options: this.options }) : (i.title || "") + (o.labelSuffix || o["label-suffix"] || "")];
  3974. if (!P(s.show) && (s.info || s.native) && !P(s.icon)) {
  3975. const l = {
  3976. type: s.type || "popover",
  3977. props: y({}, s),
  3978. key: `${e}pop`,
  3979. slot: "label"
  3980. }, c = "content";
  3981. s.info && !k(l.props, c) && (l.props[c] = s.info), u[s.align !== "left" ? "unshift" : "push"](this.$r(D([s, l]), [
  3982. this.$r({
  3983. type: "i",
  3984. slot: n ? "default" : "reference",
  3985. class: s.icon === !0 ? "el-icon-warning" : s.icon,
  3986. key: `${e}i`
  3987. })
  3988. ]));
  3989. }
  3990. return this.$r(D([i, {
  3991. props: i,
  3992. slot: i.slot || "label",
  3993. key: `${e}tit`,
  3994. type: i.type || "span"
  3995. }]), u);
  3996. },
  3997. makeCol(t, e, r) {
  3998. const i = t.col;
  3999. return this.$r({
  4000. class: i.class,
  4001. type: "col",
  4002. props: i || { span: 24 },
  4003. key: `${e}col`
  4004. }, r);
  4005. },
  4006. makeRow(t) {
  4007. const e = this.options.row || {};
  4008. return this.$r({
  4009. type: "row",
  4010. props: e,
  4011. class: e.class,
  4012. key: `${this.key}row`
  4013. }, t);
  4014. },
  4015. makeFormBtn() {
  4016. let t = [];
  4017. if (P(this.options.submitBtn.show) || t.push(this.makeSubmitBtn()), P(this.options.resetBtn.show) || t.push(this.makeResetBtn()), !t.length)
  4018. return;
  4019. const e = this.$r({
  4020. type: "formItem",
  4021. key: `${this.key}fb`
  4022. }, t);
  4023. return this.rule.props.inline === !0 ? e : this.$r({
  4024. type: "col",
  4025. props: { span: 24 },
  4026. key: `${this.key}fc`
  4027. }, [e]);
  4028. },
  4029. makeResetBtn() {
  4030. const t = this.options.resetBtn;
  4031. return this.$r({
  4032. type: "button",
  4033. props: t,
  4034. style: { width: t.width },
  4035. on: {
  4036. click: () => {
  4037. const e = this.$handle.api;
  4038. t.click ? t.click(e) : e.resetFields();
  4039. }
  4040. },
  4041. key: `${this.key}b2`
  4042. }, [t.innerText]);
  4043. },
  4044. makeSubmitBtn() {
  4045. const t = this.options.submitBtn;
  4046. return this.$r({
  4047. type: "button",
  4048. props: t,
  4049. style: { width: t.width },
  4050. on: {
  4051. click: () => {
  4052. const e = this.$handle.api;
  4053. t.click ? t.click(e) : e.submit();
  4054. }
  4055. },
  4056. key: `${this.key}b1`
  4057. }, [t.innerText]);
  4058. }
  4059. }, H = {};
  4060. Qr(H);
  4061. Zr(H);
  4062. Yr(H);
  4063. ei(H);
  4064. ti(H);
  4065. function Qr(t) {
  4066. ["group", "tree", "switch", "upload", "autoComplete", "checkbox", "cascader", "colorPicker", "datePicker", "frame", "inputNumber", "radio", "rate"].forEach((e) => {
  4067. t[e] = E(e);
  4068. }), t.auto = t.autoComplete, t.number = t.inputNumber, t.color = t.colorPicker;
  4069. }
  4070. function Zr(t) {
  4071. const e = "select", r = "multiple";
  4072. t.selectMultiple = E(e, { [r]: !0 }), t.selectOne = E(e, { [r]: !1 });
  4073. }
  4074. function Yr(t) {
  4075. const e = "tree", r = { treeSelected: "selected", treeChecked: "checked" };
  4076. Object.keys(r).reduce((i, s) => (i[s] = E(e, { type: r[s] }), i), t);
  4077. }
  4078. function ei(t) {
  4079. const e = "upload", r = {
  4080. image: ["image", 0],
  4081. file: ["file", 0],
  4082. uploadFileOne: ["file", 1],
  4083. uploadImageOne: ["image", 1]
  4084. };
  4085. Object.keys(r).reduce((i, s) => (i[s] = E(e, (n) => n.props({ uploadType: r[s][0], maxLength: r[s][1] })), i), t), t.uploadImage = t.image, t.uploadFile = t.file;
  4086. }
  4087. function ti(t) {
  4088. const e = {
  4089. frameInputs: ["input", 0],
  4090. frameFiles: ["file", 0],
  4091. frameImages: ["image", 0],
  4092. frameInputOne: ["input", 1],
  4093. frameFileOne: ["file", 1],
  4094. frameImageOne: ["image", 1]
  4095. };
  4096. return Object.keys(e).reduce((r, i) => (r[i] = E("frame", (s) => s.props({ type: e[i][0], maxLength: e[i][1] })), r), t), t.frameInput = t.frameInputs, t.frameFile = t.frameFiles, t.frameImage = t.frameImages, t;
  4097. }
  4098. function xe(t, e) {
  4099. return h.Boolean(t) ? t = { show: t } : !h.Undef(t) && !h.Object(t) && (t = { show: e }), t;
  4100. }
  4101. function ri(t, e) {
  4102. return p(t, {
  4103. formEl() {
  4104. return e.$manager.form();
  4105. },
  4106. wrapEl(r) {
  4107. const i = e.getFieldCtx(r);
  4108. if (i)
  4109. return e.vm.$refs[i.wrapRef];
  4110. },
  4111. validate(r) {
  4112. return new Promise((i, s) => {
  4113. const n = t.children, o = [e.$manager.validate()];
  4114. n.forEach((a) => {
  4115. o.push(a.validate());
  4116. }), Promise.all(o).then(() => {
  4117. i(!0), r && r(!0);
  4118. }).catch((a) => {
  4119. s(a), r && r(!1, a), e.vm.$emit("validate-fail", a, { api: t });
  4120. });
  4121. });
  4122. },
  4123. validateField: (r, i) => new Promise((s, n) => {
  4124. const o = e.getFieldCtx(r);
  4125. if (!o) return;
  4126. const a = e.subForm[o.id], u = [e.$manager.validateField(o.id)];
  4127. j(a).forEach((l) => {
  4128. u.push(l.validate().catch(() => Promise.reject("子表单验证未通过")));
  4129. }), Promise.all(u).then(() => {
  4130. s(null), i && i(null);
  4131. }).catch((l) => {
  4132. n(l), i && i(l), e.vm.$emit("validate-field-fail", l, { field: r, api: t });
  4133. });
  4134. }),
  4135. clearValidateState(r, i = !0) {
  4136. t.helper.tidyFields(r).forEach((s) => {
  4137. i && this.clearSubValidateState(s), e.getCtxs(s).forEach((n) => {
  4138. e.$manager.clearValidateState(n);
  4139. });
  4140. });
  4141. },
  4142. clearSubValidateState(r) {
  4143. t.helper.tidyFields(r).forEach((i) => {
  4144. e.getCtxs(i).forEach((s) => {
  4145. const n = e.subForm[s.id];
  4146. n && (Array.isArray(n) ? n.forEach((o) => {
  4147. o.clearValidateState();
  4148. }) : n && n.clearValidateState());
  4149. });
  4150. });
  4151. },
  4152. btn: {
  4153. loading: (r = !0) => {
  4154. t.submitBtnProps({ loading: !!r });
  4155. },
  4156. disabled: (r = !0) => {
  4157. t.submitBtnProps({ disabled: !!r });
  4158. },
  4159. show: (r = !0) => {
  4160. t.submitBtnProps({ show: !!r });
  4161. }
  4162. },
  4163. resetBtn: {
  4164. loading: (r = !0) => {
  4165. t.resetBtnProps({ loading: !!r });
  4166. },
  4167. disabled: (r = !0) => {
  4168. t.resetBtnProps({ disabled: !!r });
  4169. },
  4170. show: (r = !0) => {
  4171. t.resetBtnProps({ show: !!r });
  4172. }
  4173. },
  4174. submitBtnProps: (r = {}) => {
  4175. let i = xe(e.options.submitBtn, !0);
  4176. p(i, r), e.options.submitBtn = i, t.refreshOptions();
  4177. },
  4178. resetBtnProps: (r = {}) => {
  4179. let i = xe(e.options.resetBtn, !1);
  4180. p(i, r), e.options.resetBtn = i, t.refreshOptions();
  4181. },
  4182. submit(r, i) {
  4183. t.validate((s) => {
  4184. if (s) {
  4185. let n = t.formData();
  4186. h.Function(r) ? R(() => r(n, this)) : (h.Function(e.options.onSubmit) && R(() => e.options.onSubmit(n, this)), e.vm.$emit("submit", n, this));
  4187. } else
  4188. h.Function(i) && R(() => i(this, ...arguments));
  4189. }).catch((s) => {
  4190. });
  4191. }
  4192. }), t;
  4193. }
  4194. function ii(t) {
  4195. t.componentAlias(Jr), Jt.forEach((e) => {
  4196. t.component(e.name, e);
  4197. }), Hr.forEach((e) => {
  4198. t.parser(e);
  4199. }), Object.keys(H).forEach((e) => {
  4200. t.maker[e] = H[e];
  4201. });
  4202. }
  4203. function ni() {
  4204. return ut({
  4205. ui: "element-ui",
  4206. version: "2.6.3",
  4207. manager: zr,
  4208. extendApi: ri,
  4209. install: ii,
  4210. attrs: {
  4211. normal: ["col", "wrap"],
  4212. array: ["className"],
  4213. key: ["title", "info"]
  4214. }
  4215. });
  4216. }
  4217. const de = ni();
  4218. typeof window != "undefined" && (window.formCreate = de, window.Vue && de.install(window.Vue));
  4219. const ai = de.maker;
  4220. export {
  4221. de as default,
  4222. ai as maker
  4223. };