@tarojs/components 3.5.3 → 3.5.4-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,6 +70,7 @@ let Input = class {
70
70
  value,
71
71
  cursor: value.length
72
72
  });
73
+ this.onInputExcuted = false;
73
74
  }
74
75
  };
75
76
  this.handlePaste = (e) => {
@@ -10070,8 +10070,8 @@ let Swiper = class {
10070
10070
  slideTo() {
10071
10071
  that.current = this.realIndex;
10072
10072
  },
10073
- // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionEnd 事件代替
10074
- slideChangeTransitionEnd(_swiper) {
10073
+ // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionStart 事件代替
10074
+ slideChangeTransitionStart(_swiper) {
10075
10075
  if (that.circular) {
10076
10076
  if (_swiper.isBeginning || _swiper.isEnd) {
10077
10077
  _swiper.slideToLoop(this.realIndex, 0); // 更新下标
@@ -55,6 +55,7 @@ export class Input {
55
55
  value,
56
56
  cursor: value.length
57
57
  });
58
+ this.onInputExcuted = false;
58
59
  }
59
60
  };
60
61
  this.handlePaste = (e) => {
@@ -213,8 +213,8 @@ export class Swiper {
213
213
  slideTo() {
214
214
  that.current = this.realIndex;
215
215
  },
216
- // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionEnd 事件代替
217
- slideChangeTransitionEnd(_swiper) {
216
+ // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionStart 事件代替
217
+ slideChangeTransitionStart(_swiper) {
218
218
  if (that.circular) {
219
219
  if (_swiper.isBeginning || _swiper.isEnd) {
220
220
  _swiper.slideToLoop(this.realIndex, 0); // 更新下标
@@ -66,6 +66,7 @@ let Input = class {
66
66
  value,
67
67
  cursor: value.length
68
68
  });
69
+ this.onInputExcuted = false;
69
70
  }
70
71
  };
71
72
  this.handlePaste = (e) => {
@@ -10066,8 +10066,8 @@ let Swiper = class {
10066
10066
  slideTo() {
10067
10067
  that.current = this.realIndex;
10068
10068
  },
10069
- // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionEnd 事件代替
10070
- slideChangeTransitionEnd(_swiper) {
10069
+ // slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionStart 事件代替
10070
+ slideChangeTransitionStart(_swiper) {
10071
10071
  if (that.circular) {
10072
10072
  if (_swiper.isBeginning || _swiper.isEnd) {
10073
10073
  _swiper.slideToLoop(this.realIndex, 0); // 更新下标
@@ -1 +1 @@
1
- import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-8809c729.js";var indexCss="taro-input-core{display:block}input{display:block;overflow:hidden;height:1.4rem;text-overflow:clip;text-align:inherit;white-space:nowrap}";function getTrueType(e,t,n){if(t==="search")e="search";if(n)e="password";if(typeof e==="undefined"){return"text"}if(!e){throw new Error("unexpected type")}if(e==="digit")e="number";return e}function fixControlledValue(e){return e!==null&&e!==void 0?e:""}var Input=function(){function e(e){var t=this;registerInstance(this,e);this.onInput=createEvent(this,"input",7);this.onPaste=createEvent(this,"paste",7);this.onFocus=createEvent(this,"focus",7);this.onBlur=createEvent(this,"blur",7);this.onConfirm=createEvent(this,"confirm",7);this.onChange=createEvent(this,"change",7);this.onKeyDown=createEvent(this,"keydown",7);this.isOnComposition=false;this.isOnPaste=false;this.onInputExcuted=false;this.password=false;this.disabled=false;this.maxlength=140;this.autoFocus=false;this.confirmType="done";this.nativeProps={};this.handleInput=function(e){e.stopPropagation();var n=t,i=n.type,o=n.maxlength,a=n.confirmType,s=n.password;if(!t.isOnComposition&&!t.onInputExcuted){var u=e.target.value;var r=getTrueType(i,a,s);t.onInputExcuted=true;if(r==="number"&&u&&o<=u.length){u=u.substring(0,o);e.target.value=u}t.value=u;t.onInput.emit({value:u,cursor:u.length})}};this.handlePaste=function(e){t.isOnPaste=true;t.onPaste.emit({value:e.target.value})};this.handleFocus=function(e){t.onInputExcuted=false;t.onFocus.emit({value:e.target.value})};this.handleBlur=function(e){t.onBlur.emit({value:e.target.value})};this.handleChange=function(e){e.stopPropagation();t.onChange.emit({value:e.target.value});if(t.isOnPaste){t.isOnPaste=false;t.value=e.target.value;t.onInput.emit({value:e.target.value,cursor:e.target.value.length})}};this.handleKeyDown=function(e){var n=e.target.value;var i=e.keyCode||e.code;t.onInputExcuted=false;e.stopPropagation();t.onKeyDown.emit({value:n,cursor:n.length,keyCode:i});i===13&&t.onConfirm.emit({value:n})};this.handleComposition=function(e){if(!(e.target instanceof HTMLInputElement))return;if(e.type==="compositionend"){t.isOnComposition=false;t.value=e.target.value;t.onInput.emit({value:e.target.value,cursor:e.target.value.length})}else{t.isOnComposition=true}}}e.prototype.watchFocus=function(e,t){var n;if(!t&&e){(n=this.inputRef)===null||n===void 0?void 0:n.focus()}};e.prototype.watchValue=function(e){var t=fixControlledValue(e);if(this.inputRef&&this.inputRef.value!==t){this.inputRef.value=t}};e.prototype.componentDidLoad=function(){var e=this;var t,n,i;if(this.type==="file"){this.fileListener=function(){e.onInput.emit()};(t=this.inputRef)===null||t===void 0?void 0:t.addEventListener("change",this.fileListener)}else{(n=this.inputRef)===null||n===void 0?void 0:n.addEventListener("compositionstart",this.handleComposition);(i=this.inputRef)===null||i===void 0?void 0:i.addEventListener("compositionend",this.handleComposition)}Object.defineProperty(this.el,"value",{get:function(){var t;return(t=e.inputRef)===null||t===void 0?void 0:t.value},set:function(t){return e.value=t},configurable:true})};e.prototype.disconnectedCallback=function(){var e;if(this.type==="file"){(e=this.inputRef)===null||e===void 0?void 0:e.removeEventListener("change",this.fileListener)}};e.prototype.render=function(){var e=this;var t=this,n=t.value,i=t.type,o=t.password,a=t.placeholder,s=t.autoFocus,u=t.disabled,r=t.maxlength,l=t.confirmType,p=t.name,c=t.nativeProps;return h("input",Object.assign({ref:function(t){e.inputRef=t},class:"weui-input",value:fixControlledValue(n),type:getTrueType(i,l,o),placeholder:a,autoFocus:s,disabled:u,maxlength:r,name:p,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onPaste:this.handlePaste,onCompositionStart:this.handleComposition,onCompositionEnd:this.handleComposition},c))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{autoFocus:["watchFocus"],value:["watchValue"]}},enumerable:false,configurable:true});return e}();Input.style=indexCss;export{Input as taro_input_core};
1
+ import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-8809c729.js";var indexCss="taro-input-core{display:block}input{display:block;overflow:hidden;height:1.4rem;text-overflow:clip;text-align:inherit;white-space:nowrap}";function getTrueType(e,t,n){if(t==="search")e="search";if(n)e="password";if(typeof e==="undefined"){return"text"}if(!e){throw new Error("unexpected type")}if(e==="digit")e="number";return e}function fixControlledValue(e){return e!==null&&e!==void 0?e:""}var Input=function(){function e(e){var t=this;registerInstance(this,e);this.onInput=createEvent(this,"input",7);this.onPaste=createEvent(this,"paste",7);this.onFocus=createEvent(this,"focus",7);this.onBlur=createEvent(this,"blur",7);this.onConfirm=createEvent(this,"confirm",7);this.onChange=createEvent(this,"change",7);this.onKeyDown=createEvent(this,"keydown",7);this.isOnComposition=false;this.isOnPaste=false;this.onInputExcuted=false;this.password=false;this.disabled=false;this.maxlength=140;this.autoFocus=false;this.confirmType="done";this.nativeProps={};this.handleInput=function(e){e.stopPropagation();var n=t,i=n.type,o=n.maxlength,a=n.confirmType,s=n.password;if(!t.isOnComposition&&!t.onInputExcuted){var u=e.target.value;var r=getTrueType(i,a,s);t.onInputExcuted=true;if(r==="number"&&u&&o<=u.length){u=u.substring(0,o);e.target.value=u}t.value=u;t.onInput.emit({value:u,cursor:u.length});t.onInputExcuted=false}};this.handlePaste=function(e){t.isOnPaste=true;t.onPaste.emit({value:e.target.value})};this.handleFocus=function(e){t.onInputExcuted=false;t.onFocus.emit({value:e.target.value})};this.handleBlur=function(e){t.onBlur.emit({value:e.target.value})};this.handleChange=function(e){e.stopPropagation();t.onChange.emit({value:e.target.value});if(t.isOnPaste){t.isOnPaste=false;t.value=e.target.value;t.onInput.emit({value:e.target.value,cursor:e.target.value.length})}};this.handleKeyDown=function(e){var n=e.target.value;var i=e.keyCode||e.code;t.onInputExcuted=false;e.stopPropagation();t.onKeyDown.emit({value:n,cursor:n.length,keyCode:i});i===13&&t.onConfirm.emit({value:n})};this.handleComposition=function(e){if(!(e.target instanceof HTMLInputElement))return;if(e.type==="compositionend"){t.isOnComposition=false;t.value=e.target.value;t.onInput.emit({value:e.target.value,cursor:e.target.value.length})}else{t.isOnComposition=true}}}e.prototype.watchFocus=function(e,t){var n;if(!t&&e){(n=this.inputRef)===null||n===void 0?void 0:n.focus()}};e.prototype.watchValue=function(e){var t=fixControlledValue(e);if(this.inputRef&&this.inputRef.value!==t){this.inputRef.value=t}};e.prototype.componentDidLoad=function(){var e=this;var t,n,i;if(this.type==="file"){this.fileListener=function(){e.onInput.emit()};(t=this.inputRef)===null||t===void 0?void 0:t.addEventListener("change",this.fileListener)}else{(n=this.inputRef)===null||n===void 0?void 0:n.addEventListener("compositionstart",this.handleComposition);(i=this.inputRef)===null||i===void 0?void 0:i.addEventListener("compositionend",this.handleComposition)}Object.defineProperty(this.el,"value",{get:function(){var t;return(t=e.inputRef)===null||t===void 0?void 0:t.value},set:function(t){return e.value=t},configurable:true})};e.prototype.disconnectedCallback=function(){var e;if(this.type==="file"){(e=this.inputRef)===null||e===void 0?void 0:e.removeEventListener("change",this.fileListener)}};e.prototype.render=function(){var e=this;var t=this,n=t.value,i=t.type,o=t.password,a=t.placeholder,s=t.autoFocus,u=t.disabled,r=t.maxlength,l=t.confirmType,p=t.name,c=t.nativeProps;return h("input",Object.assign({ref:function(t){e.inputRef=t},class:"weui-input",value:fixControlledValue(n),type:getTrueType(i,l,o),placeholder:a,autoFocus:s,disabled:u,maxlength:r,name:p,onInput:this.handleInput,onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange,onKeyDown:this.handleKeyDown,onPaste:this.handlePaste,onCompositionStart:this.handleComposition,onCompositionEnd:this.handleComposition},c))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{autoFocus:["watchFocus"],value:["watchValue"]}},enumerable:false,configurable:true});return e}();Input.style=indexCss;export{Input as taro_input_core};