mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 23:20:12 +08:00
Add support to conditional for event handler (#474)
This commit is contained in:
parent
86fd3a432a
commit
49e82232f9
@ -49,34 +49,42 @@ export const fieldMixin = {
|
|||||||
this.handleChange(value)
|
this.handleChange(value)
|
||||||
},
|
},
|
||||||
focusGained(value) {
|
focusGained(value) {
|
||||||
|
if (this.metadata.handleFocusGained) {
|
||||||
this.$store.dispatch('notifyFocusGained', {
|
this.$store.dispatch('notifyFocusGained', {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName,
|
columnName: this.metadata.columnName,
|
||||||
value: this.value
|
value: this.value
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
focusLost(value) {
|
focusLost(value) {
|
||||||
|
if (this.metadata.handleFocusLost) {
|
||||||
this.$store.dispatch('notifyFocusLost', {
|
this.$store.dispatch('notifyFocusLost', {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName,
|
columnName: this.metadata.columnName,
|
||||||
value: this.value
|
value: this.value
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
keyPressed(value) {
|
keyPressed(value) {
|
||||||
|
if (this.metadata.handleKeyPressed) {
|
||||||
this.$store.dispatch('notifyKeyPressed', {
|
this.$store.dispatch('notifyKeyPressed', {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName,
|
columnName: this.metadata.columnName,
|
||||||
value: value.key,
|
value: value.key,
|
||||||
keyCode: value.keyCode
|
keyCode: value.keyCode
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
keyReleased(value) {
|
keyReleased(value) {
|
||||||
|
if (this.metadata.handleKeyReleased) {
|
||||||
this.$store.dispatch('notifyKeyReleased', {
|
this.$store.dispatch('notifyKeyReleased', {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName,
|
columnName: this.metadata.columnName,
|
||||||
value: value.key,
|
value: value.key,
|
||||||
keyCode: value.keyCode
|
keyCode: value.keyCode
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @param {mixed} value, main value in component
|
* @param {mixed} value, main value in component
|
||||||
@ -115,11 +123,13 @@ export const fieldMixin = {
|
|||||||
isChangedOldValue
|
isChangedOldValue
|
||||||
}
|
}
|
||||||
// Global Action performed
|
// Global Action performed
|
||||||
|
if (this.metadata.handleActionPerformed) {
|
||||||
this.$store.dispatch('notifyActionPerformed', {
|
this.$store.dispatch('notifyActionPerformed', {
|
||||||
containerUuid: this.metadata.containerUuid,
|
containerUuid: this.metadata.containerUuid,
|
||||||
columnName: this.metadata.columnName,
|
columnName: this.metadata.columnName,
|
||||||
value: newValue
|
value: newValue
|
||||||
})
|
})
|
||||||
|
}
|
||||||
if (this.metadata.inTable) {
|
if (this.metadata.inTable) {
|
||||||
this.$store.dispatch('notifyCellTableChange', {
|
this.$store.dispatch('notifyCellTableChange', {
|
||||||
...sendParameters,
|
...sendParameters,
|
||||||
|
@ -309,6 +309,11 @@ export function getFieldTemplate(overwriteDefinition) {
|
|||||||
mandatoryLogic: undefined,
|
mandatoryLogic: undefined,
|
||||||
readOnlyLogic: undefined,
|
readOnlyLogic: undefined,
|
||||||
parentFieldsList: undefined,
|
parentFieldsList: undefined,
|
||||||
|
handleFocusGained: false,
|
||||||
|
handleFocusLost: false,
|
||||||
|
handleKeyPressed: false,
|
||||||
|
handleKeyReleased: false,
|
||||||
|
handleActionPerformed: true,
|
||||||
dependentFieldsList: [],
|
dependentFieldsList: [],
|
||||||
reference: {
|
reference: {
|
||||||
tableName: '',
|
tableName: '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user