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",
 | 
			
		||||
  "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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,14 @@
 | 
			
		|||
            </slot>
 | 
			
		||||
          </div>
 | 
			
		||||
          <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>
 | 
			
		||||
        </div>
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -266,6 +266,12 @@
 | 
			
		|||
    },
 | 
			
		||||
 | 
			
		||||
    watch: {
 | 
			
		||||
      disabled() {
 | 
			
		||||
        this.$nextTick(() => {
 | 
			
		||||
          this.resetInputHeight();
 | 
			
		||||
        });
 | 
			
		||||
      },
 | 
			
		||||
 | 
			
		||||
      placeholder(val) {
 | 
			
		||||
        this.cachedPlaceHolder = this.currentPlaceholder = val;
 | 
			
		||||
      },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue