| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |   <md-field-item | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     class="md-input-item" | 
					
						
							|  |  |  |     :class="[ | 
					
						
							| 
									
										
										
										
											2018-06-05 18:34:40 +08:00
										 |  |  |       isHighlight ? 'is-highlight' : '', | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       isTitleLatent ? 'is-title-latent' : '', | 
					
						
							| 
									
										
										
										
											2018-08-27 17:19:04 +08:00
										 |  |  |       isInputActive ? 'is-active' : '', | 
					
						
							|  |  |  |       isInputFocus ? 'is-focus' : '', | 
					
						
							| 
									
										
										
										
											2019-03-22 00:11:46 +08:00
										 |  |  |       isInputError() ? 'is-error' : '', | 
					
						
							|  |  |  |       isInputBrief() && !isInputError() ? 'with-brief' : '', | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |       isDisabled ? 'is-disabled': '', | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |       isAmount ? 'is-amount': '', | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       clearable ? 'is-clear' : '', | 
					
						
							|  |  |  |       align, | 
					
						
							|  |  |  |       size | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |     ]" | 
					
						
							|  |  |  |     :title="title" | 
					
						
							| 
									
										
										
										
											2019-04-18 23:57:36 +08:00
										 |  |  |     :solid="solid && !isTitleLatent" | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |   > | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |     <template slot="left"> | 
					
						
							|  |  |  |       <slot name="left"></slot> | 
					
						
							|  |  |  |     </template> | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |     <!-- ------------ --> | 
					
						
							|  |  |  |     <!--    INPUT     --> | 
					
						
							|  |  |  |     <!-- ------------ --> | 
					
						
							|  |  |  |     <!-- Native Input --> | 
					
						
							|  |  |  |     <template v-if="!isVirtualKeyboard"> | 
					
						
							|  |  |  |       <input | 
					
						
							|  |  |  |         class="md-input-item-input" | 
					
						
							|  |  |  |         :type="inputType" | 
					
						
							|  |  |  |         :name="name" | 
					
						
							|  |  |  |         v-model="inputBindValue" | 
					
						
							|  |  |  |         :placeholder="inputPlaceholder" | 
					
						
							|  |  |  |         :disabled="isDisabled" | 
					
						
							|  |  |  |         :readonly="readonly" | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |         :maxlength="isInputFormative ? '' : maxlength" | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |         autocomplete="off" | 
					
						
							|  |  |  |         @focus="$_onFocus" | 
					
						
							|  |  |  |         @blur="$_onBlur" | 
					
						
							|  |  |  |         @keyup="$_onKeyup" | 
					
						
							|  |  |  |         @keydown="$_onKeydown" | 
					
						
							|  |  |  |         @input="$_onInput" | 
					
						
							|  |  |  |       /> | 
					
						
							|  |  |  |     </template> | 
					
						
							|  |  |  |     <!-- Fake Input --> | 
					
						
							|  |  |  |     <template v-else> | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       <div | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |         class="md-input-item-fake" | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         :class="{ | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |           'is-focus': isInputFocus, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |           'is-waiting': !isInputEditing, | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |           'disabled': isDisabled, | 
					
						
							|  |  |  |           'readonly': readonly | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         }" | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |         @click="$_onFakeInputClick" | 
					
						
							|  |  |  |       > | 
					
						
							| 
									
										
										
										
											2024-05-23 15:40:54 +08:00
										 |  |  |         <input class="md-input-item-input" :placeholder="inputPlaceholder" v-model="inputValue"/> | 
					
						
							|  |  |  |         <!-- <span | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |           class="md-input-item-fake-placeholder" | 
					
						
							|  |  |  |           v-if="inputValue === '' && inputPlaceholder !== ''" | 
					
						
							| 
									
										
										
										
											2024-05-23 15:40:54 +08:00
										 |  |  |           v-text="inputPlaceholder"></span> --> | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       </div> | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |     </template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |     <template slot="right"> | 
					
						
							|  |  |  |       <!-- ------------ --> | 
					
						
							|  |  |  |       <!--  CLEART BTN  --> | 
					
						
							|  |  |  |       <!-- ------------ --> | 
					
						
							|  |  |  |       <div | 
					
						
							|  |  |  |         class="md-input-item-clear" | 
					
						
							|  |  |  |         v-if="clearable && !isDisabled && !readonly" | 
					
						
							|  |  |  |         v-show="!isInputEmpty && isInputFocus" | 
					
						
							|  |  |  |         @click="$_clearInput" | 
					
						
							|  |  |  |       > | 
					
						
							| 
									
										
										
										
											2018-10-15 15:41:50 +08:00
										 |  |  |         <md-icon name="clear"></md-icon> | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |       </div> | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |       <!-- ------------ --> | 
					
						
							|  |  |  |       <!--  RIGHT SLOT  --> | 
					
						
							|  |  |  |       <!-- ------------ --> | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |       <slot name="right"></slot> | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |     </template> | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |     <template slot="children"> | 
					
						
							|  |  |  |       <!-- -------------------- --> | 
					
						
							|  |  |  |       <!-- BRIEF/ERROR TIP --> | 
					
						
							|  |  |  |       <!-- -------------------- --> | 
					
						
							|  |  |  |       <div | 
					
						
							| 
									
										
										
										
											2019-03-22 00:11:46 +08:00
										 |  |  |         v-if="isInputError()" | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |         class="md-input-item-msg" | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         <p v-if="error !== ''" v-text="error"></p> | 
					
						
							|  |  |  |         <slot name="error" v-else></slot> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |       <div | 
					
						
							| 
									
										
										
										
											2019-03-22 00:11:46 +08:00
										 |  |  |         v-if="isInputBrief() && !isInputError()" | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |         class="md-input-item-brief" | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         <p v-if="brief !== ''" v-text="brief"></p> | 
					
						
							|  |  |  |         <slot name="brief" v-else></slot> | 
					
						
							|  |  |  |       </div> | 
					
						
							|  |  |  |       <!-- ------------ --> | 
					
						
							|  |  |  |       <!--   KEYBORARD  --> | 
					
						
							|  |  |  |       <!-- ------------ --> | 
					
						
							|  |  |  |       <md-number-keyboard | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |         v-if="isVirtualKeyboard && !virtualKeyboardVm" | 
					
						
							| 
									
										
										
										
											2018-09-20 16:09:53 +08:00
										 |  |  |         ref="number-keyboard" | 
					
						
							|  |  |  |         :id="`${name}-number-keyboard`" | 
					
						
							|  |  |  |         class="md-input-item-number-keyboard" | 
					
						
							|  |  |  |         :ok-text="virtualKeyboardOkText" | 
					
						
							|  |  |  |         :disorder="virtualKeyboardDisorder" | 
					
						
							|  |  |  |       ></md-number-keyboard> | 
					
						
							|  |  |  |     </template> | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |   </md-field-item> | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script>
import Icon from '../icon' | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | import FieldItem from '../field-item' | 
					
						
							| 
									
										
										
										
											2018-07-12 16:04:49 +08:00
										 |  |  | import NumberKeyboard from '../number-keyboard' | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  | import {getCursorsPosition, setCursorsPosition} from './cursor' | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  | import {noop, randomId, debounce} from '../_util' | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  | import {formatValueByGapRule, formatValueByGapStep, trimValue} from '../_util/formate-value' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default { | 
					
						
							|  |  |  |   name: 'md-input-item', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   components: { | 
					
						
							|  |  |  |     [Icon.name]: Icon, | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |     [FieldItem.name]: FieldItem, | 
					
						
							| 
									
										
										
										
											2018-07-12 16:04:49 +08:00
										 |  |  |     [NumberKeyboard.name]: NumberKeyboard, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |   inject: { | 
					
						
							|  |  |  |     rootField: { | 
					
						
							|  |  |  |       from: 'rootField', | 
					
						
							|  |  |  |       default: () => ({}), | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   props: { | 
					
						
							|  |  |  |     type: { | 
					
						
							| 
									
										
										
										
											2018-05-30 12:31:50 +08:00
										 |  |  |       // text, bankCard, password, phone, money, digit
 | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       type: String, | 
					
						
							|  |  |  |       default: 'text', | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |     previewType: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     name: { | 
					
						
							|  |  |  |       type: [String, Number], | 
					
						
							|  |  |  |       default() { | 
					
						
							|  |  |  |         return randomId('input-item') | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     title: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-08-20 15:27:26 +08:00
										 |  |  |     brief: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     value: { | 
					
						
							| 
									
										
										
										
											2018-07-07 17:39:45 +08:00
										 |  |  |       type: [String, Number], | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     placeholder: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     maxlength: { | 
					
						
							|  |  |  |       type: [String, Number], | 
					
						
							|  |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     size: { | 
					
						
							|  |  |  |       // large, normal
 | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: 'normal', | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     align: { | 
					
						
							|  |  |  |       // left, center, right
 | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: 'left', | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     error: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     readonly: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     disabled: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-04-18 23:57:36 +08:00
										 |  |  |     solid: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: true, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     clearable: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     isVirtualKeyboard: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     virtualKeyboardDisorder: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     virtualKeyboardOkText: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |     virtualKeyboardVm: { | 
					
						
							| 
									
										
										
										
											2019-03-15 15:58:15 +08:00
										 |  |  |       type: [Object, String], | 
					
						
							|  |  |  |       default: null, | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     isTitleLatent: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     isFormative: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       default: false, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     isHighlight: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |     isAmount: { | 
					
						
							|  |  |  |       type: Boolean, | 
					
						
							|  |  |  |       default: false, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     formation: { | 
					
						
							|  |  |  |       type: Function, | 
					
						
							|  |  |  |       default: noop, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   data() { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       inputValue: '', | 
					
						
							|  |  |  |       inputBindValue: '', | 
					
						
							|  |  |  |       inputNumberKeyboard: '', | 
					
						
							|  |  |  |       isInputFocus: false, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       isInputEditing: false, | 
					
						
							|  |  |  |       isPreview: false, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   computed: { | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |     inputItemType() { | 
					
						
							|  |  |  |       return (this.isPreview ? this.previewType : this.type) || 'text' | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     inputType() { | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       let inputType = this.inputItemType || 'text' | 
					
						
							| 
									
										
										
										
											2018-05-30 12:31:50 +08:00
										 |  |  |       if (inputType === 'bankCard' || inputType === 'phone' || inputType === 'digit') { | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         inputType = 'tel' | 
					
						
							| 
									
										
										
										
											2019-02-25 18:57:23 +08:00
										 |  |  |       } else if (inputType === 'money') { | 
					
						
							|  |  |  |         inputType = 'text' | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |       return inputType | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     inputMaxLength() { | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       if (this.inputItemType === 'phone') { | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         return 11 | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         return this.maxlength | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-06-25 18:39:53 +08:00
										 |  |  |     inputPlaceholder() { | 
					
						
							|  |  |  |       return this.isTitleLatent && this.isInputActive ? '' : this.placeholder | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     isInputActive() { | 
					
						
							|  |  |  |       return !this.isInputEmpty || this.isInputFocus | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     isInputEmpty() { | 
					
						
							|  |  |  |       return !this.inputValue.length | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |     isInputFormative() { | 
					
						
							|  |  |  |       const type = this.inputItemType | 
					
						
							|  |  |  |       return this.isFormative || (type === 'bankCard' || type === 'phone' || type === 'money' || type === 'digit') | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     isDisabled() { | 
					
						
							|  |  |  |       return this.rootField.disabled || this.disabled | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   watch: { | 
					
						
							|  |  |  |     value(val) { | 
					
						
							| 
									
										
										
										
											2018-12-07 15:59:42 +08:00
										 |  |  |       // Filter out two-way binding
 | 
					
						
							|  |  |  |       if (val !== this.$_trimValue(this.inputValue)) { | 
					
						
							|  |  |  |         this.inputValue = this.$_formateValue(this.$_subValue(val + '')).value | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |     previewType: { | 
					
						
							|  |  |  |       handler(val) { | 
					
						
							|  |  |  |         this.isPreview = !!val | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       immediate: true, | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     inputValue(val) { | 
					
						
							|  |  |  |       this.inputBindValue = val | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       val = this.isInputFormative ? this.$_trimValue(val) : val | 
					
						
							| 
									
										
										
										
											2019-07-29 10:42:02 +08:00
										 |  |  |       if (val !== this.value) { | 
					
						
							|  |  |  |         this.$emit('input', val) | 
					
						
							|  |  |  |         this.$emit('change', this.name, val) | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     isInputFocus(val) { | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |       if (!this.isVirtualKeyboard || !this.inputNumberKeyboard) { | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         return | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if (val) { | 
					
						
							|  |  |  |         this.inputNumberKeyboard.show() | 
					
						
							|  |  |  |         this.$emit('focus', this.name) | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         this.inputNumberKeyboard.hide() | 
					
						
							|  |  |  |         this.$emit('blur', this.name) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   created() { | 
					
						
							| 
									
										
										
										
											2018-07-07 17:39:45 +08:00
										 |  |  |     this.inputValue = this.$_formateValue(this.$_subValue(this.value + '')).value | 
					
						
							| 
									
										
										
										
											2021-01-15 11:05:29 +08:00
										 |  |  |     this.$_stopEditInput = debounce(function() { | 
					
						
							|  |  |  |       this.isInputEditing = false | 
					
						
							|  |  |  |     }, 500) | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   mounted() { | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |     this.isVirtualKeyboard && | 
					
						
							|  |  |  |       this.$nextTick(() => { | 
					
						
							|  |  |  |         this.$_initNumberKeyBoard() | 
					
						
							|  |  |  |       }) | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   }, | 
					
						
							| 
									
										
										
										
											2018-06-06 23:03:07 +08:00
										 |  |  |   beforeDestroy() { | 
					
						
							|  |  |  |     const keyboard = this.inputNumberKeyboard | 
					
						
							|  |  |  |     if (keyboard && keyboard.$el) { | 
					
						
							|  |  |  |       document.body.removeChild(keyboard.$el) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   methods: { | 
					
						
							|  |  |  |     // MARK: private methods
 | 
					
						
							|  |  |  |     $_formateValue(curValue, curPos = 0) { | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       const type = this.inputItemType | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       const name = this.name | 
					
						
							|  |  |  |       const oldValue = this.inputValue | 
					
						
							|  |  |  |       const isAdd = oldValue.length > curValue.length ? -1 : 1 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       let formateValue = {value: curValue, range: curPos} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // no format
 | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       if (!this.isInputFormative || curValue === '') { | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         return formateValue | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // custom format by user
 | 
					
						
							|  |  |  |       const customValue = this.formation(name, curValue, curPos) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (customValue) { | 
					
						
							|  |  |  |         return customValue | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       // default format by component
 | 
					
						
							|  |  |  |       let gap = ' ' | 
					
						
							|  |  |  |       switch (type) { | 
					
						
							|  |  |  |         case 'bankCard': | 
					
						
							|  |  |  |           curValue = this.$_subValue(trimValue(curValue.replace(/\D/g, ''))) | 
					
						
							|  |  |  |           formateValue = formatValueByGapStep(4, curValue, gap, 'left', curPos, isAdd, oldValue) | 
					
						
							|  |  |  |           break | 
					
						
							|  |  |  |         case 'phone': | 
					
						
							|  |  |  |           curValue = this.$_subValue(trimValue(curValue.replace(/\D/g, ''))) | 
					
						
							|  |  |  |           formateValue = formatValueByGapRule('3|4|4', curValue, gap, curPos, isAdd) | 
					
						
							|  |  |  |           break | 
					
						
							|  |  |  |         case 'money': | 
					
						
							|  |  |  |           gap = ',' | 
					
						
							|  |  |  |           curValue = this.$_subValue(trimValue(curValue.replace(/[^\d.]/g, ''))) | 
					
						
							|  |  |  |           // curValue = curValue.replace(/\D/g, '')
 | 
					
						
							|  |  |  |           const dotPos = curValue.indexOf('.') | 
					
						
							|  |  |  |           // format if no dot or new add dot or insert befor dot
 | 
					
						
							|  |  |  |           const moneyCurValue = curValue.split('.')[0] | 
					
						
							|  |  |  |           const moneyCurDecimal = ~dotPos ? `.${curValue.split('.')[1]}` : '' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           formateValue = formatValueByGapStep( | 
					
						
							|  |  |  |             3, | 
					
						
							|  |  |  |             trimValue(moneyCurValue, gap), | 
					
						
							|  |  |  |             gap, | 
					
						
							|  |  |  |             'right', | 
					
						
							|  |  |  |             curPos, | 
					
						
							|  |  |  |             isAdd, | 
					
						
							|  |  |  |             oldValue.split('.')[0], | 
					
						
							|  |  |  |           ) | 
					
						
							|  |  |  |           formateValue.value += moneyCurDecimal | 
					
						
							|  |  |  |           break | 
					
						
							| 
									
										
										
										
											2018-05-30 12:31:50 +08:00
										 |  |  |         case 'digit': | 
					
						
							|  |  |  |           curValue = this.$_subValue(trimValue(curValue.replace(/\D/g, ''))) | 
					
						
							|  |  |  |           formateValue.value = curValue | 
					
						
							|  |  |  |           break | 
					
						
							| 
									
										
										
										
											2019-01-22 17:46:53 +08:00
										 |  |  |         /* istanbul ignore next */ | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         default: | 
					
						
							|  |  |  |           break | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       return formateValue | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-03-22 00:11:46 +08:00
										 |  |  |     isInputError() { | 
					
						
							|  |  |  |       return this.$slots.error || this.error !== '' | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     isInputBrief() { | 
					
						
							|  |  |  |       return this.$slots.brief || this.brief !== '' | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     $_trimValue(val) { | 
					
						
							|  |  |  |       return trimValue(val, '\\s|,') | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_subValue(val) { | 
					
						
							|  |  |  |       const len = this.inputMaxLength | 
					
						
							|  |  |  |       if (len !== '') { | 
					
						
							|  |  |  |         return val.substring(0, len) | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         return val | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |     $_startEditInput() { | 
					
						
							|  |  |  |       this.isInputEditing = true | 
					
						
							|  |  |  |       this.$_stopEditInput() | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2021-01-15 11:05:29 +08:00
										 |  |  |     $_stopEditInput: noop, | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     $_clearInput() { | 
					
						
							|  |  |  |       this.inputValue = '' | 
					
						
							| 
									
										
										
										
											2018-08-27 17:19:04 +08:00
										 |  |  |       !this.isTitleLatent && this.focus() | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       this.isPreview = false | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_stopPreview() { | 
					
						
							|  |  |  |       this.$_clearInput() | 
					
						
							|  |  |  |       this.$emit('update:previewType', '') | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     $_focusFakeInput() { | 
					
						
							|  |  |  |       this.isInputFocus = true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-22 14:32:30 +08:00
										 |  |  |       setTimeout(() => { | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         this.$_addBlurListener() | 
					
						
							| 
									
										
										
										
											2019-02-22 14:32:30 +08:00
										 |  |  |       }, 0) | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     $_blurFakeInput() { | 
					
						
							|  |  |  |       this.isInputFocus = false | 
					
						
							|  |  |  |       this.$_removeBlurListener() | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_addBlurListener() { | 
					
						
							|  |  |  |       document.addEventListener('click', this.$_blurFakeInput, false) | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_removeBlurListener() { | 
					
						
							|  |  |  |       document.removeEventListener('click', this.$_blurFakeInput, false) | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_initNumberKeyBoard() { | 
					
						
							| 
									
										
										
										
											2019-03-15 15:58:15 +08:00
										 |  |  |       let keyboard = | 
					
						
							|  |  |  |         (typeof this.virtualKeyboardVm === 'object' | 
					
						
							|  |  |  |           ? this.virtualKeyboardVm | 
					
						
							|  |  |  |           : this.$vnode.context.$refs[this.virtualKeyboardVm]) || this.$refs['number-keyboard'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (Array.isArray(keyboard)) { | 
					
						
							|  |  |  |         keyboard = keyboard[0] | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |       keyboard.$on('enter', this.$_onNumberKeyBoardEnter) | 
					
						
							|  |  |  |       keyboard.$on('delete', this.$_onNumberKeyBoardDelete) | 
					
						
							|  |  |  |       keyboard.$on('confirm', this.$_onNumberKeyBoardConfirm) | 
					
						
							| 
									
										
										
										
											2018-07-12 16:04:49 +08:00
										 |  |  |       this.inputNumberKeyboard = keyboard | 
					
						
							|  |  |  |       document.body.appendChild(keyboard.$el) | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // MARK: events handler
 | 
					
						
							|  |  |  |     $_onInput(event) { | 
					
						
							| 
									
										
										
										
											2019-01-08 12:05:53 +08:00
										 |  |  |       const formateValue = this.$_formateValue( | 
					
						
							|  |  |  |         event.target.value, | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |         this.isInputFormative ? getCursorsPosition(event.target) : 0, | 
					
						
							| 
									
										
										
										
											2019-01-08 12:05:53 +08:00
										 |  |  |       ) | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |       this.inputValue = formateValue.value | 
					
						
							|  |  |  |       this.inputBindValue = formateValue.value | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       if (this.isInputFormative) { | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         this.$nextTick(() => { | 
					
						
							|  |  |  |           setCursorsPosition(event.target, formateValue.range) | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_onKeyup(event) { | 
					
						
							|  |  |  |       this.$emit('keyup', this.name, event) | 
					
						
							|  |  |  |       if (+event.keyCode === 13 || +event.keyCode === 108) { | 
					
						
							|  |  |  |         this.$emit('confirm', this.name, this.inputValue) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_onKeydown(event) { | 
					
						
							|  |  |  |       this.$emit('keydown', this.name, event) | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       if (!(+event.keyCode === 13 || +event.keyCode === 108)) { | 
					
						
							|  |  |  |         this.$_startEditInput() | 
					
						
							|  |  |  |         this.isPreview && this.$_stopPreview() | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     $_onFocus() { | 
					
						
							|  |  |  |       this.isInputFocus = true | 
					
						
							|  |  |  |       this.$emit('focus', this.name) | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_onBlur() { | 
					
						
							| 
									
										
										
										
											2018-12-14 20:22:26 +08:00
										 |  |  |       setTimeout(() => { | 
					
						
							|  |  |  |         this.isInputFocus = false | 
					
						
							|  |  |  |         this.$emit('blur', this.name) | 
					
						
							|  |  |  |       }, 100) | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     $_onFakeInputClick(event) { | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |       if (this.isDisabled || this.readonly) { | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         return | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       this.$_blurFakeInput() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (!this.isInputFocus) { | 
					
						
							|  |  |  |         this.$_focusFakeInput(event) | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     $_onNumberKeyBoardEnter(val) { | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       if (this.isPreview) { | 
					
						
							|  |  |  |         this.$_stopPreview() | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-08-02 17:11:17 +08:00
										 |  |  |       if (this.inputMaxLength > 0 && this.$_trimValue(this.inputValue).length >= this.inputMaxLength) { | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       this.inputValue = this.$_formateValue(this.inputValue + val).value | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       this.$_startEditInput() | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     $_onNumberKeyBoardDelete() { | 
					
						
							|  |  |  |       const inputValue = this.inputValue | 
					
						
							|  |  |  |       if (inputValue === '') { | 
					
						
							|  |  |  |         return | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       this.inputValue = this.$_formateValue(inputValue.substring(0, inputValue.length - 1)).value | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |       this.$_startEditInput() | 
					
						
							|  |  |  |       if (this.isPreview) { | 
					
						
							|  |  |  |         this.$_stopPreview() | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     $_onNumberKeyBoardConfirm() { | 
					
						
							|  |  |  |       this.$emit('confirm', this.name, this.inputValue) | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // MARK: public methods
 | 
					
						
							|  |  |  |     focus() { | 
					
						
							|  |  |  |       if (this.isVirtualKeyboard) { | 
					
						
							|  |  |  |         this.$_onFakeInputClick() | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         this.$el.querySelector('.md-input-item-input').focus() | 
					
						
							| 
									
										
										
										
											2018-08-27 17:19:04 +08:00
										 |  |  |         setTimeout(() => { | 
					
						
							|  |  |  |           this.isInputFocus = true | 
					
						
							|  |  |  |         }, 200) | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     blur() { | 
					
						
							|  |  |  |       if (this.isVirtualKeyboard) { | 
					
						
							|  |  |  |         this.$_blurFakeInput() | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         this.$el.querySelector('.md-input-item-input').blur() | 
					
						
							| 
									
										
										
										
											2018-08-27 17:19:04 +08:00
										 |  |  |         this.isInputFocus = false | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     getValue() { | 
					
						
							|  |  |  |       return this.inputValue | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
</script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="stylus"> | 
					
						
							|  |  |  | .md-input-item | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |   .md-field-item-content | 
					
						
							|  |  |  |     padding-top 0 | 
					
						
							|  |  |  |     padding-bottom 0 | 
					
						
							|  |  |  |   .md-field-item-control | 
					
						
							|  |  |  |     display flex | 
					
						
							|  |  |  |     align-items center | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-clear | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |   padding 10px 0 | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |   color input-item-icon | 
					
						
							|  |  |  |   .md-icon | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |     display flex | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     background color-bg-base | 
					
						
							|  |  |  |     border-radius radius-circle | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-input, | 
					
						
							|  |  |  | .md-input-item-fake | 
					
						
							|  |  |  |   // display flex
 | 
					
						
							|  |  |  |   width 100% | 
					
						
							|  |  |  |   height input-item-height | 
					
						
							|  |  |  |   color input-item-color | 
					
						
							|  |  |  |   font-size input-item-font-size | 
					
						
							|  |  |  |   font-weight input-item-font-weight | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |   font-family font-family-normal | 
					
						
							|  |  |  |   line-height 1 | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |   -webkit-appearance none | 
					
						
							|  |  |  |   border none | 
					
						
							|  |  |  |   background transparent | 
					
						
							|  |  |  |   outline none | 
					
						
							|  |  |  |   box-sizing border-box | 
					
						
							|  |  |  |   -webkit-tap-highlight-color transparent | 
					
						
							|  |  |  |   appearance none | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-input | 
					
						
							|  |  |  |   &:disabled, &[disabled] | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |     opacity 1 | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |   &::-webkit-input-placeholder | 
					
						
							|  |  |  |     color input-item-placeholder | 
					
						
							|  |  |  |     font-weight font-weight-normal | 
					
						
							|  |  |  |   &::-webkit-outer-spin-button, &::-webkit-inner-spin-button | 
					
						
							|  |  |  |     -webkit-appearance none | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-fake | 
					
						
							|  |  |  |   line-height input-item-height | 
					
						
							|  |  |  |   word-ellipsis() | 
					
						
							|  |  |  |   cursor text | 
					
						
							|  |  |  |   &::after | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |     position relative | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     z-index 2 | 
					
						
							|  |  |  |     display none | 
					
						
							|  |  |  |     content " " | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |     height input-item-font-size-large | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     border-right solid 1.5px color-text-base | 
					
						
							|  |  |  |   &.is-focus:after | 
					
						
							|  |  |  |     display inline | 
					
						
							| 
									
										
										
										
											2019-09-04 15:09:36 +08:00
										 |  |  |   &.is-waiting:after | 
					
						
							|  |  |  |     animation keyboard-cursor infinite 1s step-start | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-fake-placeholder | 
					
						
							|  |  |  |   position absolute | 
					
						
							|  |  |  |   top 0 | 
					
						
							|  |  |  |   left 0 | 
					
						
							|  |  |  |   width 100% | 
					
						
							|  |  |  |   color input-item-placeholder | 
					
						
							|  |  |  |   font-weight font-weight-normal | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-msg, | 
					
						
							|  |  |  | .md-input-item-brief | 
					
						
							|  |  |  |   word-break() | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |   &:not(:last-child) | 
					
						
							|  |  |  |     margin-bottom 10px | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-brief | 
					
						
							|  |  |  |   font-size input-item-font-size-brief | 
					
						
							|  |  |  |   color input-item-color-brief | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .md-input-item-msg | 
					
						
							|  |  |  |   font-size input-item-font-size-error | 
					
						
							|  |  |  |   color input-item-color-error | 
					
						
							| 
									
										
										
										
											2024-05-23 15:40:54 +08:00
										 |  |  |   animation-name errtips | 
					
						
							|  |  |  |   animation-duration 0.5s | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @keyframes errtips { | 
					
						
							|  |  |  |   10% { | 
					
						
							|  |  |  |     transform translateX(4px) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   60% { | 
					
						
							|  |  |  |     transform translateX(-4px) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   100% { | 
					
						
							|  |  |  |     transform translateX(4) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | .md-input-item | 
					
						
							| 
									
										
										
										
											2018-07-12 16:04:49 +08:00
										 |  |  |   &.left | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     .md-input-item-input, | 
					
						
							|  |  |  |     .md-input-item-fake | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       text-align left | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   &.center | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     .md-input-item-input, | 
					
						
							|  |  |  |     .md-input-item-fake | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       text-align center | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   &.right | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     .md-input-item-input, | 
					
						
							|  |  |  |     .md-input-item-fake | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       text-align right | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |   &.is-title-latent | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |     .md-field-item-title | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |       position absolute | 
					
						
							|  |  |  |       top 50% | 
					
						
							|  |  |  |       left 0 | 
					
						
							|  |  |  |       height auto | 
					
						
							|  |  |  |       font-size input-item-title-latent-font-size | 
					
						
							|  |  |  |       color input-item-title-latent-color | 
					
						
							|  |  |  |       transform translate3d(0, -50%, 0) | 
					
						
							|  |  |  |       transition all .3s ease | 
					
						
							|  |  |  |       opacity 0 | 
					
						
							|  |  |  |       will-change auto | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |     .md-field-item-content | 
					
						
							|  |  |  |       min-height 115px | 
					
						
							|  |  |  |     .md-field-item-content, | 
					
						
							| 
									
										
										
										
											2018-12-21 12:06:24 +08:00
										 |  |  |     .md-field-item-left, | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |     .md-field-item-right, | 
					
						
							|  |  |  |     .md-input-item-input, | 
					
						
							|  |  |  |     .md-input-item-fake | 
					
						
							|  |  |  |       padding-top 20px | 
					
						
							| 
									
										
										
										
											2018-08-27 17:19:04 +08:00
										 |  |  |     &.is-active | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |       .md-field-item-title | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  |         opacity 1 | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |         top 20px | 
					
						
							| 
									
										
										
										
											2018-06-25 18:39:53 +08:00
										 |  |  |         transform translate3d(0, 0, 0) | 
					
						
							| 
									
										
										
										
											2018-08-27 17:19:04 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-05 18:34:40 +08:00
										 |  |  |   &.is-highlight | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |     &.is-focus | 
					
						
							|  |  |  |       .md-field-item-content | 
					
						
							|  |  |  |         hairline(bottom, input-item-color-highlight, 0, 4px) | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |   &.is-disabled | 
					
						
							|  |  |  |     .md-input-item-input, | 
					
						
							| 
									
										
										
										
											2019-01-09 15:59:15 +08:00
										 |  |  |     .md-input-item-fake, | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |     .md-input-item-fake-placeholder | 
					
						
							|  |  |  |       -webkit-text-fill-color input-item-color-disabled | 
					
						
							|  |  |  |       color input-item-color-disabled | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |   &.is-amount | 
					
						
							|  |  |  |     .md-input-item-input, | 
					
						
							|  |  |  |     .md-input-item-fake | 
					
						
							|  |  |  |       font-family font-family-number | 
					
						
							|  |  |  |     &.large | 
					
						
							|  |  |  |       .md-input-item-input, | 
					
						
							|  |  |  |       .md-input-item-fake | 
					
						
							| 
									
										
										
										
											2018-12-04 16:39:14 +08:00
										 |  |  |         padding-top v-gap-xs | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   &.large | 
					
						
							|  |  |  |     .md-input-item-input, | 
					
						
							|  |  |  |     .md-input-item-fake | 
					
						
							|  |  |  |       padding-bottom 15px | 
					
						
							|  |  |  |       font-size input-item-font-size-large | 
					
						
							|  |  |  |     .md-input-item-input::-webkit-input-placeholder | 
					
						
							|  |  |  |         font-size 60px | 
					
						
							|  |  |  |         line-height 100px | 
					
						
							| 
									
										
										
										
											2019-02-22 14:32:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-19 01:12:08 +08:00
										 |  |  |   &.is-error | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |     .md-field-item-content | 
					
						
							|  |  |  |       hairline(bottom, input-item-color-error, 0, 4px) | 
					
						
							| 
									
										
										
										
											2018-07-12 16:04:49 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-20 15:27:26 +08:00
										 |  |  |   &.is-ios | 
					
						
							|  |  |  |     .md-input-item-input::-webkit-input-placeholder | 
					
						
							|  |  |  |       position relative | 
					
						
							| 
									
										
										
										
											2018-12-03 19:16:26 +08:00
										 |  |  |       top 3px | 
					
						
							| 
									
										
										
										
											2018-08-20 15:27:26 +08:00
										 |  |  |       overflow visible | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     .md-input-item-fake::after | 
					
						
							| 
									
										
										
										
											2018-08-20 15:27:26 +08:00
										 |  |  |       border-right solid 6px #2C6CF5 | 
					
						
							|  |  |  |       border-radius 2px | 
					
						
							|  |  |  |   &.is-android | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  |     .md-input-item-fake::after | 
					
						
							| 
									
										
										
										
											2018-08-20 15:27:26 +08:00
										 |  |  |       border-right solid 4px color-text-base | 
					
						
							| 
									
										
										
										
											2019-08-13 11:42:27 +08:00
										 |  |  |     .md-input-item-input, | 
					
						
							|  |  |  |     .md-input-item-fake | 
					
						
							|  |  |  |       font-weight input-item-font-weight-android | 
					
						
							| 
									
										
										
										
											2018-07-12 16:04:49 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-16 13:05:04 +08:00
										 |  |  | @-webkit-keyframes keyboard-cursor | 
					
						
							|  |  |  |   0% | 
					
						
							|  |  |  |     opacity 1 | 
					
						
							|  |  |  |   50% | 
					
						
							|  |  |  |     opacity 0 | 
					
						
							|  |  |  |   to | 
					
						
							|  |  |  |     opacity 1 | 
					
						
							|  |  |  | @keyframes keyboard-cursor | 
					
						
							|  |  |  |   0% | 
					
						
							|  |  |  |     opacity 1 | 
					
						
							|  |  |  |   50% | 
					
						
							|  |  |  |     opacity 0 | 
					
						
							|  |  |  |   to | 
					
						
							|  |  |  |     opacity 1 | 
					
						
							| 
									
										
										
										
											2018-03-26 16:04:04 +08:00
										 |  |  | </style> |