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