feat: add popup ref
parent
0d67fc1966
commit
f9373e44ce
|
@ -55,7 +55,15 @@ const AutoComplete = {
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
event: 'change',
|
event: 'change',
|
||||||
},
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
savePopupRef: this.savePopupRef,
|
||||||
|
};
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
savePopupRef(ref) {
|
||||||
|
this.popupRef = ref;
|
||||||
|
},
|
||||||
getInputElement() {
|
getInputElement() {
|
||||||
const { $slots } = this;
|
const { $slots } = this;
|
||||||
const children = filterEmpty($slots.default);
|
const children = filterEmpty($slots.default);
|
||||||
|
|
|
@ -141,6 +141,11 @@ const Cascader = {
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
event: 'change',
|
event: 'change',
|
||||||
},
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
savePopupRef: this.savePopupRef,
|
||||||
|
};
|
||||||
|
},
|
||||||
inject: {
|
inject: {
|
||||||
configProvider: { default: () => ({}) },
|
configProvider: { default: () => ({}) },
|
||||||
localeData: { default: () => ({}) },
|
localeData: { default: () => ({}) },
|
||||||
|
@ -177,6 +182,9 @@ const Cascader = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
savePopupRef(ref) {
|
||||||
|
this.popupRef = ref;
|
||||||
|
},
|
||||||
highlightKeyword(str, keyword, prefixCls) {
|
highlightKeyword(str, keyword, prefixCls) {
|
||||||
return str
|
return str
|
||||||
.split(keyword)
|
.split(keyword)
|
||||||
|
|
|
@ -37,7 +37,11 @@ export default function wrapPicker(Picker, props, defaultFormat) {
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
event: 'change',
|
event: 'change',
|
||||||
},
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
savePopupRef: this.savePopupRef,
|
||||||
|
};
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
const { autoFocus, disabled } = this;
|
const { autoFocus, disabled } = this;
|
||||||
if (autoFocus && !disabled) {
|
if (autoFocus && !disabled) {
|
||||||
|
@ -47,6 +51,9 @@ export default function wrapPicker(Picker, props, defaultFormat) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
savePopupRef(ref) {
|
||||||
|
this.popupRef = ref;
|
||||||
|
},
|
||||||
handleOpenChange(open) {
|
handleOpenChange(open) {
|
||||||
this.$emit('openChange', open);
|
this.$emit('openChange', open);
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,7 +25,18 @@ export default {
|
||||||
event: 'visibleChange',
|
event: 'visibleChange',
|
||||||
},
|
},
|
||||||
props: DropdownButtonProps,
|
props: DropdownButtonProps,
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
savePopupRef: this.savePopupRef,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
inject: {
|
||||||
|
configProvider: { default: () => ({}) },
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
savePopupRef(ref) {
|
||||||
|
this.popupRef = ref;
|
||||||
|
},
|
||||||
onClick(e) {
|
onClick(e) {
|
||||||
this.$emit('click', e);
|
this.$emit('click', e);
|
||||||
},
|
},
|
||||||
|
@ -33,9 +44,6 @@ export default {
|
||||||
this.$emit('visibleChange', val);
|
this.$emit('visibleChange', val);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
inject: {
|
|
||||||
configProvider: { default: () => ({}) },
|
|
||||||
},
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
type,
|
type,
|
||||||
|
|
|
@ -20,10 +20,18 @@ const Dropdown = {
|
||||||
prop: 'visible',
|
prop: 'visible',
|
||||||
event: 'visibleChange',
|
event: 'visibleChange',
|
||||||
},
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
savePopupRef: this.savePopupRef,
|
||||||
|
};
|
||||||
|
},
|
||||||
inject: {
|
inject: {
|
||||||
configProvider: { default: () => ({}) },
|
configProvider: { default: () => ({}) },
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
savePopupRef(ref) {
|
||||||
|
this.popupRef = ref;
|
||||||
|
},
|
||||||
getTransitionName() {
|
getTransitionName() {
|
||||||
const { placement = '', transitionName } = this.$props;
|
const { placement = '', transitionName } = this.$props;
|
||||||
if (transitionName !== undefined) {
|
if (transitionName !== undefined) {
|
||||||
|
|
|
@ -106,6 +106,11 @@ const Select = {
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
event: 'change',
|
event: 'change',
|
||||||
},
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
savePopupRef: this.savePopupRef,
|
||||||
|
};
|
||||||
|
},
|
||||||
inject: {
|
inject: {
|
||||||
configProvider: { default: () => ({}) },
|
configProvider: { default: () => ({}) },
|
||||||
},
|
},
|
||||||
|
@ -118,6 +123,9 @@ const Select = {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
savePopupRef(ref) {
|
||||||
|
this.popupRef = ref;
|
||||||
|
},
|
||||||
focus() {
|
focus() {
|
||||||
this.$refs.vcSelect.focus();
|
this.$refs.vcSelect.focus();
|
||||||
},
|
},
|
||||||
|
|
|
@ -86,6 +86,11 @@ const TimePicker = {
|
||||||
prop: 'value',
|
prop: 'value',
|
||||||
event: 'change',
|
event: 'change',
|
||||||
},
|
},
|
||||||
|
provide() {
|
||||||
|
return {
|
||||||
|
savePopupRef: this.savePopupRef,
|
||||||
|
};
|
||||||
|
},
|
||||||
inject: {
|
inject: {
|
||||||
configProvider: { default: () => ({}) },
|
configProvider: { default: () => ({}) },
|
||||||
},
|
},
|
||||||
|
@ -104,6 +109,9 @@ const TimePicker = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
savePopupRef(ref) {
|
||||||
|
this.popupRef = ref;
|
||||||
|
},
|
||||||
handleChange(value) {
|
handleChange(value) {
|
||||||
if (!hasProp(this, 'value')) {
|
if (!hasProp(this, 'value')) {
|
||||||
this.setState({ sValue: value });
|
this.setState({ sValue: value });
|
||||||
|
|
|
@ -77,6 +77,7 @@ export default {
|
||||||
},
|
},
|
||||||
inject: {
|
inject: {
|
||||||
vcTriggerContext: { default: () => ({}) },
|
vcTriggerContext: { default: () => ({}) },
|
||||||
|
savePopupRef: { default: () => noop },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const props = this.$props;
|
const props = this.$props;
|
||||||
|
@ -350,6 +351,7 @@ export default {
|
||||||
},
|
},
|
||||||
savePopup(node) {
|
savePopup(node) {
|
||||||
this._component = node;
|
this._component = node;
|
||||||
|
this.savePopupRef(node);
|
||||||
},
|
},
|
||||||
getComponent() {
|
getComponent() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
Loading…
Reference in New Issue