Skip to content

Commit

Permalink
Merge pull request #11654 from element-plus/dev
Browse files Browse the repository at this point in the history
D2M
  • Loading branch information
jw-foss committed Feb 19, 2023
2 parents 6c6ad89 + 6c2dd5d commit 7928954
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
## Changelog

### 2.2.32

_2023-02-19_

#### Bug fixes

- Components [table] fix an undefined reference in table-layout (#11204 by @jaa134)
- Components [cascader] add focus and blur event when set filterable (#11273 by @btea)
- Components [dropdown] unmounted error (#11649 by @chenxch)

### 2.2.31

Expand Down
16 changes: 15 additions & 1 deletion packages/components/cascader/src/cascader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
:disabled="isDisabled"
:validate-event="false"
:size="realSize"
:class="nsCascader.is('focus', popperVisible)"
:class="inputClass"
:tabindex="multiple && filterable && !isDisabled ? -1 : undefined"
@compositionstart="handleComposition"
@compositionupdate="handleComposition"
@compositionend="handleComposition"
Expand Down Expand Up @@ -129,6 +130,8 @@
@compositionstart="handleComposition"
@compositionupdate="handleComposition"
@compositionend="handleComposition"
@focus="handleFocus"
@blur="handleBlur"
/>
</div>
</div>
Expand Down Expand Up @@ -261,6 +264,7 @@ const suggestionPanel: Ref<suggestionPanelType | null> = ref(null)
const popperVisible = ref(false)
const inputHover = ref(false)
const filtering = ref(false)
const filterFocus = ref(false)
const inputValue = ref('')
const searchInputValue = ref('')
const presentTags: Ref<Tag[]> = ref([])
Expand Down Expand Up @@ -350,6 +354,10 @@ const cascaderIconKls = computed(() => {
]
})
const inputClass = computed(() => {
return nsCascader.is('focus', popperVisible.value || filterFocus.value)
})
const togglePopperVisible = (visible?: boolean) => {
if (isDisabled.value) return
Expand Down Expand Up @@ -609,10 +617,16 @@ const handleDelete = () => {
}
const handleFocus = (e: FocusEvent) => {
const el = e.target as HTMLInputElement
const name = nsCascader.e('search-input')
if (el.className === name) {
filterFocus.value = true
}
emit('focus', e)
}
const handleBlur = (e: FocusEvent) => {
filterFocus.value = false
emit('blur', e)
}
Expand Down
8 changes: 4 additions & 4 deletions packages/components/dropdown/src/dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ import {
computed,
defineComponent,
getCurrentInstance,
onUnmounted,
onBeforeUnmount,
provide,
ref,
toRef,
Expand Down Expand Up @@ -192,9 +192,9 @@ export default defineComponent({
{ immediate: true }
)
onUnmounted(() => {
if (triggeringElement?.$el?.removeEventListener) {
triggeringElement.$el.removeEventListener(
onBeforeUnmount(() => {
if (triggeringElementRef.value?.$el?.removeEventListener) {
triggeringElementRef.value.$el.removeEventListener(
'pointerenter',
onAutofocusTriggerEnter
)
Expand Down
2 changes: 1 addition & 1 deletion packages/components/table/src/table-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TableLayout<T> {
*/
if (height === null) return false
const scrollBarRef = this.table.refs.scrollBarRef
if (this.table.vnode.el && scrollBarRef) {
if (this.table.vnode.el && scrollBarRef?.wrapRef) {
let scrollY = true
const prevScrollY = this.scrollY.value
scrollY =
Expand Down

0 comments on commit 7928954

Please sign in to comment.