index-legacy.21d121b2.js 2.9 KB

1
  1. !function(){function n(n,t){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null==t)return;var e,o,i=[],u=!0,a=!1;try{for(t=t.call(n);!(u=(e=t.next()).done)&&(i.push(e.value),!r||i.length!==r);u=!0);}catch(l){a=!0,o=l}finally{try{u||null==t.return||t.return()}finally{if(a)throw o}}return i}(n,t)||function(n,t){if(!n)return;if("string"==typeof n)return r(n,t);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 r(n,t)}(n,t)||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 r(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}System.register(["./index-legacy.fba2875c.js"],(function(r){"use strict";var t,e,o,i,u,a,l,c,f,s,m;return{setters:[function(n){t=n.A,e=n.E,o=n.G,i=n.$,u=n.d,a=n.ai,l=n.aL,c=n.aj,f=n.j,s=n.ap,m=n.N}],execute:function(){var d=n(t("form"),2),v=d[0],h=d[1],g={colon:Boolean,disabled:Boolean,readonly:Boolean,showError:Boolean,labelWidth:e,labelAlign:String,inputAlign:String,scrollToError:Boolean,validateFirst:Boolean,submitOnEnter:o,validateTrigger:i("onBlur"),showErrorMessage:o,errorMessageAlign:String},y=u({name:v,props:g,emits:["submit","failed"],setup:function(n,r){var t=r.emit,e=r.slots,o=a(l),i=o.children,u=o.linkChildren,m=function(n){return n?i.filter((function(r){return n.includes(r.name)})):i},d=function(r){return"string"==typeof r?function(n){var r=i.find((function(r){return r.name===n}));return r?new Promise((function(n,t){r.validate().then((function(r){r?t(r):n()}))})):Promise.reject()}(r):n.validateFirst?(t=r,new Promise((function(n,r){var e=[];m(t).reduce((function(n,r){return n.then((function(){if(!e.length)return r.validate().then((function(n){n&&e.push(n)}))}))}),Promise.resolve()).then((function(){e.length?r(e):n()}))}))):function(n){return new Promise((function(r,t){var e=m(n);Promise.all(e.map((function(n){return n.validate()}))).then((function(n){(n=n.filter(Boolean)).length?t(n):r()}))}))}(r);var t},v=function(n,r){i.some((function(t){return t.name===n&&(t.$el.scrollIntoView(r),!0)}))},g=function(){var r=i.reduce((function(n,r){return n[r.name]=r.formValue.value,n}),{});d().then((function(){return t("submit",r)})).catch((function(e){t("failed",{values:r,errors:e}),n.scrollToError&&e[0].name&&v(e[0].name)}))},y=function(n){s(n),g()};return u({props:n}),c({submit:g,validate:d,scrollToField:v,resetValidation:function(n){"string"==typeof n&&(n=[n]),m(n).forEach((function(n){n.resetValidation()}))}}),function(){var n;return f("form",{class:h(),onSubmit:y},[null==(n=e.default)?void 0:n.call(e)])}}});r("F",m(y))}}}))}();