perf: update vc-xxx $emit to __emit
parent
f2a0feebee
commit
a50dba12aa
|
@ -1 +1 @@
|
||||||
Subproject commit dd3e7a8023c35c197ff9e3fd754d6d4f8a3fc852
|
Subproject commit 5dfdfff5b84743a979ff315bd6d44fe9810e0dc0
|
|
@ -227,7 +227,7 @@ const Calendar = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('blur', event);
|
this.__emit('blur', event);
|
||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ export default {
|
||||||
handleChange(options, setProps, e) {
|
handleChange(options, setProps, e) {
|
||||||
if (e.type !== 'keydown' || e.keyCode === KeyCode.ENTER) {
|
if (e.type !== 'keydown' || e.keyCode === KeyCode.ENTER) {
|
||||||
const value = options.map(o => o[this.getFieldName('value')]);
|
const value = options.map(o => o[this.getFieldName('value')]);
|
||||||
this.$emit('update:value', value);
|
this.__emit('update:value', value);
|
||||||
this.__emit('change', value, options);
|
this.__emit('change', value, options);
|
||||||
this.setPopupVisible(setProps.visible);
|
this.setPopupVisible(setProps.visible);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,12 +82,12 @@ export default {
|
||||||
},
|
},
|
||||||
nativeEvent: e,
|
nativeEvent: e,
|
||||||
};
|
};
|
||||||
this.$emit('update:checked', eventObj);
|
this.__emit('update:checked', eventObj);
|
||||||
this.$emit('change', eventObj);
|
this.__emit('change', eventObj);
|
||||||
this.eventShiftKey = false;
|
this.eventShiftKey = false;
|
||||||
},
|
},
|
||||||
onClick(e) {
|
onClick(e) {
|
||||||
this.$emit('click', e);
|
this.__emit('click', e);
|
||||||
// onChange没能获取到shiftKey,使用onClick hack
|
// onChange没能获取到shiftKey,使用onClick hack
|
||||||
this.eventShiftKey = e.shiftKey;
|
this.eventShiftKey = e.shiftKey;
|
||||||
},
|
},
|
||||||
|
|
|
@ -118,8 +118,8 @@ export default {
|
||||||
},
|
},
|
||||||
setActiveKey(activeKey) {
|
setActiveKey(activeKey) {
|
||||||
this.setState({ stateActiveKey: activeKey });
|
this.setState({ stateActiveKey: activeKey });
|
||||||
this.$emit('change', this.accordion ? activeKey[0] : activeKey);
|
this.__emit('change', this.accordion ? activeKey[0] : activeKey);
|
||||||
this.$emit('update:activeKey', this.accordion ? activeKey[0] : activeKey);
|
this.__emit('update:activeKey', this.accordion ? activeKey[0] : activeKey);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -2,9 +2,11 @@ import PanelContent from './PanelContent';
|
||||||
import { initDefaultProps, getComponent, getSlot } from '../../_util/props-util';
|
import { initDefaultProps, getComponent, getSlot } from '../../_util/props-util';
|
||||||
import { panelProps } from './commonProps';
|
import { panelProps } from './commonProps';
|
||||||
import { Transition } from 'vue';
|
import { Transition } from 'vue';
|
||||||
|
import BaseMixin from '../../_util/BaseMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Panel',
|
name: 'Panel',
|
||||||
|
mixins: [BaseMixin],
|
||||||
props: initDefaultProps(panelProps(), {
|
props: initDefaultProps(panelProps(), {
|
||||||
showArrow: true,
|
showArrow: true,
|
||||||
isActive: false,
|
isActive: false,
|
||||||
|
@ -14,7 +16,7 @@ export default {
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
handleItemClick() {
|
handleItemClick() {
|
||||||
this.$emit('itemClick', this.panelKey);
|
this.__emit('itemClick', this.panelKey);
|
||||||
},
|
},
|
||||||
handleKeyPress(e) {
|
handleKeyPress(e) {
|
||||||
if (e.key === 'Enter' || e.keyCode === 13 || e.which === 13) {
|
if (e.key === 'Enter' || e.keyCode === 13 || e.which === 13) {
|
||||||
|
|
|
@ -146,15 +146,15 @@ const Drawer = {
|
||||||
onKeyDown(e) {
|
onKeyDown(e) {
|
||||||
if (e.keyCode === KeyCode.ESC) {
|
if (e.keyCode === KeyCode.ESC) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
this.$emit('close', e);
|
this.__emit('close', e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onMaskTouchEnd(e) {
|
onMaskTouchEnd(e) {
|
||||||
this.$emit('close', e);
|
this.__emit('close', e);
|
||||||
this.onTouchEnd(e, true);
|
this.onTouchEnd(e, true);
|
||||||
},
|
},
|
||||||
onIconTouchEnd(e) {
|
onIconTouchEnd(e) {
|
||||||
this.$emit('handleClick', e);
|
this.__emit('handleClick', e);
|
||||||
this.onTouchEnd(e);
|
this.onTouchEnd(e);
|
||||||
},
|
},
|
||||||
onTouchEnd(e, close) {
|
onTouchEnd(e, close) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ export default {
|
||||||
sVisible: false,
|
sVisible: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('overlayClick', e);
|
this.__emit('overlayClick', e);
|
||||||
if (overlayProps.onClick) {
|
if (overlayProps.onClick) {
|
||||||
overlayProps.onClick(e);
|
overlayProps.onClick(e);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ export default {
|
||||||
sVisible: visible,
|
sVisible: visible,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('update:visible', visible);
|
this.__emit('update:visible', visible);
|
||||||
this.__emit('visibleChange', visible);
|
this.__emit('visibleChange', visible);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -160,8 +160,8 @@ export default {
|
||||||
typeof nextValue === 'number' &&
|
typeof nextValue === 'number' &&
|
||||||
nextValue > max
|
nextValue > max
|
||||||
) {
|
) {
|
||||||
this.$emit('update:value', max);
|
this.__emit('update:value', max);
|
||||||
this.$emit('change', max);
|
this.__emit('change', max);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
'min' in props &&
|
'min' in props &&
|
||||||
|
@ -169,8 +169,8 @@ export default {
|
||||||
typeof nextValue === 'number' &&
|
typeof nextValue === 'number' &&
|
||||||
nextValue < min
|
nextValue < min
|
||||||
) {
|
) {
|
||||||
this.$emit('update:value', min);
|
this.__emit('update:value', min);
|
||||||
this.$emit('change', min);
|
this.__emit('change', min);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.prevProps = { ...props };
|
this.prevProps = { ...props };
|
||||||
|
@ -254,19 +254,19 @@ export default {
|
||||||
this.down(e, ratio);
|
this.down(e, ratio);
|
||||||
this.stop();
|
this.stop();
|
||||||
} else if (e.keyCode === KeyCode.ENTER) {
|
} else if (e.keyCode === KeyCode.ENTER) {
|
||||||
this.$emit('pressEnter', e);
|
this.__emit('pressEnter', e);
|
||||||
}
|
}
|
||||||
// Trigger user key down
|
// Trigger user key down
|
||||||
this.recordCursorPosition();
|
this.recordCursorPosition();
|
||||||
this.lastKeyCode = e.keyCode;
|
this.lastKeyCode = e.keyCode;
|
||||||
this.$emit('keydown', e, ...args);
|
this.__emit('keydown', e, ...args);
|
||||||
},
|
},
|
||||||
onKeyUp(e, ...args) {
|
onKeyUp(e, ...args) {
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
||||||
this.recordCursorPosition();
|
this.recordCursorPosition();
|
||||||
|
|
||||||
this.$emit('keyup', e, ...args);
|
this.__emit('keyup', e, ...args);
|
||||||
},
|
},
|
||||||
onChange(e) {
|
onChange(e) {
|
||||||
if (this.focused) {
|
if (this.focused) {
|
||||||
|
@ -275,14 +275,14 @@ export default {
|
||||||
this.rawInput = this.parser(this.getValueFromEvent(e));
|
this.rawInput = this.parser(this.getValueFromEvent(e));
|
||||||
this.setState({ inputValue: this.rawInput });
|
this.setState({ inputValue: this.rawInput });
|
||||||
const num = this.toNumber(this.rawInput); // valid number or invalid string
|
const num = this.toNumber(this.rawInput); // valid number or invalid string
|
||||||
this.$emit('update:value', num);
|
this.__emit('update:value', num);
|
||||||
this.$emit('change', num);
|
this.__emit('change', num);
|
||||||
},
|
},
|
||||||
onFocus(...args) {
|
onFocus(...args) {
|
||||||
this.setState({
|
this.setState({
|
||||||
focused: true,
|
focused: true,
|
||||||
});
|
});
|
||||||
this.$emit('focus', ...args);
|
this.__emit('focus', ...args);
|
||||||
},
|
},
|
||||||
onBlur(...args) {
|
onBlur(...args) {
|
||||||
this.inputting = false;
|
this.inputting = false;
|
||||||
|
@ -295,7 +295,7 @@ export default {
|
||||||
const originValue = this.inputRef.value;
|
const originValue = this.inputRef.value;
|
||||||
const inputValue = this.getInputDisplayValue({ focused: false, sValue: newValue });
|
const inputValue = this.getInputDisplayValue({ focused: false, sValue: newValue });
|
||||||
this.inputRef.value = inputValue;
|
this.inputRef.value = inputValue;
|
||||||
this.$emit('blur', ...args);
|
this.__emit('blur', ...args);
|
||||||
this.inputRef.value = originValue;
|
this.inputRef.value = originValue;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -372,8 +372,8 @@ export default {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (changed) {
|
if (changed) {
|
||||||
this.$emit('update:value', newValue);
|
this.__emit('update:value', newValue);
|
||||||
this.$emit('change', newValue);
|
this.__emit('change', newValue);
|
||||||
}
|
}
|
||||||
return newValue;
|
return newValue;
|
||||||
},
|
},
|
||||||
|
@ -621,7 +621,7 @@ export default {
|
||||||
this.stepFn('up', e, ratio, recursive);
|
this.stepFn('up', e, ratio, recursive);
|
||||||
},
|
},
|
||||||
handleInputClick() {
|
handleInputClick() {
|
||||||
this.$emit('click');
|
this.__emit('click');
|
||||||
},
|
},
|
||||||
saveUp(node) {
|
saveUp(node) {
|
||||||
this.upHandlerRef = node;
|
this.upHandlerRef = node;
|
||||||
|
|
|
@ -60,7 +60,7 @@ const Mentions = {
|
||||||
} else {
|
} else {
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
}
|
}
|
||||||
this.$emit('change', value);
|
this.__emit('change', value);
|
||||||
},
|
},
|
||||||
onChange({ target: { value, composing }, isComposing }) {
|
onChange({ target: { value, composing }, isComposing }) {
|
||||||
if (isComposing || composing) return;
|
if (isComposing || composing) return;
|
||||||
|
@ -143,7 +143,7 @@ const Mentions = {
|
||||||
* If met `space` means user finished searching.
|
* If met `space` means user finished searching.
|
||||||
*/
|
*/
|
||||||
if (validateMeasure) {
|
if (validateMeasure) {
|
||||||
this.$emit('search', measureText, measurePrefix);
|
this.__emit('search', measureText, measurePrefix);
|
||||||
}
|
}
|
||||||
} else if (measuring) {
|
} else if (measuring) {
|
||||||
this.stopMeasure();
|
this.stopMeasure();
|
||||||
|
@ -165,7 +165,7 @@ const Mentions = {
|
||||||
window.clearTimeout(this.focusId);
|
window.clearTimeout(this.focusId);
|
||||||
const { isFocus } = this.$data;
|
const { isFocus } = this.$data;
|
||||||
if (!isFocus && event) {
|
if (!isFocus && event) {
|
||||||
this.$emit('focus', event);
|
this.__emit('focus', event);
|
||||||
}
|
}
|
||||||
this.setState({ isFocus: true });
|
this.setState({ isFocus: true });
|
||||||
},
|
},
|
||||||
|
@ -173,7 +173,7 @@ const Mentions = {
|
||||||
this.focusId = window.setTimeout(() => {
|
this.focusId = window.setTimeout(() => {
|
||||||
this.setState({ isFocus: false });
|
this.setState({ isFocus: false });
|
||||||
this.stopMeasure();
|
this.stopMeasure();
|
||||||
this.$emit('blur', event);
|
this.__emit('blur', event);
|
||||||
}, 100);
|
}, 100);
|
||||||
},
|
},
|
||||||
selectOption(option) {
|
selectOption(option) {
|
||||||
|
@ -193,7 +193,7 @@ const Mentions = {
|
||||||
setInputSelection(this.$refs.textarea, selectionLocation);
|
setInputSelection(this.$refs.textarea, selectionLocation);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$emit('select', option, measurePrefix);
|
this.__emit('select', option, measurePrefix);
|
||||||
},
|
},
|
||||||
setActiveIndex(activeIndex) {
|
setActiveIndex(activeIndex) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Pager',
|
name: 'Pager',
|
||||||
|
mixins: [BaseMixin],
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
props: {
|
props: {
|
||||||
rootPrefixCls: PropTypes.string,
|
rootPrefixCls: PropTypes.string,
|
||||||
|
@ -18,10 +20,10 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleClick() {
|
handleClick() {
|
||||||
this.$emit('click', this.page);
|
this.__emit('click', this.page);
|
||||||
},
|
},
|
||||||
handleKeyPress(event) {
|
handleKeyPress(event) {
|
||||||
this.$emit('keypress', event, this.handleClick, this.page);
|
this.__emit('keypress', event, this.handleClick, this.page);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -234,10 +234,10 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$emit('update:pageSize', size);
|
this.__emit('update:pageSize', size);
|
||||||
this.$emit('showSizeChange', current, size);
|
this.__emit('showSizeChange', current, size);
|
||||||
if (current !== preCurrent) {
|
if (current !== preCurrent) {
|
||||||
this.$emit('update:current', current);
|
this.__emit('update:current', current);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleChange(p) {
|
handleChange(p) {
|
||||||
|
@ -256,9 +256,9 @@ export default {
|
||||||
stateCurrentInputValue: page,
|
stateCurrentInputValue: page,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// this.$emit('input', page)
|
// this.__emit('input', page)
|
||||||
this.$emit('update:current', page);
|
this.__emit('update:current', page);
|
||||||
this.$emit('change', page, this.statePageSize);
|
this.__emit('change', page, this.statePageSize);
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
return this.stateCurrent;
|
return this.stateCurrent;
|
||||||
|
|
|
@ -71,14 +71,14 @@ export default {
|
||||||
cleanedValue: null,
|
cleanedValue: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('hoverChange', hoverValue);
|
this.__emit('hoverChange', hoverValue);
|
||||||
},
|
},
|
||||||
onMouseLeave() {
|
onMouseLeave() {
|
||||||
this.setState({
|
this.setState({
|
||||||
hoverValue: undefined,
|
hoverValue: undefined,
|
||||||
cleanedValue: null,
|
cleanedValue: null,
|
||||||
});
|
});
|
||||||
this.$emit('hoverChange', undefined);
|
this.__emit('hoverChange', undefined);
|
||||||
},
|
},
|
||||||
onClick(event, index) {
|
onClick(event, index) {
|
||||||
const { allowClear, sValue: value } = this;
|
const { allowClear, sValue: value } = this;
|
||||||
|
@ -97,13 +97,13 @@ export default {
|
||||||
this.setState({
|
this.setState({
|
||||||
focused: true,
|
focused: true,
|
||||||
});
|
});
|
||||||
this.$emit('focus');
|
this.__emit('focus');
|
||||||
},
|
},
|
||||||
onBlur() {
|
onBlur() {
|
||||||
this.setState({
|
this.setState({
|
||||||
focused: false,
|
focused: false,
|
||||||
});
|
});
|
||||||
this.$emit('blur');
|
this.__emit('blur');
|
||||||
},
|
},
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
const { keyCode } = event;
|
const { keyCode } = event;
|
||||||
|
@ -126,7 +126,7 @@ export default {
|
||||||
this.changeValue(sValue);
|
this.changeValue(sValue);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
this.$emit('keydown', event);
|
this.__emit('keydown', event);
|
||||||
},
|
},
|
||||||
getStarDOM(index) {
|
getStarDOM(index) {
|
||||||
return this.$refs['stars' + index].$el;
|
return this.$refs['stars' + index].$el;
|
||||||
|
@ -159,8 +159,8 @@ export default {
|
||||||
sValue: value,
|
sValue: value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('update:value', value);
|
this.__emit('update:value', value);
|
||||||
this.$emit('change', value);
|
this.__emit('change', value);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -21,11 +21,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
onHover(e) {
|
onHover(e) {
|
||||||
const { index } = this;
|
const { index } = this;
|
||||||
this.$emit('hover', e, index);
|
this.__emit('hover', e, index);
|
||||||
},
|
},
|
||||||
onClick(e) {
|
onClick(e) {
|
||||||
const { index } = this;
|
const { index } = this;
|
||||||
this.$emit('click', e, index);
|
this.__emit('click', e, index);
|
||||||
},
|
},
|
||||||
onKeyDown(e) {
|
onKeyDown(e) {
|
||||||
const { index } = this.$props;
|
const { index } = this.$props;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
// based on rc-resize-observer 0.1.3
|
// based on rc-resize-observer 0.1.3
|
||||||
import ResizeObserver from 'resize-observer-polyfill';
|
import ResizeObserver from 'resize-observer-polyfill';
|
||||||
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
|
|
||||||
// Still need to be compatible with React 15, we use class component here
|
// Still need to be compatible with React 15, we use class component here
|
||||||
const VueResizeObserver = {
|
const VueResizeObserver = {
|
||||||
name: 'ResizeObserver',
|
name: 'ResizeObserver',
|
||||||
|
mixins: [BaseMixin],
|
||||||
props: {
|
props: {
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
onResize: Function,
|
onResize: Function,
|
||||||
|
@ -66,7 +68,7 @@ const VueResizeObserver = {
|
||||||
const size = { width: fixedWidth, height: fixedHeight };
|
const size = { width: fixedWidth, height: fixedHeight };
|
||||||
this.width = fixedWidth;
|
this.width = fixedWidth;
|
||||||
this.height = fixedHeight;
|
this.height = fixedHeight;
|
||||||
this.$emit('resize', size);
|
this.__emit('resize', size);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -733,7 +733,7 @@ const Select = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setOpenState(false);
|
this.setOpenState(false);
|
||||||
this.$emit('blur', this.getVLForOnChange(value));
|
this.__emit('blur', this.getVLForOnChange(value));
|
||||||
}, 200);
|
}, 200);
|
||||||
},
|
},
|
||||||
inputFocus(e) {
|
inputFocus(e) {
|
||||||
|
@ -868,7 +868,7 @@ const Select = {
|
||||||
this.forcePopupAlign,
|
this.forcePopupAlign,
|
||||||
);
|
);
|
||||||
if (fireSearch) {
|
if (fireSearch) {
|
||||||
this.$emit('search', inputValue);
|
this.__emit('search', inputValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -981,7 +981,7 @@ const Select = {
|
||||||
this.focusTimer = window.setTimeout(() => {
|
this.focusTimer = window.setTimeout(() => {
|
||||||
// this._focused = true
|
// this._focused = true
|
||||||
// this.updateFocusClassName()
|
// this.updateFocusClassName()
|
||||||
this.$emit('focus');
|
this.__emit('focus');
|
||||||
}, 10);
|
}, 10);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1055,7 +1055,7 @@ const Select = {
|
||||||
label: this.getLabelBySingleValue(selectedKey),
|
label: this.getLabelBySingleValue(selectedKey),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.$emit('deselect', event, this.getOptionBySingleValue(selectedKey));
|
this.__emit('deselect', event, this.getOptionBySingleValue(selectedKey));
|
||||||
}
|
}
|
||||||
this.fireChange(value);
|
this.fireChange(value);
|
||||||
},
|
},
|
||||||
|
@ -1067,7 +1067,7 @@ const Select = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fireSelect(value) {
|
fireSelect(value) {
|
||||||
this.$emit('select', this.getVLBySingleValue(value), this.getOptionBySingleValue(value));
|
this.__emit('select', this.getVLBySingleValue(value), this.getOptionBySingleValue(value));
|
||||||
},
|
},
|
||||||
fireChange(value) {
|
fireChange(value) {
|
||||||
if (!hasProp(this, 'value')) {
|
if (!hasProp(this, 'value')) {
|
||||||
|
@ -1081,8 +1081,8 @@ const Select = {
|
||||||
const vls = this.getVLForOnChange(value);
|
const vls = this.getVLForOnChange(value);
|
||||||
const options = this.getOptionsBySingleValue(value);
|
const options = this.getOptionsBySingleValue(value);
|
||||||
this._valueOptions = options;
|
this._valueOptions = options;
|
||||||
this.$emit('update:value', vls);
|
this.__emit('update:value', vls);
|
||||||
this.$emit('change', vls, isMultipleOrTags(this.$props) ? options : options[0]);
|
this.__emit('change', vls, isMultipleOrTags(this.$props) ? options : options[0]);
|
||||||
},
|
},
|
||||||
|
|
||||||
isChildDisabled(key) {
|
isChildDisabled(key) {
|
||||||
|
@ -1500,7 +1500,7 @@ const Select = {
|
||||||
// }
|
// }
|
||||||
// this._focused = true;
|
// this._focused = true;
|
||||||
// this.updateFocusClassName();
|
// this.updateFocusClassName();
|
||||||
// this.$emit('focus');
|
// this.__emit('focus');
|
||||||
},
|
},
|
||||||
selectionRefBlur(e) {
|
selectionRefBlur(e) {
|
||||||
if (isMultipleOrTagsOrCombobox(this.$props)) {
|
if (isMultipleOrTagsOrCombobox(this.$props)) {
|
||||||
|
|
|
@ -186,7 +186,7 @@ export default {
|
||||||
image.onload = handler;
|
image.onload = handler;
|
||||||
image.onerror = () => {
|
image.onerror = () => {
|
||||||
handler();
|
handler();
|
||||||
this.$emit('lazyLoadError');
|
this.__emit('lazyLoadError');
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ export default {
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad),
|
lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad),
|
||||||
}));
|
}));
|
||||||
this.$emit('lazyLoad', slidesToLoad);
|
this.__emit('lazyLoad', slidesToLoad);
|
||||||
} else {
|
} else {
|
||||||
if (this.lazyLoadTimer) {
|
if (this.lazyLoadTimer) {
|
||||||
clearInterval(this.lazyLoadTimer);
|
clearInterval(this.lazyLoadTimer);
|
||||||
|
@ -234,7 +234,7 @@ export default {
|
||||||
value => this.lazyLoadedList.indexOf(value) < 0,
|
value => this.lazyLoadedList.indexOf(value) < 0,
|
||||||
);
|
);
|
||||||
if (this.$attrs.onLazyLoad && slidesToLoad.length > 0) {
|
if (this.$attrs.onLazyLoad && slidesToLoad.length > 0) {
|
||||||
this.$emit('lazyLoad', slidesToLoad);
|
this.__emit('lazyLoad', slidesToLoad);
|
||||||
}
|
}
|
||||||
this.setState(state, () => {
|
this.setState(state, () => {
|
||||||
asNavFor &&
|
asNavFor &&
|
||||||
|
@ -433,7 +433,7 @@ export default {
|
||||||
},
|
},
|
||||||
beforeMount() {
|
beforeMount() {
|
||||||
this.ssrInit();
|
this.ssrInit();
|
||||||
this.$emit('init');
|
this.__emit('init');
|
||||||
if (this.lazyLoad) {
|
if (this.lazyLoad) {
|
||||||
const slidesToLoad = getOnDemandLazySlides({
|
const slidesToLoad = getOnDemandLazySlides({
|
||||||
...this.$props,
|
...this.$props,
|
||||||
|
@ -443,7 +443,7 @@ export default {
|
||||||
this.setState(prevState => ({
|
this.setState(prevState => ({
|
||||||
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad),
|
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad),
|
||||||
}));
|
}));
|
||||||
this.$emit('lazyLoad', slidesToLoad);
|
this.__emit('lazyLoad', slidesToLoad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -508,7 +508,7 @@ export default {
|
||||||
},
|
},
|
||||||
updated() {
|
updated() {
|
||||||
this.checkImagesLoad();
|
this.checkImagesLoad();
|
||||||
this.$emit('reInit');
|
this.__emit('reInit');
|
||||||
if (this.lazyLoad) {
|
if (this.lazyLoad) {
|
||||||
const slidesToLoad = getOnDemandLazySlides({
|
const slidesToLoad = getOnDemandLazySlides({
|
||||||
...this.$props,
|
...this.$props,
|
||||||
|
@ -518,7 +518,7 @@ export default {
|
||||||
this.setState(prevState => ({
|
this.setState(prevState => ({
|
||||||
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad),
|
lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad),
|
||||||
}));
|
}));
|
||||||
this.$emit('lazyLoad');
|
this.__emit('lazyLoad');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (this.props.onLazyLoad) {
|
// if (this.props.onLazyLoad) {
|
||||||
|
|
|
@ -106,7 +106,7 @@ const Range = {
|
||||||
const newValues = value.map(v => {
|
const newValues = value.map(v => {
|
||||||
return utils.ensureValueInRange(v, this.$props);
|
return utils.ensureValueInRange(v, this.$props);
|
||||||
});
|
});
|
||||||
this.$emit('change', newValues);
|
this.__emit('change', newValues);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChange(state) {
|
onChange(state) {
|
||||||
|
@ -129,11 +129,11 @@ const Range = {
|
||||||
|
|
||||||
const data = { ...this.$data, ...state };
|
const data = { ...this.$data, ...state };
|
||||||
const changedValue = data.bounds;
|
const changedValue = data.bounds;
|
||||||
this.$emit('change', changedValue);
|
this.__emit('change', changedValue);
|
||||||
},
|
},
|
||||||
onStart(position) {
|
onStart(position) {
|
||||||
const { bounds } = this;
|
const { bounds } = this;
|
||||||
this.$emit('beforeChange', bounds);
|
this.__emit('beforeChange', bounds);
|
||||||
|
|
||||||
const value = this.calcValueByPos(position);
|
const value = this.calcValueByPos(position);
|
||||||
this.startValue = value;
|
this.startValue = value;
|
||||||
|
@ -157,7 +157,7 @@ const Range = {
|
||||||
const { sHandle } = this;
|
const { sHandle } = this;
|
||||||
this.removeDocumentEvents();
|
this.removeDocumentEvents();
|
||||||
if (sHandle !== null || force) {
|
if (sHandle !== null || force) {
|
||||||
this.$emit('afterChange', this.bounds);
|
this.__emit('afterChange', this.bounds);
|
||||||
}
|
}
|
||||||
this.setState({ sHandle: null });
|
this.setState({ sHandle: null });
|
||||||
},
|
},
|
||||||
|
@ -267,7 +267,7 @@ const Range = {
|
||||||
// so trigger focus will invoke handler's onEnd and another handler's onStart too early,
|
// so trigger focus will invoke handler's onEnd and another handler's onStart too early,
|
||||||
// cause onBeforeChange and onAfterChange receive wrong value.
|
// cause onBeforeChange and onAfterChange receive wrong value.
|
||||||
// here use setState callback to hack,but not elegant
|
// here use setState callback to hack,but not elegant
|
||||||
this.$emit('afterChange', nextBounds);
|
this.__emit('afterChange', nextBounds);
|
||||||
this.setState({}, () => {
|
this.setState({}, () => {
|
||||||
this.handlesRefs[nextHandle].focus();
|
this.handlesRefs[nextHandle].focus();
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,7 +51,7 @@ const Slider = {
|
||||||
|
|
||||||
this.setState({ sValue: nextValue });
|
this.setState({ sValue: nextValue });
|
||||||
if (utils.isValueOutOfRange(newValue, this.$props)) {
|
if (utils.isValueOutOfRange(newValue, this.$props)) {
|
||||||
this.$emit('change', nextValue);
|
this.__emit('change', nextValue);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onChange(state) {
|
onChange(state) {
|
||||||
|
@ -62,12 +62,12 @@ const Slider = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const changedValue = nextState.sValue;
|
const changedValue = nextState.sValue;
|
||||||
this.$emit('change', changedValue);
|
this.__emit('change', changedValue);
|
||||||
},
|
},
|
||||||
onStart(position) {
|
onStart(position) {
|
||||||
this.setState({ dragging: true });
|
this.setState({ dragging: true });
|
||||||
const { sValue } = this;
|
const { sValue } = this;
|
||||||
this.$emit('beforeChange', sValue);
|
this.__emit('beforeChange', sValue);
|
||||||
|
|
||||||
const value = this.calcValueByPos(position);
|
const value = this.calcValueByPos(position);
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ const Slider = {
|
||||||
const { dragging } = this;
|
const { dragging } = this;
|
||||||
this.removeDocumentEvents();
|
this.removeDocumentEvents();
|
||||||
if (dragging || force) {
|
if (dragging || force) {
|
||||||
this.$emit('afterChange', this.sValue);
|
this.__emit('afterChange', this.sValue);
|
||||||
}
|
}
|
||||||
this.setState({ dragging: false });
|
this.setState({ dragging: false });
|
||||||
},
|
},
|
||||||
|
@ -105,7 +105,7 @@ const Slider = {
|
||||||
if (value === sValue) return;
|
if (value === sValue) return;
|
||||||
|
|
||||||
this.onChange({ sValue: value });
|
this.onChange({ sValue: value });
|
||||||
this.$emit('afterChange', value);
|
this.__emit('afterChange', value);
|
||||||
this.onEnd();
|
this.onEnd();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,6 +7,7 @@ import Steps from './Steps';
|
||||||
import Marks from './Marks';
|
import Marks from './Marks';
|
||||||
import Handle from '../Handle';
|
import Handle from '../Handle';
|
||||||
import * as utils from '../utils';
|
import * as utils from '../utils';
|
||||||
|
import BaseMixin from '../../../_util/BaseMixin';
|
||||||
|
|
||||||
function noop() {}
|
function noop() {}
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export default function createSlider(Component) {
|
||||||
return {
|
return {
|
||||||
name: 'createSlider',
|
name: 'createSlider',
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
mixins: [Component],
|
mixins: [BaseMixin, Component],
|
||||||
// model: {
|
// model: {
|
||||||
// prop: 'value',
|
// prop: 'value',
|
||||||
// event: 'change',
|
// event: 'change',
|
||||||
|
@ -143,12 +144,12 @@ export default function createSlider(Component) {
|
||||||
this.dragOffset = 0;
|
this.dragOffset = 0;
|
||||||
this.onStart(handlePosition);
|
this.onStart(handlePosition);
|
||||||
utils.pauseEvent(e);
|
utils.pauseEvent(e);
|
||||||
this.$emit('focus', e);
|
this.__emit('focus', e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onBlur(e) {
|
onBlur(e) {
|
||||||
this.onEnd();
|
this.onEnd();
|
||||||
this.$emit('blur', e);
|
this.__emit('blur', e);
|
||||||
},
|
},
|
||||||
onMouseUp() {
|
onMouseUp() {
|
||||||
if (this.handlesRefs[this.prevMovedHandleIndex]) {
|
if (this.handlesRefs[this.prevMovedHandleIndex]) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import { getOptionProps, getComponent } from '../_util/props-util';
|
import { getOptionProps, getComponent } from '../_util/props-util';
|
||||||
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
|
|
||||||
function isString(str) {
|
function isString(str) {
|
||||||
return typeof str === 'string';
|
return typeof str === 'string';
|
||||||
|
@ -7,6 +8,7 @@ function isString(str) {
|
||||||
function noop() {}
|
function noop() {}
|
||||||
export default {
|
export default {
|
||||||
name: 'Step',
|
name: 'Step',
|
||||||
|
mixins: [BaseMixin],
|
||||||
props: {
|
props: {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
wrapperStyle: PropTypes.object,
|
wrapperStyle: PropTypes.object,
|
||||||
|
@ -33,8 +35,8 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onItemClick(...args) {
|
onItemClick(...args) {
|
||||||
this.$emit('click', ...args);
|
this.__emit('click', ...args);
|
||||||
this.$emit('stepClick', this.stepIndex);
|
this.__emit('stepClick', this.stepIndex);
|
||||||
},
|
},
|
||||||
renderIconNode() {
|
renderIconNode() {
|
||||||
const { prefixCls, stepNumber, status, iconPrefix, icons, progressDot } = getOptionProps(
|
const { prefixCls, stepNumber, status, iconPrefix, icons, progressDot } = getOptionProps(
|
||||||
|
|
|
@ -58,8 +58,8 @@ export default {
|
||||||
onStepClick(next) {
|
onStepClick(next) {
|
||||||
const { current } = this.$props;
|
const { current } = this.$props;
|
||||||
if (current !== next) {
|
if (current !== next) {
|
||||||
this.$emit('change', next);
|
this.__emit('change', next);
|
||||||
this.$emit('update:current', next);
|
this.__emit('update:current', next);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
calcStepOffsetWidth() {
|
calcStepOffsetWidth() {
|
||||||
|
|
|
@ -49,13 +49,13 @@ export default {
|
||||||
if (!hasProp(this, 'checked')) {
|
if (!hasProp(this, 'checked')) {
|
||||||
this.stateChecked = checked;
|
this.stateChecked = checked;
|
||||||
}
|
}
|
||||||
this.$emit('change', checked, e);
|
this.__emit('change', checked, e);
|
||||||
this.$emit('update:checked', checked);
|
this.__emit('update:checked', checked);
|
||||||
},
|
},
|
||||||
handleClick(e) {
|
handleClick(e) {
|
||||||
const checked = !this.stateChecked;
|
const checked = !this.stateChecked;
|
||||||
this.setChecked(checked, e);
|
this.setChecked(checked, e);
|
||||||
this.$emit('click', checked, e);
|
this.__emit('click', checked, e);
|
||||||
},
|
},
|
||||||
handleKeyDown(e) {
|
handleKeyDown(e) {
|
||||||
if (e.keyCode === 37) {
|
if (e.keyCode === 37) {
|
||||||
|
@ -69,7 +69,7 @@ export default {
|
||||||
handleMouseUp(e) {
|
handleMouseUp(e) {
|
||||||
this.refSwitchNode?.blur();
|
this.refSwitchNode?.blur();
|
||||||
|
|
||||||
this.$emit('mouseup', e);
|
this.__emit('mouseup', e);
|
||||||
},
|
},
|
||||||
focus() {
|
focus() {
|
||||||
this.refSwitchNode?.focus();
|
this.refSwitchNode?.focus();
|
||||||
|
|
|
@ -140,7 +140,7 @@ export default {
|
||||||
_activeKey: activeKey,
|
_activeKey: activeKey,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('update:activeKey', activeKey);
|
this.__emit('update:activeKey', activeKey);
|
||||||
this.__emit('change', activeKey);
|
this.__emit('change', activeKey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -481,7 +481,7 @@ const Tree = {
|
||||||
_halfCheckedKeys: halfCheckedKeys,
|
_halfCheckedKeys: halfCheckedKeys,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.$emit('update:checkedKeys', checkedObj);
|
this.__emit('update:checkedKeys', checkedObj);
|
||||||
|
|
||||||
this.__emit('check', checkedObj, eventObj);
|
this.__emit('check', checkedObj, eventObj);
|
||||||
},
|
},
|
||||||
|
|
|
@ -89,7 +89,7 @@ const AjaxUploader = {
|
||||||
this.uploadFiles(successFiles);
|
this.uploadFiles(successFiles);
|
||||||
|
|
||||||
if (errorFiles.length) {
|
if (errorFiles.length) {
|
||||||
this.$emit('reject', errorFiles);
|
this.__emit('reject', errorFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -161,19 +161,19 @@ const AjaxUploader = {
|
||||||
withCredentials: this.withCredentials,
|
withCredentials: this.withCredentials,
|
||||||
method: props.method || 'post',
|
method: props.method || 'post',
|
||||||
onProgress: e => {
|
onProgress: e => {
|
||||||
this.$emit('progress', e, file);
|
this.__emit('progress', e, file);
|
||||||
},
|
},
|
||||||
onSuccess: (ret, xhr) => {
|
onSuccess: (ret, xhr) => {
|
||||||
delete this.reqs[uid];
|
delete this.reqs[uid];
|
||||||
this.$emit('success', ret, file, xhr);
|
this.__emit('success', ret, file, xhr);
|
||||||
},
|
},
|
||||||
onError: (err, ret) => {
|
onError: (err, ret) => {
|
||||||
delete this.reqs[uid];
|
delete this.reqs[uid];
|
||||||
this.$emit('error', err, ret, file);
|
this.__emit('error', err, ret, file);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.reqs[uid] = request(requestOption);
|
this.reqs[uid] = request(requestOption);
|
||||||
this.$emit('start', file);
|
this.__emit('start', file);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,6 +16,7 @@ const IFRAME_STYLE = {
|
||||||
|
|
||||||
// diferent from AjaxUpload, can only upload on at one time, serial seriously
|
// diferent from AjaxUpload, can only upload on at one time, serial seriously
|
||||||
const IframeUploader = {
|
const IframeUploader = {
|
||||||
|
name: 'IframeUploader',
|
||||||
mixins: [BaseMixin],
|
mixins: [BaseMixin],
|
||||||
props: {
|
props: {
|
||||||
componentTag: PropTypes.string,
|
componentTag: PropTypes.string,
|
||||||
|
@ -51,14 +52,14 @@ const IframeUploader = {
|
||||||
doc.body.removeChild(script);
|
doc.body.removeChild(script);
|
||||||
}
|
}
|
||||||
response = doc.body.innerHTML;
|
response = doc.body.innerHTML;
|
||||||
this.$emit('success', response, file);
|
this.__emit('success', response, file);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
warning(
|
warning(
|
||||||
false,
|
false,
|
||||||
'cross domain error for Upload. Maybe server should return document.domain script. see Note from https://github.com/react-component/upload',
|
'cross domain error for Upload. Maybe server should return document.domain script. see Note from https://github.com/react-component/upload',
|
||||||
);
|
);
|
||||||
response = 'cross-domain';
|
response = 'cross-domain';
|
||||||
this.$emit('error', err, null, file);
|
this.__emit('error', err, null, file);
|
||||||
}
|
}
|
||||||
this.endUpload();
|
this.endUpload();
|
||||||
},
|
},
|
||||||
|
@ -239,7 +240,7 @@ const IframeUploader = {
|
||||||
formNode.setAttribute('action', action);
|
formNode.setAttribute('action', action);
|
||||||
formNode.submit();
|
formNode.submit();
|
||||||
dataSpan.innerHTML = '';
|
dataSpan.innerHTML = '';
|
||||||
this.$emit('start', file);
|
this.__emit('start', file);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -63,7 +63,7 @@ export default {
|
||||||
this.Component = this.getComponent();
|
this.Component = this.getComponent();
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
this.$emit('ready');
|
this.__emit('ready');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue