diff --git a/package.json b/package.json index a4e42208e..95ea81f3c 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "unpkg": "lib/index.js", "style": "lib/theme-chalk/index.css", "dependencies": { - "async-validator": "1.6.9", + "async-validator": "~1.8.1", "babel-helper-vue-jsx-merge-props": "^2.0.0", "deepmerge": "^1.2.0", "throttle-debounce": "^1.0.1" diff --git a/packages/input/src/calcTextareaHeight.js b/packages/input/src/calcTextareaHeight.js index f2be3359a..39f3dc251 100644 --- a/packages/input/src/calcTextareaHeight.js +++ b/packages/input/src/calcTextareaHeight.js @@ -52,7 +52,7 @@ function calculateNodeStyling(targetElement) { export default function calcTextareaHeight( targetElement, - minRows = null, + minRows = 1, maxRows = null ) { if (!hiddenTextarea) { @@ -71,6 +71,7 @@ export default function calcTextareaHeight( hiddenTextarea.value = targetElement.value || targetElement.placeholder || ''; let height = hiddenTextarea.scrollHeight; + const result = {}; if (boxSizing === 'border-box') { height = height + borderSize; @@ -87,6 +88,7 @@ export default function calcTextareaHeight( minHeight = minHeight + paddingSize + borderSize; } height = Math.max(minHeight, height); + result.minHeight = `${ minHeight }px`; } if (maxRows !== null) { let maxHeight = singleRowHeight * maxRows; @@ -95,7 +97,8 @@ export default function calcTextareaHeight( } height = Math.min(maxHeight, height); } + result.height = `${ height }px`; hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea); hiddenTextarea = null; - return { height: height + 'px'}; + return result; }; diff --git a/packages/input/src/input.vue b/packages/input/src/input.vue index 0f39dbf4c..691310374 100644 --- a/packages/input/src/input.vue +++ b/packages/input/src/input.vue @@ -198,7 +198,13 @@ resizeTextarea() { if (this.$isServer) return; var { autosize, type } = this; - if (!autosize || type !== 'textarea') return; + if (type !== 'textarea') return; + if (!autosize) { + this.textareaCalcStyle = { + minHeight: calcTextareaHeight(this.$refs.textarea).minHeight + }; + return; + } const minRows = autosize.minRows; const maxRows = autosize.maxRows; diff --git a/packages/menu/src/menu.vue b/packages/menu/src/menu.vue index 00d55229c..4b78ba1e3 100644 --- a/packages/menu/src/menu.vue +++ b/packages/menu/src/menu.vue @@ -215,7 +215,10 @@ this.openedMenus.push(index); }, closeMenu(index) { - this.openedMenus.splice(this.openedMenus.indexOf(index), 1); + const i = this.openedMenus.indexOf(index); + if (i !== -1) { + this.openedMenus.splice(i, 1); + } }, handleSubmenuClick(submenu) { const { index, indexPath } = submenu; diff --git a/packages/message-box/src/main.vue b/packages/message-box/src/main.vue index 45129988b..fbbcbb679 100644 --- a/packages/message-box/src/main.vue +++ b/packages/message-box/src/main.vue @@ -34,7 +34,14 @@
- +
{{ editorErrorMessage }}
@@ -137,6 +144,18 @@ }, methods: { + handleComposition(event) { + if (event.type === 'compositionend') { + setTimeout(() => { + this.isOnComposition = false; + }, 100); + } else { + this.isOnComposition = true; + } + }, + handleKeyup() { + !this.isOnComposition && this.handleAction('confirm'); + }, getSafeClose() { const currentId = this.uid; return () => { @@ -304,7 +323,8 @@ editorErrorMessage: null, callback: null, dangerouslyUseHTMLString: false, - focusAfterClosed: null + focusAfterClosed: null, + isOnComposition: false }; } }; diff --git a/packages/select/src/select.vue b/packages/select/src/select.vue index 8596e6c7e..9733df4d2 100644 --- a/packages/select/src/select.vue +++ b/packages/select/src/select.vue @@ -266,6 +266,12 @@ }, watch: { + disabled() { + this.$nextTick(() => { + this.resetInputHeight(); + }); + }, + placeholder(val) { this.cachedPlaceHolder = this.currentPlaceholder = val; },