1 |
- !function(){function n(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,t){var r=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null==r)return;var e,o,i=[],u=!0,a=!1;try{for(r=r.call(n);!(u=(e=r.next()).done)&&(i.push(e.value),!t||i.length!==t);u=!0);}catch(l){a=!0,o=l}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(n,r)||function(n,r){if(!n)return;if("string"==typeof n)return t(n,r);var e=Object.prototype.toString.call(n).slice(8,-1);"Object"===e&&n.constructor&&(e=n.constructor.name);if("Map"===e||"Set"===e)return Array.from(n);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return t(n,r)}(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}System.register(["./index-legacy.47bc1690.js"],(function(t){"use strict";var r,e,o,i,u,a,l,c,f,s;return{setters:[function(n){r=n.t,e=n.z,o=n.v,i=n.d,u=n.x,a=n.S,l=n.W,c=n.c,f=n.a4,s=n.D}],execute:function(){var d=n(r("form"),2),m=d[0],v=d[1],g={colon:Boolean,disabled:Boolean,readonly:Boolean,showError:Boolean,labelWidth:e,labelAlign:String,inputAlign:String,scrollToError:Boolean,validateFirst:Boolean,submitOnEnter:o,showErrorMessage:o,errorMessageAlign:String,validateTrigger:{type:[String,Array],default:"onBlur"}},h=i({name:m,props:g,emits:["submit","failed"],setup:function(n,t){var r=t.emit,e=t.slots,o=u(a),i=o.children,s=o.linkChildren,d=function(n){return n?i.filter((function(t){return n.includes(t.name)})):i},m=function(t){return"string"==typeof t?function(n){var t=i.find((function(t){return t.name===n}));return t?new Promise((function(n,r){t.validate().then((function(t){t?r(t):n()}))})):Promise.reject()}(t):n.validateFirst?(r=t,new Promise((function(n,t){var e=[];d(r).reduce((function(n,t){return n.then((function(){if(!e.length)return t.validate().then((function(n){n&&e.push(n)}))}))}),Promise.resolve()).then((function(){e.length?t(e):n()}))}))):function(n){return new Promise((function(t,r){var e=d(n);Promise.all(e.map((function(n){return n.validate()}))).then((function(n){(n=n.filter(Boolean)).length?r(n):t()}))}))}(t);var r},g=function(n,t){i.some((function(r){return r.name===n&&(r.$el.scrollIntoView(t),!0)}))},h=function(){return i.reduce((function(n,t){return n[t.name]=t.formValue.value,n}),{})},y=function(){var t=h();m().then((function(){return r("submit",t)})).catch((function(e){r("failed",{values:t,errors:e}),n.scrollToError&&e[0].name&&g(e[0].name)}))},p=function(n){f(n),y()};return s({props:n}),l({submit:y,validate:m,getValues:h,scrollToField:g,resetValidation:function(n){"string"==typeof n&&(n=[n]),d(n).forEach((function(n){n.resetValidation()}))},getValidationStatus:function(){return i.reduce((function(n,t){return n[t.name]=t.getValidationStatus(),n}),{})}}),function(){var n;return c("form",{class:v(),onSubmit:p},[null==(n=e.default)?void 0:n.call(e)])}}});t("F",s(h))}}}))}();
|