fix: adapt vueuc type breaking changes

This commit is contained in:
07akioni 2021-05-19 13:31:21 +08:00
parent 56ed02fcca
commit f201e362aa
7 changed files with 26 additions and 26 deletions

View File

@ -107,7 +107,7 @@
"vite": "^2.1.3"
},
"dependencies": {
"@css-render/plugin-bem": "^0.13.9",
"@css-render/plugin-bem": "^0.14.1",
"async-validator": "^3.5.1",
"css-render": "^0.14.1",
"date-fns": "^2.19.0",

View File

@ -14,7 +14,7 @@ import {
InjectionKey
} from 'vue'
import { TreeNode, createIndexGetter } from 'treemate'
import { VirtualList, VirtualListRef } from 'vueuc'
import { VirtualList, VirtualListInst } from 'vueuc'
import { depx, getPadding, happensIn } from 'seemly'
import { NEmpty } from '../../../empty'
import { NScrollbar } from '../../../scrollbar'
@ -127,7 +127,7 @@ export default defineComponent({
toRef(props, 'clsPrefix')
)
const selfRef = ref<HTMLElement | null>(null)
const virtualListRef = ref<VirtualListRef | null>(null)
const virtualListRef = ref<VirtualListInst | null>(null)
const scrollbarRef = ref<ScrollbarInst | null>(null)
const flattenedNodesRef = computed(() => props.treeMate.getFlattenedNodes())
const fIndexGetterRef = computed(() =>
@ -352,11 +352,11 @@ export default defineComponent({
empty: emptyRef,
virtualListContainer () {
const { value } = virtualListRef
return value?.listRef as HTMLElement
return value?.listElRef as HTMLElement
},
virtualListContent () {
const { value } = virtualListRef
return value?.itemsRef as HTMLElement
return value?.itemsElRef as HTMLElement
},
doScroll,
handleFocusin,

View File

@ -13,7 +13,7 @@ import {
watchEffect,
onMounted
} from 'vue'
import { VOverflow, VOverflowRef } from 'vueuc'
import { VOverflow, VOverflowInst } from 'vueuc'
import type { SelectBaseOption } from '../../../select/src/interface'
import { NPopover } from '../../../popover'
import { NTag } from '../../../tag'
@ -94,7 +94,7 @@ export default defineComponent({
const patternInputWrapperRef = ref<HTMLElement | null>(null)
const counterRef = ref<TagRef | null>(null)
const counterWrapperRef = ref<HTMLElement | null>(null)
const overflowRef = ref<VOverflowRef | null>(null)
const overflowRef = ref<VOverflowInst | null>(null)
const showTagsPopoverRef = ref<boolean>(false)
const patternInputFocusedRef = ref(false)

View File

@ -1,5 +1,5 @@
import { h, ref, defineComponent, inject, PropType, computed } from 'vue'
import { VirtualList, VirtualListRef } from 'vueuc'
import { VirtualList, VirtualListInst } from 'vueuc'
import NCascaderOption from './CascaderOption'
import { NScrollbar } from '../../scrollbar'
import type { ScrollbarInst } from '../../scrollbar'
@ -31,7 +31,7 @@ export default defineComponent({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
} = inject(cascaderInjectionKey)!
const scrollbarInstRef = ref<ScrollbarInst | null>(null)
const vlInstRef = ref<VirtualListRef | null>(null)
const vlInstRef = ref<VirtualListInst | null>(null)
const inst: CascaderSubmenuInstance = {
scroll (index: number, elSize: number) {
if (virtualScrollRef.value) {
@ -57,10 +57,10 @@ export default defineComponent({
scrollbarInstRef.value?.sync()
},
getVlContainer: () => {
return vlInstRef.value?.listRef
return vlInstRef.value?.listElRef
},
getVlContent: () => {
return vlInstRef.value?.itemsRef
return vlInstRef.value?.itemsElRef
},
...inst
}

View File

@ -9,7 +9,7 @@ import {
PropType
} from 'vue'
import { pxfy } from 'seemly'
import { VirtualList, VirtualListRef } from 'vueuc'
import { VirtualList, VirtualListInst } from 'vueuc'
import { c } from '../../../_utils/cssr'
import { NScrollbar, ScrollbarInst } from '../../../scrollbar'
import { formatLength } from '../../../_utils'
@ -101,7 +101,7 @@ export default defineComponent({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
} = inject(dataTableInjectionKey)!
const scrollbarInstRef = ref<ScrollbarInst | null>(null)
const virtualListRef = ref<VirtualListRef | null>(null)
const virtualListRef = ref<VirtualListInst | null>(null)
function handleCheckboxUpdateChecked (
tmNode: { key: RowKey },
checked: boolean
@ -140,11 +140,11 @@ export default defineComponent({
}
function virtualListContainer (): HTMLElement {
const { value } = virtualListRef
return value?.listRef as HTMLElement
return value?.listElRef as HTMLElement
}
function virtualListContent (): HTMLElement {
const { value } = virtualListRef
return value?.itemsRef as HTMLElement
return value?.itemsElRef as HTMLElement
}
function handleVirtualListScroll (e: Event): void {
handleTableBodyScroll(e)

View File

@ -7,7 +7,7 @@ import {
TransitionGroup,
Transition
} from 'vue'
import { VirtualList, VirtualListRef } from 'vueuc'
import { VirtualList, VirtualListInst } from 'vueuc'
import { NEmpty } from '../../empty'
import { NScrollbar, ScrollbarInst } from '../../scrollbar'
import { Option, transferInjectionKey } from './interface'
@ -49,21 +49,21 @@ export default defineComponent({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { mergedThemeRef, mergedClsPrefixRef } = inject(transferInjectionKey)!
const scrollerInstRef = ref<ScrollbarInst | null>(null)
const vlInstRef = ref<VirtualListRef | null>(null)
const vlInstRef = ref<VirtualListInst | null>(null)
function syncVLScroller (): void {
scrollerInstRef.value?.sync()
}
function scrollContainer (): HTMLElement | null {
const { value } = vlInstRef
if (!value) return null
const { listRef } = value
return listRef
const { listElRef } = value
return listElRef
}
function scrollContent (): HTMLElement | null {
const { value } = vlInstRef
if (!value) return null
const { itemsRef } = value
return itemsRef
const { itemsElRef } = value
return itemsElRef
}
return {
mergedTheme: mergedThemeRef,

View File

@ -13,7 +13,7 @@ import {
} from 'vue'
import { createTreeMate, flatten } from 'treemate'
import { useMergedState } from 'vooks'
import { VirtualListRef, VVirtualList } from 'vueuc'
import { VirtualListInst, VVirtualList } from 'vueuc'
import { useConfig, useTheme } from '../../_mixins'
import type { ThemeProps } from '../../_mixins'
import { call, warn } from '../../_utils'
@ -203,12 +203,12 @@ export default defineComponent({
)
const selfElRef = ref<HTMLDivElement | null>(null)
const scrollbarInstRef = ref<ScrollbarInst | null>(null)
const virtualListInstRef = ref<VirtualListRef | null>(null)
const virtualListInstRef = ref<VirtualListInst | null>(null)
function getScrollContainer (): HTMLElement | null | undefined {
return virtualListInstRef.value?.listRef
return virtualListInstRef.value?.listElRef
}
function getScrollContent (): HTMLElement | null | undefined {
return virtualListInstRef.value?.itemsRef
return virtualListInstRef.value?.itemsElRef
}
const treeMateRef = computed(() => createTreeMate(props.data))
const uncontrolledCheckedKeysRef = ref(
@ -307,7 +307,7 @@ export default defineComponent({
}
const { virtualScroll } = props
const viewportHeight = (virtualScroll
? virtualListInstRef.value!.listRef
? virtualListInstRef.value!.listElRef
: selfElRef.value!
).offsetHeight
const viewportItemCount = Math.ceil(viewportHeight / ITEM_SIZE) + 1