mirror of https://github.com/ElemeFE/element
Merge remote-tracking branch 'eleme/dev' into carbon
# Conflicts: # packages/input/src/calcTextareaHeight.js # packages/message-box/src/main.vue # packages/theme-default/src/menu.css # yarn.lockpull/7605/head
commit
fa140dea9c
|
@ -51,7 +51,7 @@
|
||||||
"unpkg": "lib/index.js",
|
"unpkg": "lib/index.js",
|
||||||
"style": "lib/theme-chalk/index.css",
|
"style": "lib/theme-chalk/index.css",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async-validator": "1.6.9",
|
"async-validator": "~1.8.1",
|
||||||
"babel-helper-vue-jsx-merge-props": "^2.0.0",
|
"babel-helper-vue-jsx-merge-props": "^2.0.0",
|
||||||
"deepmerge": "^1.2.0",
|
"deepmerge": "^1.2.0",
|
||||||
"throttle-debounce": "^1.0.1"
|
"throttle-debounce": "^1.0.1"
|
||||||
|
|
|
@ -52,7 +52,7 @@ function calculateNodeStyling(targetElement) {
|
||||||
|
|
||||||
export default function calcTextareaHeight(
|
export default function calcTextareaHeight(
|
||||||
targetElement,
|
targetElement,
|
||||||
minRows = null,
|
minRows = 1,
|
||||||
maxRows = null
|
maxRows = null
|
||||||
) {
|
) {
|
||||||
if (!hiddenTextarea) {
|
if (!hiddenTextarea) {
|
||||||
|
@ -71,6 +71,7 @@ export default function calcTextareaHeight(
|
||||||
hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
|
hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
|
||||||
|
|
||||||
let height = hiddenTextarea.scrollHeight;
|
let height = hiddenTextarea.scrollHeight;
|
||||||
|
const result = {};
|
||||||
|
|
||||||
if (boxSizing === 'border-box') {
|
if (boxSizing === 'border-box') {
|
||||||
height = height + borderSize;
|
height = height + borderSize;
|
||||||
|
@ -87,6 +88,7 @@ export default function calcTextareaHeight(
|
||||||
minHeight = minHeight + paddingSize + borderSize;
|
minHeight = minHeight + paddingSize + borderSize;
|
||||||
}
|
}
|
||||||
height = Math.max(minHeight, height);
|
height = Math.max(minHeight, height);
|
||||||
|
result.minHeight = `${ minHeight }px`;
|
||||||
}
|
}
|
||||||
if (maxRows !== null) {
|
if (maxRows !== null) {
|
||||||
let maxHeight = singleRowHeight * maxRows;
|
let maxHeight = singleRowHeight * maxRows;
|
||||||
|
@ -95,7 +97,8 @@ export default function calcTextareaHeight(
|
||||||
}
|
}
|
||||||
height = Math.min(maxHeight, height);
|
height = Math.min(maxHeight, height);
|
||||||
}
|
}
|
||||||
|
result.height = `${ height }px`;
|
||||||
hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
|
hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
|
||||||
hiddenTextarea = null;
|
hiddenTextarea = null;
|
||||||
return { height: height + 'px'};
|
return result;
|
||||||
};
|
};
|
||||||
|
|
|
@ -198,7 +198,13 @@
|
||||||
resizeTextarea() {
|
resizeTextarea() {
|
||||||
if (this.$isServer) return;
|
if (this.$isServer) return;
|
||||||
var { autosize, type } = this;
|
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 minRows = autosize.minRows;
|
||||||
const maxRows = autosize.maxRows;
|
const maxRows = autosize.maxRows;
|
||||||
|
|
||||||
|
|
|
@ -215,7 +215,10 @@
|
||||||
this.openedMenus.push(index);
|
this.openedMenus.push(index);
|
||||||
},
|
},
|
||||||
closeMenu(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) {
|
handleSubmenuClick(submenu) {
|
||||||
const { index, indexPath } = submenu;
|
const { index, indexPath } = submenu;
|
||||||
|
|
|
@ -34,7 +34,14 @@
|
||||||
</slot>
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="el-message-box__input" v-show="showInput">
|
<div class="el-message-box__input" v-show="showInput">
|
||||||
<el-input v-model="inputValue" @keyup.enter.native="handleAction('confirm')" :placeholder="inputPlaceholder" ref="input"></el-input>
|
<el-input
|
||||||
|
v-model="inputValue"
|
||||||
|
@compositionstart.native="handleComposition"
|
||||||
|
@compositionupdate.native="handleComposition"
|
||||||
|
@compositionend.native="handleComposition"
|
||||||
|
@keyup.enter.native="handleKeyup"
|
||||||
|
:placeholder="inputPlaceholder"
|
||||||
|
ref="input"></el-input>
|
||||||
<div class="el-message-box__errormsg" :style="{ visibility: !!editorErrorMessage ? 'visible' : 'hidden' }">{{ editorErrorMessage }}</div>
|
<div class="el-message-box__errormsg" :style="{ visibility: !!editorErrorMessage ? 'visible' : 'hidden' }">{{ editorErrorMessage }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -137,6 +144,18 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
handleComposition(event) {
|
||||||
|
if (event.type === 'compositionend') {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isOnComposition = false;
|
||||||
|
}, 100);
|
||||||
|
} else {
|
||||||
|
this.isOnComposition = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleKeyup() {
|
||||||
|
!this.isOnComposition && this.handleAction('confirm');
|
||||||
|
},
|
||||||
getSafeClose() {
|
getSafeClose() {
|
||||||
const currentId = this.uid;
|
const currentId = this.uid;
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -304,7 +323,8 @@
|
||||||
editorErrorMessage: null,
|
editorErrorMessage: null,
|
||||||
callback: null,
|
callback: null,
|
||||||
dangerouslyUseHTMLString: false,
|
dangerouslyUseHTMLString: false,
|
||||||
focusAfterClosed: null
|
focusAfterClosed: null,
|
||||||
|
isOnComposition: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -266,6 +266,12 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
disabled() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.resetInputHeight();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
placeholder(val) {
|
placeholder(val) {
|
||||||
this.cachedPlaceHolder = this.currentPlaceholder = val;
|
this.cachedPlaceHolder = this.currentPlaceholder = val;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue