1 |
- !function(){function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,i=[],o=!0,l=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(u){l=!0,a=u}finally{try{o||null==n.return||n.return()}finally{if(l)throw a}}return i}(e,t)||n(e,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 t(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||n(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}System.register(["./index-legacy.90c82f08.js","./index-legacy.f3e5e283.js"],(function(n){"use strict";var r,a,i,o,l,u,c,s,f,d,g,v,p,m,y,h,b,S,w,x,I,k,A,C,M,V,B,E,T,j,P,z,L,O,W,q,H,R;return{setters:[function(e){r=e.H,a=e.I,i=e.J,o=e.K,l=e.M,u=e.t,c=e.z,s=e.u,f=e.w,d=e.N,g=e.O,v=e.d,p=e.Q,m=e.r,y=e.R,h=e.C,b=e.S,S=e.y,w=e.U,x=e.W,I=e.X,k=e.Y,A=e.Z,C=e._,M=e.$,V=e.a0,B=e.c,E=e.a1,T=e.a2,j=e.a3,P=e.a4,z=e.a5,L=e.E,O=e.q,W=e.a6,q=e.D},function(e){H=e.c,R=e.C}],execute:function(){function D(e){return Array.isArray(e)?!e.length:0!==e&&!e}function F(e,t){var n=t.message;return l(n)?n(e,t):n||""}function $(e){e.target.composing=!0}function K(e){var t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function U(e){return t(e).length}var J=e(u("field"),2),N=J[0],Q=J[1],X=n("f",{id:String,name:String,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:c,formatter:Function,clearIcon:s("clear"),modelValue:f(""),inputAlign:String,placeholder:String,autocomplete:String,errorMessage:String,enterkeyhint:String,clearTrigger:s("focus"),formatTrigger:s("onChange"),error:{type:Boolean,default:null},disabled:{type:Boolean,default:null},readonly:{type:Boolean,default:null}}),Y=d({},H,X,{rows:c,type:s("text"),rules:Array,autosize:[Boolean,Object],labelWidth:c,labelClass:g,labelAlign:String,showWordLimit:Boolean,errorMessageAlign:String,colon:{type:Boolean,default:null}}),Z=v({name:N,props:Y,emits:["blur","focus","clear","keypress","clickInput","endValidate","startValidate","clickLeftIcon","clickRightIcon","update:modelValue"],setup:function(e,n){var l=n.emit,u=n.slots,c=p(),s=m({status:"unvalidated",focused:!1,validateMessage:""}),f=y(),d=y(),g=y(),v=h(b).parent,q=function(){var t;return String(null!=(t=e.modelValue)?t:"")},H=function(t){return E(e[t])?e[t]:v&&E(v.props[t])?v.props[t]:void 0},J=S((function(){var t=H("readonly");if(e.clearable&&!t){var n=""!==q(),r="always"===e.clearTrigger||"focus"===e.clearTrigger&&s.focused;return n&&r}return!1})),N=S((function(){return g.value&&u.input?g.value():e.modelValue})),X=function(e){return e.reduce((function(e,t){return e.then((function(){if("failed"!==s.status){var e=N.value;if(t.formatter&&(e=t.formatter(e,t)),!function(e,t){if(D(e)){if(t.required)return!1;if(!1===t.validateEmpty)return!0}return!(t.pattern&&!t.pattern.test(String(e)))}(e,t))return s.status="failed",void(s.validateMessage=F(e,t));if(t.validator){if(D(e)&&!1===t.validateEmpty)return;return function(e,t){return new Promise((function(n){var r=t.validator(e,t);o(r)?r.then(n):n(r)}))}(e,t).then((function(n){n&&"string"==typeof n?(s.status="failed",s.validateMessage=n):!1===n&&(s.status="failed",s.validateMessage=F(e,t))}))}}}))}),Promise.resolve())},Y=function(){s.status="unvalidated",s.validateMessage=""},Z=function(){return l("endValidate",{status:s.status,message:s.validateMessage})},_=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.rules;return new Promise((function(n){Y(),t?(l("startValidate"),X(t).then((function(){"failed"===s.status?(n({name:e.name,message:s.validateMessage}),Z()):(s.status="passed",n(),Z())}))):n()}))},G=function(t){if(v&&e.rules){var n=v.props.validateTrigger,r=T(n).includes(t),a=e.rules.filter((function(e){return e.trigger?T(e.trigger).includes(t):r}));a.length&&_(a)}},ee=function(n){var r=e.maxlength;if(E(r)&&U(n)>r){var a=q();return a&&U(a)===+r?a:function(e,n){return t(e).slice(0,n).join("")}(n,+r)}return n},te=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"onChange";if(t=ee(t),"number"===e.type||"digit"===e.type){var r="number"===e.type;t=j(t,r,r)}if(e.formatter&&n===e.formatTrigger&&(t=e.formatter(t)),f.value&&f.value.value!==t){var a=f.value,i=a.selectionStart,o=a.selectionEnd;f.value.value=t,f.value.setSelectionRange(i,o)}t!==e.modelValue&&l("update:modelValue",t)},ne=function(e){e.target.composing||te(e.target.value)},re=function(){var e;return null==(e=f.value)?void 0:e.blur()},ae=function(){var t=f.value;"textarea"===e.type&&e.autosize&&t&&function(e,t){var n=r();e.style.height="auto";var o=e.scrollHeight;if(i(t)){var l=t.maxHeight,u=t.minHeight;void 0!==l&&(o=Math.min(o,l)),void 0!==u&&(o=Math.max(o,u))}o&&(e.style.height="".concat(o,"px"),a(n))}(t,e.autosize)},ie=function(e){s.focused=!0,l("focus",e),C(ae),H("readonly")&&re()},oe=function(e){H("readonly")||(s.focused=!1,te(q(),"onBlur"),l("blur",e),G("onBlur"),C(ae),W())},le=function(e){return l("clickInput",e)},ue=function(e){return l("clickLeftIcon",e)},ce=function(e){return l("clickRightIcon",e)},se=S((function(){return"boolean"==typeof e.error?e.error:!(!v||!v.props.showError||"failed"!==s.status)||void 0})),fe=S((function(){var e=H("labelWidth");if(e)return{width:w(e)}})),de=function(t){13===t.keyCode&&(v&&v.props.submitOnEnter||"textarea"===e.type||P(t),"search"===e.type&&re());l("keypress",t)},ge=function(){return e.id||"".concat(c,"-input")},ve=function(){var t=Q("control",[H("inputAlign"),{error:se.value,custom:!!u.input,"min-height":"textarea"===e.type&&!e.autosize}]);if(u.input)return B("div",{class:t,onClick:le},[u.input()]);var n,r={id:ge(),ref:f,name:e.name,rows:void 0!==e.rows?+e.rows:void 0,class:t,disabled:H("disabled"),readonly:H("readonly"),autofocus:e.autofocus,placeholder:e.placeholder,autocomplete:e.autocomplete,enterkeyhint:e.enterkeyhint,"aria-labelledby":e.label?"".concat(c,"-label"):void 0,onBlur:oe,onFocus:ie,onInput:ne,onClick:le,onChange:K,onKeypress:de,onCompositionend:K,onCompositionstart:$};return"textarea"===e.type?B("textarea",r,null):B("input",L("number"===(n=e.type)?{type:"text",inputmode:"decimal"}:"digit"===n?{type:"tel",inputmode:"numeric"}:{type:n},r),null)},pe=function(){var t=u["right-icon"];if(e.rightIcon||t)return B("div",{class:Q("right-icon"),onClick:ce},[t?t():B(z,{name:e.rightIcon,classPrefix:e.iconPrefix},null)])},me=function(){if(e.showWordLimit&&e.maxlength){var t=U(q());return B("div",{class:Q("word-limit")},[B("span",{class:Q("word-num")},[t]),O("/"),e.maxlength])}},ye=function(){if(!v||!1!==v.props.showErrorMessage){var t=e.errorMessage||s.validateMessage;if(t){var n=u["error-message"],r=H("errorMessageAlign");return B("div",{class:Q("error-message",r)},[n?n({message:t}):t])}}},he=function(){return[B("div",{class:Q("body")},[ve(),J.value&&B(z,{ref:d,name:e.clearIcon,class:Q("clear")},null),pe(),u.button&&B("div",{class:Q("button")},[u.button()])]),me(),ye()]};return x({blur:re,focus:function(){var e;return null==(e=f.value)?void 0:e.focus()},validate:_,formValue:N,resetValidation:Y,getValidationStatus:function(){return s.status}}),I(k,{customValue:g,resetValidation:Y,validateWithTrigger:G}),A((function(){return e.modelValue}),(function(){te(q()),Y(),G("onChange"),C(ae)})),M((function(){te(q(),e.formatTrigger),C(ae)})),V("touchstart",(function(e){P(e),l("update:modelValue",""),l("clear",e)}),{target:S((function(){var e;return null==(e=d.value)?void 0:e.$el}))}),function(){var t,n,r,a,i=H("disabled"),o=H("labelAlign"),l=(t=H("colon")?":":"",u.label?[u.label(),t]:e.label?B("label",{id:"".concat(c,"-label"),for:ge()},[e.label+t]):void 0),s=function(){var t=u["left-icon"];if(e.leftIcon||t)return B("div",{class:Q("left-icon"),onClick:ue},[t?t():B(z,{name:e.leftIcon,classPrefix:e.iconPrefix},null)])}();return B(R,{size:e.size,class:Q((n={error:se.value,disabled:i},r="label-".concat(o),a=o,r in n?Object.defineProperty(n,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[r]=a,n)),center:e.center,border:e.border,isLink:e.isLink,clickable:e.clickable,titleStyle:fe.value,valueClass:Q("value"),titleClass:[Q("label",[o,{required:e.required}]),e.labelClass],arrowDirection:e.arrowDirection},{icon:s&&"top"!==o?function(){return s}:null,title:l||"top"===o?function(){return"top"===o?[s,l]:l}:null,value:he,extra:u.extra})}}});n("F",q(Z))}}}))}();
|