Skip to content

Commit

Permalink
fix: FormItem props type define,InfiniteScroll null safe (tusen-ai#5840)
Browse files Browse the repository at this point in the history
Signed-off-by: Sepush <sepush@outlook.com>
  • Loading branch information
Sepush committed Apr 5, 2024
1 parent 046ee39 commit 8a2bb29
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^43.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-markdown": "^4.0.1",
"eslint-plugin-markdown": "^3.0.1",
"eslint-plugin-n": "^16.0.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
Expand Down
8 changes: 4 additions & 4 deletions src/form/src/FormItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import type {
FormItemInst,
FormItemInternalValidate,
FormItemInternalValidateResult,
type FeedBackPositonCrosswise,
type FeedBackPositonVertical
FeedBackPositonCrosswise,
FeedBackPositonVertical
} from './interface'
import { formInjectionKey, formItemInstsInjectionKey } from './context'
import style from './styles/form-item.cssr'
Expand Down Expand Up @@ -82,11 +82,11 @@ export const formItemProps = {
validationStatus: String as PropType<'error' | 'warning' | 'success'>,
feedback: String,
feedbackCrosswise: {
type: String as FeedBackPositonCrosswise,
type: String as PropType<FeedBackPositonCrosswise>,
default: 'left'
},
feedbackVertical: {
type: String as FeedBackPositonVertical,
type: String as PropType<FeedBackPositonVertical>,
default: 'bottom'
},
showLabel: {
Expand Down
24 changes: 17 additions & 7 deletions src/infinite-scroll/src/InfiniteScroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@ export default defineComponent({
const scrollbarInstRef = ref<ScrollbarInst | null>(null)

const handleCheckBottom = async (): Promise<void> => {
const { containerRef, containerScrollTop } = scrollbarInstRef.value
const { scrollHeight } = containerRef
if (
containerScrollTop + containerRef.clientHeight >=
scrollHeight - props.distance
) {
await props.onLoad?.()
const { value: scrollbarInst } = scrollbarInstRef
if (scrollbarInst) {
const { containerRef, containerScrollTop } = scrollbarInst
const scrollHeight = containerRef?.scrollHeight
const clientHeight = containerRef?.clientHeight
if (
containerRef &&
scrollHeight !== undefined &&
clientHeight !== undefined
) {
if (
containerScrollTop + clientHeight >=
scrollHeight - props.distance
) {
await props.onLoad?.()
}
}
}
}

Expand Down
Loading

0 comments on commit 8a2bb29

Please sign in to comment.