Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@soramitsu/soramitsu-js-ui",
"version": "0.7.3",
"version": "0.7.4",
"private": false,
"publishConfig": {
"registry": "https://nexus.iroha.tech/repository/npm-soramitsu-private/"
Expand Down
27 changes: 10 additions & 17 deletions src/components/Input/SInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
class="s-input"
:class="computedClasses"
>
<span v-if="model && !isMediumInput" class="s-placeholder">{{ placeholder }}</span>
<span v-if="value && !isMediumInput" class="s-placeholder">{{ placeholder }}</span>
<el-input
ref="el-input"
:value="value"
:type="computedType"
:placeholder="placeholder"
v-model="model"
:disabled="disabled"
:show-password="showPassword && isTextInput"
:readonly="readonly"
Expand All @@ -27,9 +27,9 @@
:suffix-icon="suffix"
@input="handleInput"
@change="handleChange"
@paste="handlePaste"
@blur="handleBlur"
@focus="handleFocus"
@paste.native="handlePaste"
/>
<template v-if="type === InputType.TEXT_FILE">
<i class="s-icon-file-upload"></i>
Expand Down Expand Up @@ -138,7 +138,6 @@ export default class SInput extends Mixins(BorderRadiusMixin) {

focused = false
autofill = false
model = this.value

mounted (): void {
this.$el.addEventListener('animationstart', this.changeAutofillValue)
Expand All @@ -152,17 +151,6 @@ export default class SInput extends Mixins(BorderRadiusMixin) {
this.autofill = e.animationName === 'onAutoFillStart'
}

@Watch('value')
private handlePropChange (value: string | number): void {
this.model = value
}

@Watch('model')
private handleValueChange (value: string | number): void {
this.$emit('input', value)
this.$emit('change', value)
}

get isTextInput (): boolean {
return this.type === InputType.TEXT
}
Expand Down Expand Up @@ -223,7 +211,10 @@ export default class SInput extends Mixins(BorderRadiusMixin) {
this.$emit('change', value)
}

handlePaste (value: string | number): void {
handlePaste (event: ClipboardEvent): void {
if (!event || !event.clipboardData) return

const value = event.clipboardData.getData('text')
this.$emit('paste', value)
}

Expand Down Expand Up @@ -254,7 +245,9 @@ export default class SInput extends Mixins(BorderRadiusMixin) {
const file = input.files[0]
const fr = new FileReader()
fr.onload = (event: ProgressEvent<FileReader>) => {
this.model = ((event.target || {}).result as string)
const result = (event.target || {}).result as string
this.handleInput(result)
this.handleChange(result)
}
fr.readAsText(file)
}
Expand Down